重定位JAVA库到Tomcat Lib文件夹后的问题

时间:2011-02-28 03:12:54

标签: java hibernate tomcat

我的项目有问题。我将所有库上传到Tomcat Lib文件夹,并发生错误。

org.hibernate.HibernateException:无法解析配置:/hibernate.cfg.xml     在org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1494)     at org.hibernate.cfg.AnnotationConfiguration.doConfigure(AnnotationConfiguration.java:990)     at org.hibernate.cfg.AnnotationConfiguration.doConfigure(AnnotationConfiguration.java:69)     在org.hibernate.cfg.Configuration.configure(Configuration.java:1428)     在org.hibernate.cfg.AnnotationConfiguration.configure(AnnotationConfiguration.java:972)     在org.hibernate.cfg.AnnotationConfiguration.configure(AnnotationConfiguration.java:69)     在org.hibernate.cfg.Configuration.configure(Configuration.java:1414)     在org.hibernate.cfg.AnnotationConfiguration.configure(AnnotationConfiguration.java:966)     在com.billing.util.HibernateUtil.getInitializedConfiguration(HibernateUtil.java:126)     在com.billing.util.HibernateUtil.getSession(HibernateUtil.java:132)     在com.billing.util.HibernateUtil.beginTransaction(HibernateUtil.java:153)     在dscv2.login.userCtrl.UserLogin.processRequest(UserLogin.java:62)     在dscv2.login.loginCtrlServlet.processRequest(loginCtrlServlet.java:48)     在dscv2.login.loginCtrlServlet.doPost(loginCtrlServlet.java:121)     在javax.servlet.http.HttpServlet.service(HttpServlet.java:637)     在javax.servlet.http.HttpServlet.service(HttpServlet.java:717)     在org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)     在org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)     在org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)     at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)     在org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)     at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)     在org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)     在org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)     在org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:857)     在org.apache.coyote.http11.Http11Protocol $ Http11ConnectionHandler.process(Http11Protocol.java:588)     在org.apache.tomcat.util.net.JIoEndpoint $ Worker.run(JIoEndpoint.java:489)     在java.lang.Thread.run(Thread.java:636) 引起:org.dom4j.DocumentException:org.dom4j.DocumentFactory无法强制转换为org.dom4j.DocumentFactory嵌套异常:org.dom4j.DocumentFactory无法强制转换为org.dom4j.DocumentFactory     在org.dom4j.io.SAXReader.read(SAXReader.java:484)     在org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1484)     ......还有27个

1 个答案:

答案 0 :(得分:4)

你不应该把东西放在Tomcat / lib目录中,除了下面的Mike Baranczak所说的JDBC驱动程序JAR。 (甚至对Tomcat 6.x及更高版本来说也是如此。过去那些也会出现在你的WEB-INF / lib中。)

了解如何创建适当的WAR并将其部署到/ webapps目录。