"org.hibernate.Session" ClassNotFoundException

Despite I added all necessary .jar files to project, I always take boring exception warnings that say "class not found". I added the code and exception output below. I'll be so happy if someone can help me.

*Exception:*
java.lang.ClassNotFoundException: org.hibernate.Session
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1387)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1233)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
* at servlets.tabloDoldur.doGet(tabloDoldur.java:34)*
at javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:849)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:454)
at java.lang.Thread.run(Thread.java:619)

The problem here is that instead of having the commons jar file in the WEB-INF/lib folder, you have a commons-lang folder. This doesn't work for the simple reason that it's the jar files in the WEB-INF/lib folder which are on the classpath and not the jar files which are present … Read More

Is it in the lib folder of WEB-INF? It'd be difficult to suggest anything without looking at the actual project structure. Have you tested this out with a standalone application? Are you using an IDE to develop and run this web app?

I'm using Eclipse Galileo on Ubuntu 9.10. I added all my external jars into my server's (which is Apache Tomcat 6.0) "lib" folder. Now this exception has gone but unfortunately now it gives another exception : "java.lang.ClassNotFoundException: org.apache.commons.lang.exception.NestableRuntimeException" I googled this exception and added commons-lang-2.5 jar, still the same..

You should never add any application specific jar to your server's lib folder; add them to the `lib` folder of your WEB-INF folder. And the ClassNotFoundException is a clear indication that specified class is not on your runtime classpath. Also, post the entire stack-trace for reference.

You should never add any application specific jar to your server's lib folder; add them to the `lib` folder of your WEB-INF folder. And the ClassNotFoundException is a clear indication that specified class is not on your runtime classpath. Also, post the entire stack-trace for reference.

OK, I did exactly what you said. Now all my external jar files are under my project's WEB-INF folder. But the exception is still active. I attached my build path in Eclipse.

OK, let's tackle this in a different way. Right click on your project -> Export -> Web -> War File and export your project as a WAR file. Browse this WAR file (just like any other archive) and see if you can see your jar files in the WEB-INF/lib directory. If you can't, then there is something wrong with the way you have configured your project.

OK, let's tackle this in a different way. Right click on your project -> Export -> Web -> War File and export your project as a WAR file. Browse this WAR file (just like any other archive) and see if you can see your jar files in the WEB-INF/lib directory. If you can't, then there is something wrong with the way you have configured your project.

OK, I did exactly what you said. And I saw my jar files and also the exception's jar file. (org.apache.commons.lang.exception.NestableRuntimeException) I attached their screen captures too..

The problem here is that instead of having the commons jar file in the WEB-INF/lib folder, you have a commons-lang folder. This doesn't work for the simple reason that it's the jar files in the WEB-INF/lib folder which are on the classpath and not the jar files which are present in any of the sub-directories of the WEB-INF/lib folder. Move just the commons-lang-2.5.jar file directly under the lib folder and it should work out to be fine.