-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 5 posts ] 
Author Message
 Post subject: cannot resolve symbol: class Session
PostPosted: Fri Jul 30, 2004 1:14 pm 
Newbie

Joined: Thu Jul 29, 2004 6:17 pm
Posts: 4
Hello,

With Hibernate-2.1 on WinXP & SapDB 7.5, I went through the 'Quickstart with Tomcat', but when I run my 'cat.jsp' I get:

cannot resolve symbol
symbol : class Session

-----

Using NetBeans IDE, I added a 'qstart' project.
I added the 'sapdb-7_5_0_5.jar' file to '/common/lib/'.
I added 'hibernate2.jar' - and the other required 3rd party libraries - to '/webapps/qstart/WEB-INF/lib/'.
I added the context node (resource declaration?) to '/conf/server.xml' (within the '<server>' node).
I added 'hibernate.cfg.xml' to '/WEB-INF/classes' (with the SAPDBDialect specified).
I added my 'First persistent class' (cat.class) and mapping (Cat.hbm.xml) to 'WEB-INF/classes'.
I created the 'Cat' table.
I added the 'HibernateUtil' helper class (sess.class) to '/WEB-INF/classes'.
I created 'cat.jsp' and added the session code for instantiating a new cat, and selecting the new cat.
My JSP imports "java.sql.*,java.util.*,java.text.*,java.io.*".

What did I do that's incorrect?
Does my JSP need to import other modules? Which?
What do I need to change or add to be able to insert and select records?

Thx,
Bob V

_________________
Bob V


Top
 Profile  
 
 Post subject: at least post stack trace
PostPosted: Fri Jul 30, 2004 5:07 pm 
Newbie

Joined: Wed Jul 28, 2004 4:18 pm
Posts: 7
at least post stack trace


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jul 30, 2004 5:27 pm 
Newbie

Joined: Thu Jul 29, 2004 6:17 pm
Posts: 4
org.apache.jasper.JasperException: Unable to compile class for JSP

An error occurred at line: 10 in the jsp file: /cat.jsp

Generated servlet error:
[javac] Compiling 1 source file

C:\Documents and Settings\bobv\.netbeans\3.6\jakarta-tomcat-5.0.19_base\work\Catalina\localhost\qstart\org\apache\jsp\cat_jsp.java:15: cannot resolve symbol
symbol : class Session
location: class org.apache.jsp.cat_jsp
Session session = HibernateUtil.currentSession();
^



An error occurred at line: 10 in the jsp file: /cat.jsp

Generated servlet error:
C:\Documents and Settings\bobv\.netbeans\3.6\jakarta-tomcat-5.0.19_base\work\Catalina\localhost\qstart\org\apache\jsp\cat_jsp.java:17: cannot resolve symbol
symbol : class Transaction
location: class org.apache.jsp.cat_jsp
Transaction tx= session.beginTransaction();
^



An error occurred at line: 10 in the jsp file: /cat.jsp

Generated servlet error:
C:\Documents and Settings\bobv\.netbeans\3.6\jakarta-tomcat-5.0.19_base\work\Catalina\localhost\qstart\org\apache\jsp\cat_jsp.java:15: cannot resolve symbol
symbol : variable HibernateUtil
location: class org.apache.jsp.cat_jsp
Session session = HibernateUtil.currentSession();
^



An error occurred at line: 15 in the jsp file: /cat.jsp

Generated servlet error:
C:\Documents and Settings\bobv\.netbeans\3.6\jakarta-tomcat-5.0.19_base\work\Catalina\localhost\qstart\org\apache\jsp\cat_jsp.java:63: cannot resolve symbol
symbol : class Cat
location: class org.apache.jsp.cat_jsp
Cat princess = new Cat();
^



An error occurred at line: 15 in the jsp file: /cat.jsp

Generated servlet error:
C:\Documents and Settings\bobv\.netbeans\3.6\jakarta-tomcat-5.0.19_base\work\Catalina\localhost\qstart\org\apache\jsp\cat_jsp.java:63: cannot resolve symbol
symbol : class Cat
location: class org.apache.jsp.cat_jsp
Cat princess = new Cat();
^



An error occurred at line: 15 in the jsp file: /cat.jsp

Generated servlet error:
C:\Documents and Settings\bobv\.netbeans\3.6\jakarta-tomcat-5.0.19_base\work\Catalina\localhost\qstart\org\apache\jsp\cat_jsp.java:71: cannot resolve symbol
symbol : variable HibernateUtil
location: class org.apache.jsp.cat_jsp
HibernateUtil.closeSession();
^



An error occurred at line: 15 in the jsp file: /cat.jsp

