[hibernate-users] Unable to configure EntityManagerFactory with cause: invalid constant type: 60

Kaleb Pederson kaleb.pederson at gmail.com
Mon Jun 14 14:56:50 EDT 2010


I'm creating a cli tool to manage an existing application. Both the
application and the tests build fine and run fine but despite that I
receive a javassist failure when running my cli tool.  I can run the
application successfully within Eclipse (Right click->Run As->Java
Application), but using the maven-generated jar-with-dependencies
fails. I presume the difference is that with Eclipse javassist isn't
inspecting the containing jar, rather, it's inspecting all of the
class files (and perhaps a few dependent 3rd-party jars).  I've tried
with both hibernate 3.4 and 3.5.1-Final (since 3.5.2-Final isn't yet
in the maven repository) and get the exact same error.

Here's the stack trace:

INFO: Bytecode provider name : javassist
...
INFO: Hibernate EntityManager 3.5.1-Final
Exception in thread "main" javax.persistence.PersistenceException:
Unable to configure EntityManagerFactory
       at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:371)
       at org.hibernate.ejb.HibernatePersistence.createEntityManagerFactory(HibernatePersistence.java:55)
       at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:48)
       at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:32)
       ...
       at com.sophware.flexipol.admin.AdminTool.<init>(AdminTool.java:40)
       at com.sophware.flexipol.admin.AdminTool.main(AdminTool.java:69)
Caused by: java.lang.RuntimeException: Error while reading
file:flexipol-jar-with-dependencies.jar
       at org.hibernate.ejb.packaging.NativeScanner.getClassesInJar(NativeScanner.java:131)
       at org.hibernate.ejb.Ejb3Configuration.addScannedEntries(Ejb3Configuration.java:467)
       at org.hibernate.ejb.Ejb3Configuration.addMetadataFromScan(Ejb3Configuration.java:457)
       at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:347)
       ... 11 more
Caused by: java.io.IOException: invalid constant type: 60
       at javassist.bytecode.ConstPool.readOne(ConstPool.java:1027)
       at javassist.bytecode.ConstPool.read(ConstPool.java:970)
       at javassist.bytecode.ConstPool.<init>(ConstPool.java:127)
       at javassist.bytecode.ClassFile.read(ClassFile.java:693)
       at javassist.bytecode.ClassFile.<init>(ClassFile.java:85)
       at org.hibernate.ejb.packaging.AbstractJarVisitor.checkAnnotationMatching(AbstractJarVisitor.java:243)
       at org.hibernate.ejb.packaging.AbstractJarVisitor.executeJavaElementFilter(AbstractJarVisitor.java:209)
       at org.hibernate.ejb.packaging.AbstractJarVisitor.addElement(AbstractJarVisitor.java:170)
       at org.hibernate.ejb.packaging.FileZippedJarVisitor.doProcessElements(FileZippedJarVisitor.java:119)
       at org.hibernate.ejb.packaging.AbstractJarVisitor.getMatchingEntries(AbstractJarVisitor.java:146)
       at org.hibernate.ejb.packaging.NativeScanner.getClassesInJar(NativeScanner.java:128)
       ... 14 more

Since I know the jar is fine as the unit and integration tests run
against it, I thought it might be a problem with javassist, so I tried
cglib. The bytecode provider then shows as cglib but I still get the
exact same stack trace with javassist present in it.

cglib is definitely in the classpath:

$ unzip -l flexipol-jar-with-dependencies.jar | grep cglib | wc -l
383

Is this a problem with javassist or something related to my hibernate
configuration? Any ideas how I can track it down?

Thank you for the help.

--
Kaleb Pederson

Blog - http://kalebpederson.com
Twitter - http://twitter.com/kalebpederson


More information about the hibernate-users mailing list