JBoss EAP 7.1 部署失败集成商:找不到提供程序

JBoss EAP 7.1 Deployment Failed Integrator: Provider not found

我们正在将我们的应用程序从 JBoss EAP 6.x.x 迁移到 JBoss EAP 7.1。我已经在我的 JBoss 7 上进行了所有必需的配置。但是在 Jboss 7.1 上部署一个应用程序时,我在管理控制台上收到以下错误:

"failure-description" => {
    "WFLYCTL0080: Failed services" => {
        "jboss.persistenceunit.\"project-services.ear/pack-enterprise-domain-ejb.jar#packEnterpise\".__FIRST_PHASE__" => "java.util.ServiceConfigurationError: org.hibernate.integrator.spi.Integrator: Provider com.comp.pack.enterprise.domain.util.CustomEnversIntegrator not found
        Caused by: java.util.ServiceConfigurationError: org.hibernate.integrator.spi.Integrator: Provider com.comp.pack.enterprise.domain.util.CustomEnversIntegrator not found "}},
        "rolled-back" => true
    }

server.log 文件中我得到以下异常:

2019-02-27 13:28:19,666 WARN  [org.jboss.modules] (ServerService Thread Pool -- 27) Failed to define class com.comp.pack.enterprise.domain.util.CustomEnversIntegrator in Module "deployment.project-services.ear" from Service Module Loader: java.lang.NoClassDefFoundError: Failed to link com/comp/pack/enterprise/domain/util/CustomEnversIntegrator (Module "deployment.project-services.ear" from Service Module Loader): org/hibernate/envers/event/EnversIntegrator
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
    at org.jboss.modules.ModuleClassLoader.defineClass(ModuleClassLoader.java:446)
    at org.jboss.modules.ModuleClassLoader.loadClassLocal(ModuleClassLoader.java:274)
    at org.jboss.modules.ModuleClassLoader.loadClassLocal(ModuleClassLoader.java:77)
    at org.jboss.modules.Module.loadModuleClass(Module.java:713)
    at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:190)
    at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:412)
    at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:400)
    at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:116)
    at org.hibernate.boot.registry.classloading.internal.ClassLoaderServiceImpl$AggregatedClassLoader.findClass(ClassLoaderServiceImpl.java:209)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:348)
    at java.util.ServiceLoader$LazyIterator.nextService(ServiceLoader.java:370)
    at java.util.ServiceLoader$LazyIterator.next(ServiceLoader.java:404)
    at java.util.ServiceLoader.next(ServiceLoader.java:480)
    at org.hibernate.boot.registry.classloading.internal.ClassLoaderServiceImpl.loadJavaServices(ClassLoaderServiceImpl.java:340)
    at org.hibernate.integrator.internal.IntegratorServiceImpl.<init>(IntegratorServiceImpl.java:40)
    at org.hibernate.boot.registry.BootstrapServiceRegistryBuilder.build(BootstrapServiceRegistryBuilder.java:213)
    at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.buildBootstrapServiceRegistry(EntityManagerFactoryBuilderImpl.java:366)
    at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.<init>(EntityManagerFactoryBuilderImpl.java:167)
    at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.<init>(EntityManagerFactoryBuilderImpl.java:150)
    at org.hibernate.jpa.boot.spi.Bootstrap.getEntityManagerFactoryBuilder(Bootstrap.java:28)
    at org.hibernate.jpa.boot.spi.Bootstrap.getEntityManagerFactoryBuilder(Bootstrap.java:40)
    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:254)
    at org.jboss.as.jpa.service.PhaseOnePersistenceUnitServiceImpl.access0(PhaseOnePersistenceUnitServiceImpl.java:59)
    at org.jboss.as.jpa.service.PhaseOnePersistenceUnitServiceImpl.run(PhaseOnePersistenceUnitServiceImpl.java:125)
    at org.jboss.as.jpa.service.PhaseOnePersistenceUnitServiceImpl.run(PhaseOnePersistenceUnitServiceImpl.java:104)
    at org.wildfly.security.manager.WildFlySecurityManager.doChecked(WildFlySecurityManager.java:640)
    at org.jboss.as.jpa.service.PhaseOnePersistenceUnitServiceImpl.run(PhaseOnePersistenceUnitServiceImpl.java:137)
    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)

