我有 src 文件夹,里面有很多包,其中之一是 hibernate.util。
早些时候我将 hibernate.cfg.xml 放在 src 文件夹中并给出了它的绝对路径,现在因为我必须部署这个应用程序,所以绝对路径给我带来了问题。
我尝试添加一个新的资源文件夹作为源文件夹,将其包含在源文件夹中,将其添加到类路径中,但每次找不到它的文件
我正在使用 Eclipse IDE
SEVERE: Allocate exception for servlet sandbox
java.io.FileNotFoundException: .\resources\hibernate.cfg.xml (The system cannot find the path specified)
at java.io.FileInputStream.open(Native Method)
at java.io.FileInputStream.<init>(Unknown Source)
at org.hibernate.cfg.Configuration.configure(Configuration.java:2216)
at dal.utils.HibernateUtils.buildSessionFactory(HibernateUtils.java:25)
at dal.utils.HibernateUtils.<clinit>(HibernateUtils.java:19)
at dal.service.CalcDataMapper.load(CalcDataMapper.java:17)
at com.renturduniya.www.sandbox.init(sandbox.java:41)
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1206)
at org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:827)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:129)
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:293)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:859)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:602)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
at java.lang.Thread.run(Unknown Source)