• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Debug Error with JPA/Hibernate

 
Martin Krueger
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello

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)
 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?

Mark
 
Martin Krueger
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Mark

Thank's for the quick answer. This is what i have in the Library

hibernate-3.2/hibernate3.jar
hibernate-3.2/lib/ant-1.6.5.jar
hibernate-3.2/lib/antlr-2.7.6.jar
hibernate-3.2/lib/asm-attrs.jar
hibernate-3.2/lib/asm.jar
hibernate-3.2/lib/cglib-2.1.3.jar
hibernate-3.2/lib/dom4j-1.6.1.jar
hibernate-3.2/lib/ehcache-1.2.3.jar
hibernate-3.2/lib/jdbc2_0-stdext.jar
hibernate-annotations-3.3.0.GA/hibernate-annotations.jar
hibernate-annotations-3.3.0.GA/lib/ejb3-persistence.jar
hibernate-annotations-3.3.0.GA/lib/hibernate-commons-annotations.jar
hibernate-entitymanager-3.3.1.GA/hibernate-entitymanager.jar
hibernate-entitymanager-3.3.1.GA/lib/hibernate-validator.jar
hibernate-entitymanager-3.3.1.GA/lib/jboss-archive-browsing.jar
commons-logging-1.0.4.jar
log4j-1.2.14.jar
mysql-connector-java-5.1.0-bin.jar
JDK 1.6

kind regards
Martin
 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 342
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think hibernate use this in order to build the proxies.

You should add this jar to your classpath
 
Martin Krueger
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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

kind regards
Martin
 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic