我正在运行一个带有休眠状态的 Web 应用程序,但遇到了这个异常。请问有什么帮助吗?
java.lang.ClassNotFoundException: org.hibernate.HibernateException at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1714) at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1559) at com.forum.dao.TopicDAO.findAll(TopicDAO.java:43) 在 com.forum.servlets.Accueil.doGet(Accueil.java:23) 在 javax.servlet.http.HttpServlet.service(HttpServlet.java:621)在 javax.servlet.http.HttpServlet.service(HttpServlet.java:728) 在 org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305) 在 org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain .java:210) 在 org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222) 在 org.apache.catalina。core.StandardContextValve.invoke(StandardContextValve.java:123) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)在 org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99) 在 org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:953) 在 org.apache.catalina.core.StandardEngineValve.invoke (StandardEngineValve.java:118) 在 org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408) 在 org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1008) 在 org.apache。 coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:589) 在 org.apache.tomcat.util.net。JioEndpoint$SocketProcessor.run(JIoEndpoint.java:312) at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at java.lang.Thread.run (来源不明)
这是TopicDAO.findALL()
public static List<Topic> findAll() {
Session s = HibernateUtils.getSession(); //TopicDAO.java:43
Transaction tx = s.beginTransaction();
List<Topic> objects = null;
Query q = s.createQuery("from Topic");
objects = q.list();
tx.commit();
return objects;
}
而且,这是我的servlet.doGet()
public void doGet( HttpServletRequest request, HttpServletResponse response ) throws ServletException, IOException {
HttpSession session = request.getSession();
TopicDAO td = new TopicDAO();
List<Topic> listTopics = td.findAll();
session.setAttribute( ATT_LIST_TOPICS, listTopics );
this.getServletContext().getRequestDispatcher( ACCUEIL ).forward( request, response );
}
这是我添加的 Hibernate 库: