Shriram Shrikumar
Shriram Shrikumar

Reputation: 1155

Failed to deploy a persistence unit to JBoss 7.1.1.Final but doesn't tell me what class it's failing on

I have a very odd issue with JBoss 7.1.1.Final.

Trying to deploy a jar with a persistence unit which I have migrated from JBoss 5.1 (where it was working without issue)

I made the necessary changes (that I could find) and in deploying, I am getting an unhelpful error message.

16:19:21,532 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-8) JBAS015876: Starting deployment of "DomainModel-0.1.0-SNAPSHOT.jar"
16:19:21,556 INFO  [org.jboss.as.jpa] (MSC service thread 1-1) JBAS011401: Read persistence.xml for admin
16:19:21,561 WARN  [org.jboss.as.dependency.private] (MSC service thread 1-4) JBAS018567: Deployment "deployment.DomainModel-0.1.0-SNAPSHOT.jar" is using a private module ("org.apache.commons.collections:main") which may be changed or removed in future versions without notice.
16:19:21,562 WARN  [org.jboss.as.dependency.private] (MSC service thread 1-4) JBAS018567: Deployment "deployment.DomainModel-0.1.0-SNAPSHOT.jar" is using a private module ("org.apache.commons.lang:main") which may be changed or removed in future versions without notice.
16:19:21,566 INFO  [org.jboss.as.jpa] (MSC service thread 1-1) JBAS011402: Starting Persistence Unit Service 'DomainModel-0.1.0-SNAPSHOT.jar#admin'
16:19:21,566 INFO  [org.hibernate.ejb.Ejb3Configuration] (MSC service thread 1-1) HHH000204: Processing PersistenceUnitInfo [
    name: admin
    ...]
16:19:21,730 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-1) MSC00001: Failed to start service jboss.persistenceunit."DomainModel-0.1.0-SNAPSHOT.jar#admin": org.jboss.msc.service.StartException in service jboss.persistenceunit."DomainModel-0.1.0-SNAPSHOT.jar#admin": Failed to start service
    at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1767) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110) [rt.jar:1.7.0_10]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603) [rt.jar:1.7.0_10]
    at java.lang.Thread.run(Thread.java:722) [rt.jar:1.7.0_10]
Caused by: javax.persistence.PersistenceException: [PersistenceUnit: admin] Unable to build EntityManagerFactory
    at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:914)
    at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:889)
    at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:73)
    at org.jboss.as.jpa.service.PersistenceUnitServiceImpl.createContainerEntityManagerFactory(PersistenceUnitServiceImpl.java:162)
    at org.jboss.as.jpa.service.PersistenceUnitServiceImpl.start(PersistenceUnitServiceImpl.java:85)
    at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
    at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
    ... 3 more
Caused by: org.hibernate.AnnotationException: Associated class not found: java.lang.String
    at org.hibernate.cfg.annotations.MapBinder.bindKeyFromAssociationTable(MapBinder.java:136)
    at org.hibernate.cfg.annotations.MapBinder.access$000(MapBinder.java:75)
    at org.hibernate.cfg.annotations.MapBinder$1.secondPass(MapBinder.java:114)
    at org.hibernate.cfg.CollectionSecondPass.doSecondPass(CollectionSecondPass.java:66)
    at org.hibernate.cfg.Configuration.originalSecondPassCompile(Configuration.java:1586)
    at org.hibernate.cfg.Configuration.secondPassCompile(Configuration.java:1359)
    at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1724)
    at org.hibernate.ejb.EntityManagerFactoryImpl.<init>(EntityManagerFactoryImpl.java:84)
    at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:904)
    ... 9 more

16:19:21,941 INFO  [org.jboss.as.server] (DeploymentScanner-threads - 1) JBAS015870: Deploy of deployment "DomainModel-0.1.0-SNAPSHOT.jar" was rolled back with failure message {"JBAS014671: Failed services" => {"jboss.persistenceunit.\"DomainModel-0.1.0-SNAPSHOT.jar#admin\"" => "org.jboss.msc.service.StartException in service jboss.persistenceunit.\"DomainModel-0.1.0-SNAPSHOT.jar#admin\": Failed to start service"}}
16:19:21,948 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-3) JBAS015877: Stopped deployment DomainModel-0.1.0-SNAPSHOT.jar in 6ms
16:19:21,949 INFO  [org.jboss.as.controller] (DeploymentScanner-threads - 1) JBAS014774: Service status report
JBAS014777:   Services which failed to start:      service jboss.persistenceunit."DomainModel-0.1.0-SNAPSHOT.jar#admin": org.jboss.msc.service.StartException in service jboss.persistenceunit."DomainModel-0.1.0-SNAPSHOT.jar#admin": Failed to start service

16:19:21,950 ERROR [org.jboss.as.server.deployment.scanner] (DeploymentScanner-threads - 2) {"JBAS014653: Composite operation failed and was rolled back. Steps that failed:" => {"Operation step-2" => {"JBAS014671: Failed services" => {"jboss.persistenceunit.\"DomainModel-0.1.0-SNAPSHOT.jar#admin\"" => "org.jboss.msc.service.StartException in service jboss.persistenceunit.\"DomainModel-0.1.0-SNAPSHOT.jar#admin\": Failed to start service"}}}}

The problem I have is not the error it self - which I can probably figure out. What is bugging me is that its not telling me where it is having this issue - i.e. which entity has this issue.

In googling, I was able to find an issue related to ElementCollections with Maps' and I have updated these and it changed to not finding Longs - more updates and it's back to String.

Does anyone know how I can get it to tell me what class it is having trouble with?

Thanks...

Upvotes: 0

Views: 3820

Answers (2)

Shriram Shrikumar
Shriram Shrikumar

Reputation: 1155

While I did not figure out how to get JBoss / Hibernate to tell me which entity was causing the issue, I did discover that this particular error was caused due to incorrect migration to @ElementCollection from @CollectionOfElements

I was able to use arquillian and do a micro-deployment of each class that used this (luckily, there was only a handful) and fix the issue.

In my case, I had left @MapKey in place which needed to be replaced with @MapKeyColumn.

Upvotes: 1

Quincy
Quincy

Reputation: 4433

Try to read the user guide for migration

How do I migrate my application from JBoss AS 5 or AS 6 to JBoss AS 7?

Upvotes: 0

Related Questions