日期:2014-05-20  浏览次数:20804 次

hiberante提示找不到类
我在jsp中使用hiberante,但是报一下错误:
2011-9-17 18:47:43 org.apache.catalina.core.StandardWrapperValve invoke
严重: Servlet.service() for servlet addServlet threw exception
java.lang.ClassNotFoundException: org.hibernate.Session
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1680)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1526)
at com.lxlsoft.ca.servlet.Useradd.doPost(Useradd.java:50)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
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:127)
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:298)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:859)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
at java.lang.Thread.run(Unknown Source)
我以为是hibernate3.jar没有导入项目的原因,查了一下是导入了的,而且我在项目里写了个类,在main方法里测试就是正常的把数据保存到数据库,只有在jsp中才会出现这个问题。请问是怎么回事?

------解决方案--------------------
是WEB项目部署的问题,运行JSP的时候应该是你的web-inf/lib下面没有hibernate的相关jar包所以在单机调试可以但是在web运行找不到
楼主把你工程相关的jar包都放到web-inf/lib这个目录下,然后启动tomcat,看看浏览对应页面的时候是不是正常了?