ArchiveDescriptor reused; can URLs be processed multiple times? Hibernate validator in Wildfly10

I’m trying to load hibernate entities from external jars using below code.
HibernatePersistenceProviderAdaptor method override:

     @Override
     public void addProviderDependencies(PersistenceUnitMetadata pu) {
            pu.setJarFileUrls(detectJarFileUrls());
            super.addProviderDependencies(pu);
     }

IN persistence.xml, property added for hibernate: <property name="jboss.as.jpa.adapterClass" value="com.pkg.hibernate.CustomHibernatePersistenceProviderAdaptor"/>
When we start wildfly it gives below error:

20:06:42,572 INFO  [org.jboss.as.clustering.infinispan] (ServerService Thread Pool -- 504) WFLYCLINF0002: Started client-mappings cache from ejb container
20:06:48,177 ERROR [org.jboss.msc.service.fail] (ServerService Thread Pool -- 501) MSC000001: Failed to start service jboss.persistenceunit."ear-1.0-SNAPSHOT.ear#iditdb".__FIRST_PHASE__: org.jboss.msc.service.StartException in service jboss.persistenceunit."ear-1.0-SNAPSHOT.ear#iditdb".__FIRST_PHASE__: java.lang.IllegalStateException: ArchiveDescriptor reused; can URLs be processed multiple times?
    at org.jboss.as.jpa.service.PhaseOnePersistenceUnitServiceImpl$1$1.run(PhaseOnePersistenceUnitServiceImpl.java:120)
    at org.jboss.as.jpa.service.PhaseOnePersistenceUnitServiceImpl$1$1.run(PhaseOnePersistenceUnitServiceImpl.java:102)
    at org.wildfly.security.manager.WildFlySecurityManager.doChecked(WildFlySecurityManager.java:667)
    at org.jboss.as.jpa.service.PhaseOnePersistenceUnitServiceImpl$1.run(PhaseOnePersistenceUnitServiceImpl.java:129)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at java.lang.Thread.run(Thread.java:748)
    at org.jboss.threads.JBossThread.run(JBossThread.java:320)
Caused by: java.lang.IllegalStateException: ArchiveDescriptor reused; can URLs be processed multiple times?
    at org.hibernate.boot.archive.scan.spi.AbstractScannerImpl.validateReuse(AbstractScannerImpl.java:104)
    at org.hibernate.boot.archive.scan.spi.AbstractScannerImpl.buildArchiveDescriptor(AbstractScannerImpl.java:71)
    at org.hibernate.boot.archive.scan.spi.AbstractScannerImpl.scan(AbstractScannerImpl.java:46)
    at org.hibernate.boot.model.process.internal.ScanningCoordinator.coordinateScan(ScanningCoordinator.java:75)
    at org.hibernate.boot.model.process.spi.MetadataBuildingProcess.prepare(MetadataBuildingProcess.java:98)
    at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.<init>(EntityManagerFactoryBuilderImpl.java:229)
    at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.<init>(EntityManagerFactoryBuilderImpl.java:164)
    at org.hibernate.jpa.boot.spi.Bootstrap.getEntityManagerFactoryBuilder(Bootstrap.java:32)
    at org.hibernate.jpa.boot.spi.Bootstrap.getEntityManagerFactoryBuilder(Bootstrap.java:89)
    at org.jboss.as.jpa.hibernate5.TwoPhaseBootstrapImpl.<init>(TwoPhaseBootstrapImpl.java:39)
    at org.jboss.as.jpa.hibernate5.HibernatePersistenceProviderAdaptor.getBootstrap(HibernatePersistenceProviderAdaptor.java:199)
    at org.jboss.as.jpa.service.PhaseOnePersistenceUnitServiceImpl.createContainerEntityManagerFactoryBuilder(PhaseOnePersistenceUnitServiceImpl.java:242)
    at org.jboss.as.jpa.service.PhaseOnePersistenceUnitServiceImpl.access$800(PhaseOnePersistenceUnitServiceImpl.java:59)
    at org.jboss.as.jpa.service.PhaseOnePersistenceUnitServiceImpl$1$1.run(PhaseOnePersistenceUnitServiceImpl.java:117)
    ... 7 more
20:07:57,478 ERROR [org.jboss.as.controller.management-operation] (DeploymentScanner-threads - 2) WFLYCTL0013: Operation ("full-replace-deployment") failed - address: ([]) - failure description: {
    "WFLYCTL0080: Failed services" => {
        "jboss.persistenceunit.\"ear-1.0-SNAPSHOT.ear#iditdb-archive\".__FIRST_PHASE__" => "org.jboss.msc.service.StartException in service jboss.persistenceunit.\"ear-1.0-SNAPSHOT.ear#iditdb-archive\".__FIRST_PHASE__: java.lang.IllegalStateException: ArchiveDescriptor reused; can URLs be processed multiple times?
    Caused by: java.lang.IllegalStateException: ArchiveDescriptor reused; can URLs be processed multiple times?",
        "jboss.persistenceunit.\"ear-1.0-SNAPSHOT.ear#iditdb\".__FIRST_PHASE__" => "org.jboss.msc.service.StartException in service jboss.persistenceunit.\"ear-1.0-SNAPSHOT.ear#iditdb\".__FIRST_PHASE__: java.lang.IllegalStateException: ArchiveDescriptor reused; can URLs be processed multiple times?
    Caused by: java.lang.IllegalStateException: ArchiveDescriptor reused; can URLs be processed multiple times?"
    },
    "WFLYCTL0412: Required services that are not installed:" => [
        "jboss.persistenceunit.\"ear-1.0-SNAPSHOT.ear#iditdb\".__FIRST_PHASE__",
        "jboss.persistenceunit.\"ear-1.0-SNAPSHOT.ear#iditdb-archive\".__FIRST_PHASE__"
    ],
    "WFLYCTL0180: Services with missing/unavailable dependencies" => undefined
} 
1 Like