Hey guys,
I'm having trouble reading the hibernate.cfg.xml. Actually, I'm having trouble locating it.
I'm using JBuilder2006 and Hibernate Version 3.0.
Here are the lines of code containing the pathfinding of my cfg.xml:
Code:
configFileURL = HibernatePlugIn.class.getResource(_configFilePath);
tempString = ""+configFileURL;
System.out.println(" tempString: "+tempString);
tempString = tempString.substring(6);
System.out.println(" tempString: "+tempString);
context = _servlet.getServletContext();
if (_log.isDebugEnabled()) {
_log.debug("Initializing Hibernate from "
+ _configFilePath + "...");
}
configuration = (new Configuration()).configure(tempString);
_factory = configuration.buildSessionFactory();
Using getResource, I'm loading the path of the config file, which is correctly found:
Quote:
configFilePath: /hibernate.cfg.xml
tempString: file:/D:/JBuilder2006/Projects/MCM/WebModule1/WEB-INF/classes/hibernate.cfg.xml
tempString: D:/JBuilder2006/Projects/MCM/WebModule1/WEB-INF/classes/hibernate.cfg.xml
Alright, the file is located in that folder. I've also put it into the folders
MCM/WebModule1/WEB-INF
MCM/WebModule/
MCM/
but he always tells me the same error, which is:
Quote:
08:31:37,317 INFO Configuration:1286 - configuring from resource: D:/JBuilder2006/Projects/MCM/WebModule1/WEB-INF/classes/hibernate.cfg.xml
08:31:37,317 INFO Configuration:1263 - Configuration resource: D:/JBuilder2006/Projects/MCM/WebModule1/WEB-INF/classes/hibernate.cfg.xml
08:31:37,347 ERROR HibernatePlugIn:132 - Exception while initializing Hibernate.
08:31:37,387 ERROR HibernatePlugIn:133 - Rethrowing exception...
org.hibernate.HibernateException: D:/JBuilder2006/Projects/MCM/WebModule1/WEB-INF/classes/hibernate.cfg.xml not found
So what's up with that? In which folder DO I have to put it now? Or is the problem somewhere else and I didn't find it?
Thanks for your help, it is really needed...