-->
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.  [ 4 posts ] 
Author Message
 Post subject: Error compiling quickstart
PostPosted: Fri Feb 20, 2004 12:47 pm 
Newbie

Joined: Fri Feb 20, 2004 10:07 am
Posts: 17
Hello-

This is the error I get while running the quickstart example in hibernate tutorial using JSP

-----------------------------
org.apache.jasper.JasperException: Unable to compile class for JSP

An error occurred at line: 2 in the jsp file: /jsps/go.jsp

Generated servlet error:
[javac] Compiling 1 source file

C:\tomcat\work\Standalone\localhost\quickstart\jsps\go_jsp.java:9: package net.sf.hibernate.examples.quickstart does not exist
import net.sf.hibernate.examples.quickstart.*;
^
C:\tomcat\work\Standalone\localhost\quickstart\jsps\go_jsp.java:46: session is already defined in _jspService(javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse)
Session session = HibernateUtil.currentSession();
^



An error occurred at line: 2 in the jsp file: /jsps/go.jsp

Generated servlet error:
C:\tomcat\work\Standalone\localhost\quickstart\jsps\go_jsp.java:46: cannot resolve symbol
symbol : variable HibernateUtil
location: class org.apache.jsp.go_jsp
Session session = HibernateUtil.currentSession();
^



An error occurred at line: 2 in the jsp file: /jsps/go.jsp

Generated servlet error:
C:\tomcat\work\Standalone\localhost\quickstart\jsps\go_jsp.java:50: cannot resolve symbol
symbol : class Cat
location: class org.apache.jsp.go_jsp
Cat princess = new Cat();
^



An error occurred at line: 2 in the jsp file: /jsps/go.jsp

Generated servlet error:
C:\tomcat\work\Standalone\localhost\quickstart\jsps\go_jsp.java:50: cannot resolve symbol
symbol : class Cat
location: class org.apache.jsp.go_jsp
Cat princess = new Cat();
^



An error occurred at line: 2 in the jsp file: /jsps/go.jsp

Generated servlet error:
C:\tomcat\work\Standalone\localhost\quickstart\jsps\go_jsp.java:58: cannot resolve symbol
symbol : variable HibernateUtil
location: class org.apache.jsp.go_jsp
HibernateUtil.closeSession();
^
6 errors


at org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:130)
at org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:293)
at org.apache.jasper.compiler.Compiler.generateClass(Compiler.java:340)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:352)
at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:474)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:184)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:260)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2415)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:170)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:172)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:223)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:432)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:386)
at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:534)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:530)
at java.lang.Thread.run(Thread.java:534)

----------------------------

HibernateUtils.java is in classes folder.

JSP code is given below:

-------------
<%@ page language="java" import="net.sf.hibernate.*,net.sf.hibernate.cfg.*,net.sf.hibernate.examples.quickstart.*"%>

<%
Session session = HibernateUtil.currentSession();

Transaction tx= session.beginTransaction();

Cat princess = new Cat();
princess.setName("Princess");
princess.setSex('F');
princess.setWeight(7.4f);

session.save(princess);
tx.commit();

HibernateUtil.closeSession();
%>
---------------

The lib folder contains:
----------
cglib-2.0-rc2.jar
dom4j-1.4.jar
hibernate2.jar
odmg-3.0.jar
---------------

Tomcat 4.1.18 is used.
Database is mysql

Could somebody inform the changes to be made in the system configuration or the code?

regards,
Amitabh.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Feb 20, 2004 1:02 pm 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
package net.sf.hibernate.examples.quickstart does not exist

_________________
JAVA PERSISTENCE WITH HIBERNATE
http://jpwh.org
Get the book, training, and consulting for your Hibernate team.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Feb 20, 2004 1:36 pm 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
vi developper ;-)

_________________
Emmanuel


Top
 Profile  
 
 Post subject:
PostPosted: Fri Feb 20, 2004 2:21 pm 
Newbie

Joined: Fri Feb 20, 2004 10:07 am
Posts: 17
hello-

net.sf.hibernate.examples.quickstart is in the classes folder of WEB-INF.

any specific classpath settings to be made?

web.xml :

---------
<?xml version="1.0" encoding="ISO-8859-1"?>

<!DOCTYPE web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd">

<web-app>
</web-app>

----------

hibernate.cfg.xml is in the classes folder and contains the folloowing instructions:

--------
<?xml version='1.0' encoding='utf-8'?>
<!DOCTYPE hibernate-configuration
PUBLIC "-//Hibernate/Hibernate Configuration DTD//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-2.0.dtd">

<hibernate-configuration>

<session-factory>

<property name="connection.datasource">java:comp/env/jdbc/quickstart</property>
<property name="show_sql">false</property>
<property name="dialect">net.sf.hibernate.dialect.MySQLDialect</property>

<!-- Mapping files -->
<mapping resource="net.sf.hibernate.examples.quickstart.Cat.hbm.xml"/>

</session-factory>

</hibernate-configuration>
----------
Cat.hbm.xml is in net\sf\hibernate\examples\quickstart folder and contains the following instructions:

--------
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping
PUBLIC "-//Hibernate/Hibernate Mapping DTD//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">

<hibernate-mapping>

<class name="net.sf.hibernate.examples.quickstart.Cat" table="CAT">

<!-- A 32 hex character is our surrogate key. It's automatically
generated by Hibernate with the UUID pattern. -->
<id name="id" type="string" unsaved-value="null" >
<column name="CAT_ID" sql-type="char(32)" not-null="true"/>
<generator class="uuid.hex"/>
</id>

<!-- A cat has to have a name, but it shouldn' be too long. -->
<property name="name">
<column name="NAME" sql-type="varchar(16)" not-null="true"/>
</property>

<property name="sex"/>

<property name="weight"/>

</class>

</hibernate-mapping>

-------------

Any changes to be made?

regards,
Amitabh.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 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.