I'm trying to follow the first Hibernate tutorial and have been hitting some basic problems.
I build a JAR file "htest.jar". When I run, I get:
Initial SessionFactory creation failed.org.hibernate.MappingException: Resource: Event.hbm.xml not found
Obviously, the Hibernate framework can't locate my mapping file. A slightly simplified version of my directory structure is like this:
Code:
c:\workspace\htest
build.xml
hibernate.cfg.xml
log4j.xml
htest.jar
src\com\kurt\htest
Event.hbm.xml
Event.java
bin\com\kurt\htest
Event.hbm.xml
Event.class
lib
<external jar files such as hibernate, log4j, etc...>
The jar file "htest.jar" is built with the "bin" base directory.
The class path embedded within the manifest file of the jar file contains:
Code:
. bin/com/kurt/htest com/kurt/htest lib/antlr-2.7.5H3.jar <trimmed other jar references>
The second and third path references are redundant but that's OK.
In hibernate.cfg.xml, I have:
Code:
<mapping resource="Event.hbm.xml"/>
Also tried:
Code:
<mapping resource="com\kurt\htest\Event.hbm.xml"/>
I can get this working without using a jar file and using a custom CLASSPATH but I would like to get this working with a full jar file.
This is driving me nuts. It seems like a fairly simple setup issue. I've done plenty of Internet searches and have read many related forum threads and no luck. Any help is greatly appreciated.
Thanks in advance