I just created a struts project (in eclipse), created a bean "User" and two mapping files namely hibernate.cfg.xml and user.hbm.xml. I get
hibernate.cfg.xml not found error
on hitting the action where i have session/transaction statements. Any idea where should i dump it so that it is accessible, i tried moving it from web-inf to web-inf/lib. both dont seem to work.
Originally posted by Paul Sturrock: hibernate.cgf.xml needs to be at the root of your application's classpath if you are using the default configuration mechanism.
It still did not work for me. Do I have a choice like property/config file where i can override the default configurations? what does it take to convert a simple web/java project into hibernate, other than having hibernate-jar to be in lib/classpath of the application. Currently my web.xml has no entries on on hbm/xml files.
Thanks Paul. I left eclipse and came down to Textpad and ant. You were right, I simply had to dump the two xmls into classpath. That problem is solved, and it was not just hibernate-3.2.6.ga.jar there were other jars apart from apache-commons that i had to bring in, like cglib and asm I dont know what they do, but I feel I can still go ahead keeping the abstractions as is. My Hello world is still few steps away, (some jndi configurations to be looked into) but i think it will go smooth here after. Thank you very much again.
Originally posted by Timothy Sam: I only had to put hibernate.cfg.xml directly under my "src" folder in eclipse.
This is because by default in eclipse everything that is in your build path is also on your runtime classpath. This is not the case with JEE applications.
Yes Timothy it works that way as well. I tried to save an object from session to the db and it has successfully inserted it, will explore more of it. Thanks.
Originally posted by Dan La: Try putting hibernate.cfg.xml under WEB-INF/classes/
[ December 09, 2008: Message edited by: Dan La ]
The ant script does the same anyways.
Eclipse doesn't show me 'classes' folder(may be i will have to configure some perspectives or so). But i do hope it would be fine if I manually dump them on the app deployed on the server.
Post by:autobot
WARNING! Do not activate jet boots indoors or you will see a tiny ad:
a bit of art, as a gift, that will fit in a stocking