I´ve just started playing around with Java and Hibernate and have gotten an application working. Everything works "perfectly" when I run it from eclipse but when I use Eclipse builtin function for packaging the project with dependencies into a jar files I get:
org.hibernate.InvalidMappingException: Unable to read XML
at org.hibernate.util.xml.MappingReader.readMappingDocument(MappingReader.java:101)
at org.hibernate.cfg.Configuration.add(Configuration.java:510)
at org.hibernate.cfg.Configuration.add(Configuration.java:506)
at org.hibernate.cfg.Configuration.add(Configuration.java:686)
at org.hibernate.cfg.Configuration.addResource(Configuration.java:771)
at org.hibernate.cfg.Configuration.parseMappingElement(Configuration.java:2314)
at org.hibernate.cfg.Configuration.parseSessionFactory(Configuration.java:2280)
at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:2260)
at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:2213)
at org.hibernate.cfg.Configuration.configure(Configuration.java:2128)
at org.hibernate.cfg.Configuration.configure(Configuration.java:2107)
at myPackage.MyClass.setUp(MyClass.java:89)
The hibernate.cfg.xml and mapping.hbm.xml are both located directly in the src folder. Tthe "link" between them is:
<mapping resource="mapping.hbm.xml" />
In the resulting jar-file they both end up in the root.