hi,
I am trying to use hibernate 3 from tomcat but I am running into problem reading my mapping files. I deployed my application as a war into tomcat. I want to use entitymanager so I use the following code:
Code:
private void setEntityManager(final Properties connect) throws Exception
{
Properties properties = connect;
Ejb3Configuration cfg = new Ejb3Configuration();
cfg.addProperties(properties);
//this is where the exception is thrown
cfg.addFile(new File("User.hbm.xml"));
}
When attempt to add hbm files into my configration, the server is not able to find them. I added a print statement to see where tomcat is looking for the files:
Code:
File f = new File("User.hbm.xml");
System.out.println("1- path = " + f.getAbsolutePath());
// I get
1- path = C:\Program Files\Tomcat 5.5\bin\User.hbm.xml
which is a path relative to the tomcat install. My app is deployed at C:\Program Files\Tomcat 5.5\webapps\myapp
I tried to change the format I am passing to the Ejb3Configuration but it always try to look in the bin directory of tomcat. Short of using absloute path, I can not think of anything else. Any suggestions?
Khalid