This week's book giveaway is in the Agile and other Processes forum. We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line! See this thread for details.
I'm an absolute beginner. Ive tried to write a very simple example using JPA and hibernate. But i get all the time the following error. can someone please help me?
kind regards Martin
04.09.2007 18:50:45 org.hibernate.cfg.annotations.Version <clinit> INFO: Hibernate Annotations 3.3.0.GA 04.09.2007 18:50:45 org.hibernate.cfg.Environment <clinit> INFO: Hibernate 3.2.4.sp1 04.09.2007 18:50:45 org.hibernate.cfg.Environment <clinit> INFO: hibernate.properties not found 04.09.2007 18:50:45 org.hibernate.cfg.Environment buildBytecodeProvider INFO: Bytecode provider name : cglib 04.09.2007 18:50:45 org.hibernate.cfg.Environment <clinit> INFO: using JDK 1.4 java.sql.Timestamp handling 04.09.2007 18:50:45 org.hibernate.ejb.Version <clinit> INFO: Hibernate EntityManager 3.3.1.GA Exception in thread "main" java.lang.NoClassDefFoundError: javassist/bytecode/ClassFile at org.hibernate.ejb.packaging.JarVisitor.checkAnnotationMatching(JarVisitor.java:332) at org.hibernate.ejb.packaging.JarVisitor.executeJavaElementFilter(JarVisitor.java:298) at org.hibernate.ejb.packaging.JarVisitor.addElement(JarVisitor.java:259) at org.hibernate.ejb.packaging.ExplodedJarVisitor.getClassNamesInTree(ExplodedJarVisitor.java:54) at org.hibernate.ejb.packaging.ExplodedJarVisitor.getClassNamesInTree(ExplodedJarVisitor.java:62) at org.hibernate.ejb.packaging.ExplodedJarVisitor.getClassNamesInTree(ExplodedJarVisitor.java:62) at org.hibernate.ejb.packaging.ExplodedJarVisitor.getClassNamesInTree(ExplodedJarVisitor.java:62) at org.hibernate.ejb.packaging.ExplodedJarVisitor.doProcessElements(ExplodedJarVisitor.java:45) at org.hibernate.ejb.packaging.JarVisitor.getMatchingEntries(JarVisitor.java:241) at org.hibernate.ejb.Ejb3Configuration.addMetadataFromVisitor(Ejb3Configuration.java:271) at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:240) at org.hibernate.ejb.HibernatePersistence.createEntityManagerFactory(HibernatePersistence.java:120) at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:51) at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:33)
That class comes in the javaassist jar file, now why your application would need it is interesting. This is a bytecode manipulator api. Kind of like what JDO would do. I don't think you are trying to instrument any code.
Anyway, which jar files are you packaging with your application?
Hmm, I am a little confused by what you mean by in your library? And you list jars within sub-directories. Unless you have your classpath pointing to each and every one of those subdirectories, then those jars won't be in your classpath.
What are the jars that are in your classpath?
Thanks
Mark
avihai marchiano
Ranch Hand
Joined: Jan 10, 2007
Posts: 342
posted
0
I think hibernate use this in order to build the proxies.
You should add this jar to your classpath
Martin Krueger
Greenhorn
Joined: May 30, 2007
Posts: 7
posted
0
hello
I'm using Netbean and as i understud right. The Lib's I'm adding to the Library Manager and then adding to the Project Properties (library) are automatically in my classpath. This is what i have done.
In the meantime i have rewritten my testprogram and it tells me the following:
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactory at org.hibernate.ejb.Ejb3Configuration.<clinit>(Ejb3Configuration.java:103) at org.hibernate.ejb.HibernatePersistence.createEntityManagerFactory(HibernatePersistence.java:119) at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:51) at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:33) at ch.lexms.lexms.main(lexms.java:31) ERROR: JDWP Unable to get JNI 1.2 environment, jvm->GetEnv() return code = -2 JDWP exit error AGENT_ERROR_NO_JNI_ENV(183): [../../../src/share/back/util.c:820] Java Result: 1
NoClassDefFoundErrors are all based on not having that particular class in your classpath. So I am not sure how Netbeans works but it doesn't seem to have added that to your classpath. It is in the apache commons jar.
Mark
Martin Krueger
Greenhorn
Joined: May 30, 2007
Posts: 7
posted
0
Hello
finally i made it. The solution was to read the _README.txt in the Hibernate distribution. I missed some libs. Now everything works fine.
Once again thank's for your help.
kind regards Martin
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to
run our stuff on 16 servers instead of 3.