使用 hibernate-orm-modules 以使用更新的 Hibernate 时,如何在 Wildfly 11 上重新激活 infinispan?

How to reactivate infinispan on Wildfly 11, when using hibernate-orm-modules to use a more current Hibernate?

followed this jboss guide 将更新的休眠版本并行安装到 WF11 中。鉴于最后一句话:

When using these modules you’re going to give up on some of the integration which the application server normally automates.

For example enabling an Infinispan 2nd level cache is straight forward when using the default Hibernate ORM module, as WildFly will automatically setup the dependency to the Infinispan and clustering components. When using these custom modules such integration will no longer work automatically: you can still enable all normally available features but these will require explicit configuration, as if you were running Hibernate in a different container, or in no container.

我调整了 jboss-deployment-structure 以明确要求 infinispan as

<jboss-deployment-structure>
    <ear-subdeployments-isolated>false</ear-subdeployments-isolated>
        <!-- This corresponds to the top level deployment. For a war this is the war's module, for an ear -->
        <!-- This is the top level ear module, which contains all the classes in the EAR's lib folder     -->
        <deployment>
            <dependencies>
                <module name="org.hibernate.infinispan" services="import" slot="${version.org.hibernate}"/>
            </dependencies>
        </deployment>
        <sub-deployment name="some-report-service-${project.version}.war">
            <exclusions>
                <module name="org.jboss.resteasy.resteasy-jackson2-provider"/>
                <module name="org.jboss.resteasy.resteasy-jettison-provider"/>
            </exclusions>
            <dependencies>
                <module name="org.jboss.resteasy.resteasy-jackson-provider" services="import"/>
                <module name="org.hibernate.infinispan" services="import" slot="${version.org.hibernate}"/>
            </dependencies>
        </sub-deployment>
[...]

不幸的是,我仍然无法使用此 Stacktrace 将 EAR 文件部署到我的 Wildfly

 Unable to build Hibernate SessionFactory
        at org.jboss.as.jpa.service.PersistenceUnitServiceImpl.run(PersistenceUnitServiceImpl.java:195)
        at org.jboss.as.jpa.service.PersistenceUnitServiceImpl.run(PersistenceUnitServiceImpl.java:125)
        at org.wildfly.security.manager.WildFlySecurityManager.doChecked(WildFlySecurityManager.java:640)
        at org.jboss.as.jpa.service.PersistenceUnitServiceImpl.run(PersistenceUnitServiceImpl.java:209)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
        at java.lang.Thread.run(Thread.java:748)
        at org.jboss.threads.JBossThread.run(JBossThread.java:320)
Caused by: javax.persistence.PersistenceException: [PersistenceUnit: DM_DERIVATEV] Unable to build Hibernate SessionFactory
        at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.persistenceException(EntityManagerFactoryBuilderImpl.java:970)
        at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:895)
        at org.jboss.as.jpa.hibernate5.TwoPhaseBootstrapImpl.build(TwoPhaseBootstrapImpl.java:44)
        at org.jboss.as.jpa.service.PersistenceUnitServiceImpl.run(PersistenceUnitServiceImpl.java:167)
        ... 7 more
Caused by: org.hibernate.service.spi.ServiceException: Unable to create requested service [org.hibernate.engine.spi.CacheImplementor]
        at org.hibernate.service.internal.AbstractServiceRegistryImpl.createService(AbstractServiceRegistryImpl.java:271)
        at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:233)
        at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:210)
        at org.hibernate.service.internal.SessionFactoryServiceRegistryImpl.getService(SessionFactoryServiceRegistryImpl.java:80)
        at org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:243)
        at org.hibernate.boot.internal.SessionFactoryBuilderImpl.build(SessionFactoryBuilderImpl.java:462)
        at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:892)
        ... 9 more
Caused by: org.hibernate.cache.CacheException: HHH025011: Infinispan custom cache command factory not installed (possibly because the classloader where Infinispan lives couldn't find the Hibernate Infinispan cache provider)
        at org.hibernate.cache.infinispan.InfinispanRegionFactory.getCacheCommandFactory(InfinispanRegionFactory.java:743)
        at org.hibernate.cache.infinispan.InfinispanRegionFactory.startRegion(InfinispanRegionFactory.java:600)
        at org.hibernate.cache.infinispan.InfinispanRegionFactory.buildTimestampsRegion(InfinispanRegionFactory.java:390)
        at org.hibernate.internal.CacheImpl.<init>(CacheImpl.java:78)
        at org.hibernate.engine.spi.CacheInitiator.initiateService(CacheInitiator.java:28)
        at org.hibernate.engine.spi.CacheInitiator.initiateService(CacheInitiator.java:20)
        at org.hibernate.service.internal.SessionFactoryServiceRegistryImpl.initiateService(SessionFactoryServiceRegistryImpl.java:59)
        at org.hibernate.service.internal.AbstractServiceRegistryImpl.createService(AbstractServiceRegistryImpl.java:259)
        ... 15 more

我错过了什么?希望你能帮助我,并致以最诚挚的问候,

马吕斯

好的,我找到了丢失的link。还必须调整 standalone/configuration/standalone.xml 文件。

搜索:<cache-container name="hibernate" module="org.hibernate.infinispan:4"> 替换:<cache-container name="hibernate" module="org.hibernate.infinispan:5.2">

5.2当然是你说的版本,根据自己的需要调整。

更详细:

此致,

马吕斯