i have src folder and inside it there are many packages, one of which is hibernate.util.
earlier i had placed hibernate.cfg.xml in src folder and gave its absolute path and now since i have to deploy this app , the absolute path is giving me problems.
i tried adding a new resource folder as source folder, included it in source folder , added it to classpath but everytime its gives file not found
i am using 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)
You should not pass it a File. A File represents a path on the file system. Your config file should be bundled in the jar/war along with the classes of your app, and be loaded using the class loader.
You should use the method taking a URL as argument instead, and pass it the URL returned by