dilembo wrote:
I try to configure my sessionFactory using hibernate.cfg.xml and
File file = new File(absolutePath+"hibernate.cfg.xml");
session = new Configuration().configure(file).buildSessionFactory().openSession();
But it always throws me an net.sf.hibernate.cfg.Configuration exception and it said it cannot find absolutePath+"hibernate.cfg.xml").
I'm using Tomcat for this webapps.Is tomcat able to load absolute path during webapps runtime?
Any help colud be appreciated
Regards
I had the problem the other way around:
configure( ) w/o args would not work with Tomcat even though I placed hibernate.cfg.xml in WEB-INF/classes as per the documentation.
Tomcat complained of being unable to find it. Same went for log4j.properties.
I did manage to pass in an absolute path though as a workaround.
It was a frustrating 24+ hours to track it down and how I managed to get configure( ) to work without arguments [no pun intended] is when the idea
of trying a different machine altogether led me to packaging the app as a WAR and installing it under <CATALINA_HOME>/webapps/<app_folder>
instead of G:\\myWebApp.
I don't know if it's a bug or if a custom-made Context requires further attributes that I'm unaware of for resources in its WEB-INF/classes to be
seen by Tomcat. I've had enough of configuration and setup details right now.
So, if you're using Tomcat's webapps folder, try configure( ) , otherwise I'm afraid I need to borrow the least bad line from Constantine:
Gabriel's "You're fucked!"
Rico.