2019-02-27 13:28:19,666 ERROR [org.jboss.msc.service.fail] (ServerService Thread Pool -- 27) MSC000001: Failed to start service jboss.persistenceunit."project-services.ear/pack-enterprise-domain-ejb.jar#packEnterpise".__FIRST_PHASE__: org.jboss.msc.service.StartException in service jboss.persistenceunit."project-services.ear/pack-enterprise-domain-ejb.jar#packEnterpise".__FIRST_PHASE__: java.util.ServiceConfigurationError: org.hibernate.integrator.spi.Integrator: Provider com.comp.pack.enterprise.domain.util.CustomEnversIntegrator not found
    at org.jboss.as.jpa.service.PhaseOnePersistenceUnitServiceImpl.run(PhaseOnePersistenceUnitServiceImpl.java:128)
    at org.jboss.as.jpa.service.PhaseOnePersistenceUnitServiceImpl.run(PhaseOnePersistenceUnitServiceImpl.java:104)
    at org.wildfly.security.manager.WildFlySecurityManager.doChecked(WildFlySecurityManager.java:640)
    at org.jboss.as.jpa.service.PhaseOnePersistenceUnitServiceImpl.run(PhaseOnePersistenceUnitServiceImpl.java:137)
    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.util.ServiceConfigurationError: org.hibernate.integrator.spi.Integrator: Provider com.comp.pack.enterprise.domain.util.CustomEnversIntegrator not found
    at java.util.ServiceLoader.fail(ServiceLoader.java:239)
    at java.util.ServiceLoader.access0(ServiceLoader.java:185)
    at java.util.ServiceLoader$LazyIterator.nextService(ServiceLoader.java:372)
    at java.util.ServiceLoader$LazyIterator.next(ServiceLoader.java:404)
    at java.util.ServiceLoader.next(ServiceLoader.java:480)
    at org.hibernate.boot.registry.classloading.internal.ClassLoaderServiceImpl.loadJavaServices(ClassLoaderServiceImpl.java:340)
    at org.hibernate.integrator.internal.IntegratorServiceImpl.<init>(IntegratorServiceImpl.java:40)
    at org.hibernate.boot.registry.BootstrapServiceRegistryBuilder.build(BootstrapServiceRegistryBuilder.java:213)
    at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.buildBootstrapServiceRegistry(EntityManagerFactoryBuilderImpl.java:366)
    at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.<init>(EntityManagerFactoryBuilderImpl.java:167)
    at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.<init>(EntityManagerFactoryBuilderImpl.java:150)
    at org.hibernate.jpa.boot.spi.Bootstrap.getEntityManagerFactoryBuilder(Bootstrap.java:28)
    at org.hibernate.jpa.boot.spi.Bootstrap.getEntityManagerFactoryBuilder(Bootstrap.java:40)
    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:254)
    at org.jboss.as.jpa.service.PhaseOnePersistenceUnitServiceImpl.access0(PhaseOnePersistenceUnitServiceImpl.java:59)
    at org.jboss.as.jpa.service.PhaseOnePersistenceUnitServiceImpl.run(PhaseOnePersistenceUnitServiceImpl.java:125)
    ... 7 more

    }

我的部署结构:

project-services.ear
 +++ lib
 +++ META-INF
 +-- proj-impl.jar
 +-- proj-domain-ejb.jar

com.comp.pack.enterprise.domain.util.CustomEnversIntegrator is Custom Integrator which is part of jar present in lib folder.

问题出在 JBoss EAP 7.1 提供的休眠版本上。我在我的代码中使用了 Hibernate 3,JBoss 7.1 默认提供了 hibernate 5.1。通过根据 Hibernate 5.1 更新我的代码,我能够解决这个问题。