2012-01-23

JBoss 7.0.2 and Seam Report throws Exception MSC00001: Failed to start service jboss.persistenceunit

I added Seam Report(with JasperReports) to my maven project and got this exception:
 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-4) MSC00001: Failed to start service jboss.persistenceunit."test.
war#testPU": org.jboss.msc.service.StartException in service jboss.persistenceunit.""test.war#testPU": Failed to start service
    at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1780) [jboss-msc-1.0.1.GA.jar:1.0.1.GA]
   at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) [:1.6.0_27]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [:1.6.0_27]
   at java.lang.Thread.run(Thread.java:662) [:1.6.0_27]
Caused by: java.lang.ClassCastException: org.dom4j.DocumentFactory cannot be cast to org.dom4j.DocumentFactory
    at org.dom4j.DocumentFactory.getInstance(DocumentFactory.java:97)
   at org.dom4j.DocumentHelper.getDocumentFactory(DocumentHelper.java:36)
   at org.dom4j.DocumentHelper.createDocument(DocumentHelper.java:41)
    at org.hibernate.envers.configuration.RevisionInfoConfiguration.generateDefaultRevisionInfoXmlMapping(RevisionInfoConfiguration.java:86)
   at org.hibernate.envers.configuration.RevisionInfoConfiguration.configure(RevisionInfoConfiguration.java:322)
    at org.hibernate.envers.configuration.AuditConfiguration.(AuditConfiguration.java:94)
   at org.hibernate.envers.configuration.AuditConfiguration.getFor(AuditConfiguration.java:134)
   at org.hibernate.envers.event.EnversIntegrator.integrate(EnversIntegrator.java:63)
    at org.hibernate.internal.SessionFactoryImpl.(SessionFactoryImpl.java:294)
   at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1722)
   at org.hibernate.ejb.EntityManagerFactoryImpl.(EntityManagerFactoryImpl.java:76)
    at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:899)
   at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:884)
   at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:73)
    at org.jboss.as.jpa.service.PersistenceUnitService.createContainerEntityManagerFactory(PersistenceUnitService.java:143)
   at org.jboss.as.jpa.service.PersistenceUnitService.start(PersistenceUnitService.java:77)
    at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1824) [jboss-msc-1.0.1.GA.jar:1.0.1.GA]
   at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1759) [jboss-msc-1.0.1.GA.jar:1.0.1.GA]
    ... 3 more
First I didn't noticed that, because the error only occured with a restart of JBoss and not while deploying the archive. The reason of this error is, that the JasperReports dependency has its own dom4j-1.6.1.jar. This file is copied to the WEB-INF/lib directory. I found different solutions, but no one was really working. Finally I excluded the dom4j from the dependency:

  org.jboss.seam.reports
  seam-reports-jasper
  ${seam-reports-version}
  
  
    
      dom4j
      dom4j
    
  

This way I dont have the problem anymore. I used:

Kommentare:

  1. Thank you very much for writing about this. I had the same problem yesterday and your post saved me.
    My configuration is almost the same, but instead of using the Seam Report, I'm using Jasper Reports 4.1.2.

    Sincerely,
    Jonas

    AntwortenLöschen
    Antworten
    1. You're welcome, I'm glad I could help.

      Best regards,

      Joern

      Löschen