wood burning stoves 2.0*
The moose likes Object Relational Mapping and the fly likes Debug Error with JPA/Hibernate Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "Debug Error with JPA/Hibernate" Watch "Debug Error with JPA/Hibernate" New topic
Author

Debug Error with JPA/Hibernate

Martin Krueger
Greenhorn

Joined: May 30, 2007
Posts: 7
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)


kind regards<br /> <br />Martin
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17258
    
    6

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


Perfect World Programming, LLC - Two Laptop Bag - Tube Organizer
How to Ask Questions the Smart Way FAQ
Martin Krueger
Greenhorn

Joined: May 30, 2007
Posts: 7
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

Joined: Feb 05, 2001
Posts: 17258
    
    6

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
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
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

Joined: Feb 05, 2001
Posts: 17258
    
    6

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
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
 
wood burning stoves
 
subject: Debug Error with JPA/Hibernate