I have an app using Hibernate/JPA, that isn't quite working right.
When I build the executable .jar (From Eclipse), and have it extract all the required classes into the generated .jar - Hibernate works, but other things fail.
If I have it package all the required .jar files into the generated .jar - hibernate fails to initialize properly.
This is with Hibernate 4.0.0.
I turned on TRACE level logging, and have found the following:
During initialization, it seems to pick up the database:
Code:
935 [ main] DEBUG ibernate.ejb.Ejb3Configuration - Look up for persistence unit: EMailDB
937 [ main] TRACE ibernate.ejb.Ejb3Configuration - Analyzing persistence.xml: rsrc:META-INF/persistence.xml
1045 [ main] TRACE packaging.PersistenceXmlLoader - Validate with persistence_2_0.xsd schema on file rsrc:META-INF/persistence.xml
1058 [ main] TRACE packaging.PersistenceXmlLoader - Persistent Unit name from persistence.xml: EMailDB
1063 [ main] TRACE ibernate.ejb.Ejb3Configuration - PersistenceMetadata(version=2.0) [
name: EMailDB
jtaDataSource: null
nonJtaDataSource: null
transactionType: RESOURCE_LOCAL
provider: org.hibernate.ejb.HibernatePersistence
useQuotedIdentifiers: false
classes[
com.casadelgato.email.repository.jpa.JPAMessage com.casadelgato.email.repository.jpa.JPAMessageBodies com.casadelgato.email.re
pository.jpa.JPAFolder com.casadelgato.email.repository.jpa.JPAAccount com.casadelgato.email.repository.jpa.JPAMsgEntry com.casa
delgato.email.repository.jpa.EntryID com.casadelgato.email.repository.jpa.JPAMessageFilter com.casadelgato.email.repository.jpa.JPAFilterGr
oup com.casadelgato.email.repository.jpa.JPAEmailProperty com.casadelgato.email.repository.jpa.JPAContact com.casadelgato.email.re
pository.jpa.JPATag ]
packages[
]
mappingFiles[
]
jarFiles[
]
hbmfiles: 0
properties[
hibernate.connection.username: sa
hibernate.archive.autodetecion: class, hbm
hibernate.dialect: org.hibernate.dialect.HSQLDialect
hibernate.connection.url: jdbc:hsqldb:file://C:/Users/Cougar/Email\database
hibernate.show_sql: false
hibernate.connection.driver_class: org.hsqldb.jdbc.JDBCDriver
hibernate.format_sql: true
]]
1113 [ main] DEBUG l.repository.jpa.JPARepository - Database Not Initialized Yet
1114 [ main] DEBUG l.repository.jpa.JPARepository - initDatabase
1117 [ main] DEBUG l.repository.jpa.JPARepository - Connection: jdbc:hsqldb:file://C:/Users/Cougar/Email\database
1119 [ main] DEBUG bernate.type.BasicTypeRegistry - Adding type registration boolean -> org.hibernate.type.BooleanType@42a9c09e
.. a whole bunch of type registrations happen here ...
Then, a short time later (still starting up), this happens:
Code:
1354 [ main] DEBUG ibernate.ejb.Ejb3Configuration - Look up for persistence unit: EMailDB
1356 [ main] TRACE ibernate.ejb.Ejb3Configuration - Analyzing persistence.xml: rsrc:META-INF/persistence.xml
1385 [ main] TRACE packaging.PersistenceXmlLoader - Validate with persistence_2_0.xsd schema on file rsrc:META-INF/persistence.xml
1389 [ main] TRACE packaging.PersistenceXmlLoader - Persistent Unit name from persistence.xml: EMailDB
1391 [ main] TRACE ibernate.ejb.Ejb3Configuration - PersistenceMetadata(version=2.0) [
name: EMailDB
jtaDataSource: null
nonJtaDataSource: null
transactionType: RESOURCE_LOCAL
provider: org.hibernate.ejb.HibernatePersistence
useQuotedIdentifiers: false
classes[
com.casadelgato.email.repository.jpa.JPAMessage com.casadelgato.email.repository.jpa.JPAMessageBodies com.casadelgato.email.re
pository.jpa.JPAFolder com.casadelgato.email.repository.jpa.JPAAccount com.casadelgato.email.repository.jpa.JPAMsgEntry com.casa
delgato.email.repository.jpa.EntryID com.casadelgato.email.repository.jpa.JPAMessageFilter com.casadelgato.email.repository.jpa.JPAFilterGr
oup com.casadelgato.email.repository.jpa.JPAEmailProperty com.casadelgato.email.repository.jpa.JPAContact com.casadelgato.email.re
pository.jpa.JPATag ]
packages[
]
mappingFiles[
]
jarFiles[
]
hbmfiles: 0
properties[
hibernate.connection.username: sa
hibernate.archive.autodetecion: class, hbm
hibernate.dialect: org.hibernate.dialect.HSQLDialect
hibernate.connection.url: jdbc:hsqldb:file://C:/Users/Cougar/Email\database
hibernate.show_sql: false
hibernate.connection.driver_class: org.hsqldb.jdbc.JDBCDriver
hibernate.format_sql: true
]]
javax.persistence.PersistenceException: Unable to configure EntityManagerFactory
at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:385)
at org.hibernate.ejb.HibernatePersistence.createEntityManagerFactory(HibernatePersistence.java:55)
at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:63)
at com.casadelgato.email.repository.jpa.JPARepository.createEntityManager(JPARepository.java:124)
at com.casadelgato.email.repository.jpa.JPARepository.initDatabase(JPARepository.java:179)
at com.casadelgato.email.repository.jpa.JPARepository.open(JPARepository.java:161)
at com.casadelgato.email.ObjectFactory.getRepository(ObjectFactory.java:20)
at com.casadelgato.email.server.EmailServer.main(EmailServer.java:66)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.eclipse.jdt.internal.jarinjarloader.JarRsrcLoader.main(JarRsrcLoader.java:58)
Caused by: java.lang.StringIndexOutOfBoundsException: String index out of range: -1
at java.lang.String.substring(Unknown Source)
at org.hibernate.ejb.packaging.JarVisitorFactory.getJarURLFromURLEntry(JarVisitorFactory.java:57)
at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:351)
... 12 more
And that IS the entire stack trace that it puts out.
Then it appears to do a whole bunch of Type Registrations again.
Then, the exact same error happens AGAIN.
And finally, the app just hangs.
Any ideas?