- This topic has 6 replies, 3 voices, and was last updated 18 years, 11 months ago by Riyad Kalla.
-
AuthorPosts
-
ceronjMemberWhen I try running the servlet below, I get the error below. The application complies correctly. When I run it outside of the servlet, in a dummy class with a main(), Hibernate works just fine. I used the MyEclipse Hibernate support so I assumed it added all the jar files correctly. I see the hibernate3.jar in the hibernate core in the classpath, so I don’t know what’s the problem. I even copied the jar into the WEB-INF/lib folder but that doesn’t work either.
Please advise….
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
javax.servlet.ServletException: Error instantiating servlet class com.jsfdemo.ControllerServlet
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:118)
org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:160)
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:799)
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:705)
org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:577)
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
java.lang.Thread.run(Thread.java:595)root cause
java.lang.NoClassDefFoundError: org/hibernate/Session
java.lang.Class.getDeclaredConstructors0(Native Method)
java.lang.Class.privateGetDeclaredConstructors(Class.java:2328)
java.lang.Class.getConstructor0(Class.java:2640)
java.lang.Class.newInstance0(Class.java:321)
java.lang.Class.newInstance(Class.java:303)
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:118)
org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:160)
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:799)
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:705)
org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:577)
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
java.lang.Thread.run(Thread.java:595)đĄ
ceronjMemberHello, anyone home? I really need a answer for this.
Haris PecoMemberceronj ,
Class org/hibernate/Session is from hibernate3.jar.Do you add hibernate libraries in your projects ?
Riyad KallaMemberceronj,
In addition to what snpe suggested, please double check that your application server doesn’t already have hibernate JARs in it’s /lib directory that it might be picking up instead of yours.
ceronjMemberSomethingâs not right here. I used the “add Hibernate capabilities” in MyEcllipse. When I did so, it added the Hibernate core and Hibernate advanced lib. This worked if I used Hibernate in a dummy class using main(), but not in a web environmentâservlet. I added the hibernate3.jar to the WEB-INF/lib directory, but when I tried adding to the project, âproperties->java build path->add jarsâ it would not show up. If I tinkered with the .classpath file, Iâd get a build path error.
I created a new project and did the following when using the add Hibernate capabilities:
Selected both Hibernate 3.0 Core, and Hibernate 3.0 Advance
Then selected: if check “copy checked lib jars to project folder and add to build-path,â copies to WEB-INF/lib
(On the other project, I selected âif check “add checked lib to project build-path”
Why didnât this work in the first place? Why donât the jars show up in Eclipse when I copied them into the WEB-INF/lib? How do I add them to my old project that still wonât work.
Haris PecoMemberceronj ,
Please, use first case or try add libraries in project-Properties,MyEclipse-Web-deployment
It doesn’t work for your second case, because you don’t add libraries in deployment
best
Riyad KallaMemberWhy didnât this work in the first place? Why donât the jars show up in Eclipse when I copied them into the WEB-INF/lib? How do I add them to my old project that still wonât work.
You want to go to your Java Build Path > Libraries > Add Library.
Also snpe is right, you need to navigate to your MyEclipse-Web > Deployment settings for your workbench or project and tell the deployment tool to deploy libraries on your build path, otherwise it ignores them and they stay put.
-
AuthorPosts