IllegalStateException: ArchiveDescriptor reused; can URLs be processed multiple times using WildFly Java 8

1.6k views Asked by At

We are in the process to migrate Java 7 and JBoss 7 to Wildfly and Java 8.

I have already added all available Weld Libs, because the error says that weldClass is missing.

In the process there is an error.

    2015-06-22 10:16:56,694 ERROR [org.jboss.msc.service.fail] (ServerService Thread Pool -- 59) MSC000001: Failed to start service jboss.persistenceunit."foo_all.ear/foo_sb.jar#foo": org.jboss.msc.service.StartException in service jboss.persistenceunit."foo_all.ear/foo_sb.jar#foo": java.lang.IllegalStateException: ArchiveDescriptor reused; can URLs be processed multiple times?
    at org.jboss.as.jpa.service.PersistenceUnitServiceImpl$1$1.run(PersistenceUnitServiceImpl.java:172) [wildfly-jpa-8.2.0.Final.jar:8.2.0.Final]
    at org.jboss.as.jpa.service.PersistenceUnitServiceImpl$1$1.run(PersistenceUnitServiceImpl.java:117) [wildfly-jpa-8.2.0.Final.jar:8.2.0.Final]
    at java.security.AccessController.doPrivileged(Native Method) [rt.jar:1.8.0_45]
    at org.wildfly.security.manager.WildFlySecurityManager.doChecked(WildFlySecurityManager.java:474)
    at org.jboss.as.jpa.service.PersistenceUnitServiceImpl$1.run(PersistenceUnitServiceImpl.java:182) [wildfly-jpa-8.2.0.Final.jar:8.2.0.Final]
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [rt.jar:1.8.0_45]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [rt.jar:1.8.0_45]
    at java.lang.Thread.run(Thread.java:745) [rt.jar:1.8.0_45]
    at org.jboss.threads.JBossThread.run(JBossThread.java:122)
Caused by: java.lang.IllegalStateException: ArchiveDescriptor reused; can URLs be processed multiple times?
    at org.hibernate.jpa.boot.scan.spi.AbstractScannerImpl.validateReuse(AbstractScannerImpl.java:223) [hibernate-entitymanager-4.3.7.Final.jar:4.3.7.Final]
    at org.hibernate.jpa.boot.scan.spi.AbstractScannerImpl.buildArchiveDescriptor(AbstractScannerImpl.java:102) [hibernate-entitymanager-4.3.7.Final.jar:4.3.7.Final]
    at org.hibernate.jpa.boot.scan.spi.AbstractScannerImpl.scan(AbstractScannerImpl.java:70) [hibernate-entitymanager-4.3.7.Final.jar:4.3.7.Final]
    at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.scan(EntityManagerFactoryBuilderImpl.java:725) [hibernate-entitymanager-4.3.7.Final.jar:4.3.7.Final]
    at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.<init>(EntityManagerFactoryBuilderImpl.java:221) [hibernate-entitymanager-4.3.7.Final.jar:4.3.7.Final]
    at org.hibernate.jpa.boot.spi.Bootstrap.getEntityManagerFactoryBuilder(Bootstrap.java:51) [hibernate-entitymanager-4.3.7.Final.jar:4.3.7.Final]
    at org.hibernate.jpa.HibernatePersistenceProvider.getEntityManagerFactoryBuilder(HibernatePersistenceProvider.java:182) [hibernate-entitymanager-4.3.7.Final.jar:4.3.7.Final]
    at org.hibernate.jpa.HibernatePersistenceProvider.getEntityManagerFactoryBuilder(HibernatePersistenceProvider.java:177) [hibernate-entitymanager-4.3.7.Final.jar:4.3.7.Final]
    at org.hibernate.jpa.HibernatePersistenceProvider.createContainerEntityManagerFactory(HibernatePersistenceProvider.java:152) [hibernate-entitymanager-4.3.7.Final.jar:4.3.7.Final]
    at de.foo.bbis.srv.persistenceprovider.fooHibernatePersistenceProvider.createContainerEntityManagerFactory(fooHibernatePersistenceProvider.java:94) [foo_sb.jar:]
    at org.jboss.as.jpa.service.PersistenceUnitServiceImpl.createContainerEntityManagerFactory(PersistenceUnitServiceImpl.java:318) [wildfly-jpa-8.2.0.Final.jar:8.2.0.Final]
    at org.jboss.as.jpa.service.PersistenceUnitServiceImpl.access$1100(PersistenceUnitServiceImpl.java:67) [wildfly-jpa-8.2.0.Final.jar:8.2.0.Final]
    at org.jboss.as.jpa.service.PersistenceUnitServiceImpl$1$1.run(PersistenceUnitServiceImpl.java:167) [wildfly-jpa-8.2.0.Final.jar:8.2.0.Final]
    ... 8 more

2015-06-22 10:16:56,923 ERROR [org.jboss.as.controller.management-operation] (Controller Boot Thread) JBAS014613: Operation ("deploy") failed - address: ([("deployment" => "foo_all.ear")]) - failure description: {
    "JBAS014671: Failed services" => {"jboss.persistenceunit.\"foo_all.ear/foo_sb.jar#foo\"" => "org.jboss.msc.service.StartException in service jboss.persistenceunit.\"foo_all.ear/foo_sb.jar#foo\": java.lang.IllegalStateException: ArchiveDescriptor reused; can URLs be processed multiple times?
    Caused by: java.lang.IllegalStateException: ArchiveDescriptor reused; can URLs be processed multiple times?"},
    "JBAS014771: Services with missing/unavailable dependencies" => ["jboss.deployment.unit.\"foo_all.ear\".weld.weldClassIntrospector is missing [jboss.deployment.unit.\"foo_all.ear\".beanmanager]"]
}

The ear file can be deployed and the server can be started. But after the ear file has been created a subdeployment has to be deployed in the root directory of the main deployment. We use an custom PersistenceProvider

The persistence xml looks like this:

  <?xml version="1.0" encoding="UTF-8"?>
<persistence xmlns="http://java.sun.com/xml/ns/persistence"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_1.xsd"
    version="2.1">
    <persistence-unit name="foo">
        <provider>de.foo.srv.persistenceprovider.fooHibernatePersistenceProvider</provider>
        <jta-data-source>java:/foo</jta-data-source>
        <jar-file>foo_sb.jar</jar-file>
        <properties>
            <property name="jboss.as.jpa.adapterModule" value="org.jboss.as.jpa.hibernate:4" />
        </properties>
    </persistence-unit>
</persistence>
1

There are 1 answers

2
Johnny2012 On BEST ANSWER

I resolved the problem. The problem in my my case was this line in my persistence.xml.

 <jar-file>foo_sb.jar</jar-file>

The jar file tag worked well with JBoss AS7 but not in WildFly 8 using Hibernate 4.3.7.

I cannot explain why not. Maybe a Wildfly/JBoss expert can give more details about this. Hope it helps for someone.

And you need to remove the Hibernate property because it comes with WildFly 8. This line:

<property name="jboss.as.jpa.adapterModule" value="org.jboss.as.jpa.hibernate:4" />