03. december 2007 - 21:52Der er
10 kommentarer og 1 løsning
How to initiate my Hibernate Config form a Jar?
Hello!
I have a small app in a packed in a Jar. (I pack it from Eclipse) (Run from eclipse everything works perfect)
But when I run it from the jar file like "java -jar hibernatetest.jar" I get a: java.lang.NoClassDefFoundError: org/hibernate/cfg/Configuration java.lang.ExceptionInInitializerError
In my manifest.mf I have added a classpath: Manifest-Version: 1.0 Main-Class: javaapplication.NameJavaApplication Class-Path: lib/ant-antlr-1.6.5.jar;lib/antlr-2.7.5H3.jar;lib/asm-attrs.jar;lib/asm.jar;lib/cglib-2.1.2.jar;lib/commons-collections-2.1.1.jar;lib/commons-logging-1.0.4.jar;lib/dom4j-1.6.1.jar;lib/ehcache-1.1.jar;lib/hibernate3.jar;lib/jta.jar;lib/log4j-1.2.11.jar;lib/mysql-connector-java-3.0.15-ga-bin.jar
The structure of jar looks like javaapplication META-INF lib hibernate.cfg.xml
Now I can move the hibernatetest.jar to any other location and run it with: java -jar hibernatetest4.jar
I would love to be proven wrong, beacuse I do not think it looks great. I would feel much better if I could establish the same from Eclipse but with jars in jars.
BTW I do feel that you should have the poinst Arne!
Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.