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.
|