Generated servlet error:
C:\Documents and Settings\bobv\.netbeans\3.6\jakarta-tomcat-5.0.19_base\work\Catalina\localhost\qstart\org\apache\jsp\cat_jsp.java:74: cannot resolve symbol
symbol : class Transaction
location: class org.apache.jsp.cat_jsp
Transaction tx = session.beginTransaction();
^



An error occurred at line: 15 in the jsp file: /cat.jsp

Generated servlet error:
C:\Documents and Settings\bobv\.netbeans\3.6\jakarta-tomcat-5.0.19_base\work\Catalina\localhost\qstart\org\apache\jsp\cat_jsp.java:74: cannot resolve symbol
symbol : method beginTransaction ()
location: interface javax.servlet.http.HttpSession
Transaction tx = session.beginTransaction();
^



An error occurred at line: 15 in the jsp file: /cat.jsp

Generated servlet error:
C:\Documents and Settings\bobv\.netbeans\3.6\jakarta-tomcat-5.0.19_base\work\Catalina\localhost\qstart\org\apache\jsp\cat_jsp.java:76: cannot resolve symbol
symbol : class Query
location: class org.apache.jsp.cat_jsp
Query query = session.createQuery("select c from Cat as c where c.sex = :sex");
^



An error occurred at line: 15 in the jsp file: /cat.jsp

Generated servlet error:
C:\Documents and Settings\bobv\.netbeans\3.6\jakarta-tomcat-5.0.19_base\work\Catalina\localhost\qstart\org\apache\jsp\cat_jsp.java:76: cannot resolve symbol
symbol : method createQuery (java.lang.String)
location: interface javax.servlet.http.HttpSession
Query query = session.createQuery("select c from Cat as c where c.sex = :sex");
^



An error occurred at line: 15 in the jsp file: /cat.jsp

Generated servlet error:
C:\Documents and Settings\bobv\.netbeans\3.6\jakarta-tomcat-5.0.19_base\work\Catalina\localhost\qstart\org\apache\jsp\cat_jsp.java:79: cannot resolve symbol
symbol : class Cat
location: class org.apache.jsp.cat_jsp
Cat cat = (Cat) it.next();
^



An error occurred at line: 15 in the jsp file: /cat.jsp

Generated servlet error:
C:\Documents and Settings\bobv\.netbeans\3.6\jakarta-tomcat-5.0.19_base\work\Catalina\localhost\qstart\org\apache\jsp\cat_jsp.java:79: cannot resolve symbol
symbol : class Cat
location: class org.apache.jsp.cat_jsp
Cat cat = (Cat) it.next();
^
12 errors


at org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:127)
at org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:351)
at org.apache.jasper.compiler.Compiler.generateClass(Compiler.java:415)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:458)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:439)
at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:553)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:291)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:301)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:248)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:284)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:204)
at org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:305)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:233)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:204)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:257)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:151)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:567)
at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:245)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:199)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:151)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:567)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:184)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:151)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:164)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:149)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:567)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:156)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:151)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:567)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:972)
at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:206)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:833)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:732)
at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:619)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:688)
at java.lang.Thread.run(Thread.java:534)

_________________
Bob V


Top
 Profile  
 
 Post subject:
PostPosted: Sat Jul 31, 2004 1:17 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 3:00 pm
Posts: 1816
Location: Austin, TX
Well, if those classes cannot be found then the hibernate jar is *definitely* not on the classpath.

Its been a while since I've used NetBeans, but you used to have to explicitly "mount" any libraries you wanted in you classpath


Top
 Profile  
 
 Post subject:
PostPosted: Mon Aug 02, 2004 2:43 pm 
Newbie

Joined: Thu Jul 29, 2004 6:17 pm
Posts: 4
The file system for the project is mounted:

C:\Program Files\NetBeans3.6\jakarta-tomcat-5.0.19\webapps\qstart


The jar files are in:

C:\Program Files\NetBeans3.6\jakarta-tomcat-5.0.19\webapps\qstart\WEB-INF\lib

Following your response, I also added them to:

C:\Program Files\NetBeans3.6\jakarta-tomcat-5.0.19\common\lib

This still didn't work, so I added 'hibernate2.jar' to the NetBeans classpath:

Tools > Options > JAR Execution > Classpath > Ellipsis button > Add JAR/ZIP.

Still no improvement. Should I add it to the 'Library Path' instead?


C:\Documents and Settings\bobv\.netbeans\3.6\jakarta-tomcat-5.0.19_base\work\Catalina\localhost\qstart\org\apache\jsp\cat_jsp.java:15: cannot resolve symbol
symbol : class Session
location: class org.apache.jsp.cat_jsp
Session session = HibernateUtil.currentSession();

_________________
Bob V


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 5 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.