我正在进行的迁移到JBoss WildFly 14.0.0上的Hibernate OGM 5.4的尝试。最终要与MongoDB一起使用。
使用OGM的早期版本在WildFly 12和13中运行良好。
使用OGM 5.4,JPA 2.2,Hibernate ORM 5.3和Hibernate Search 5.10
我在Gradle构建中的“规定”是:
provision {
//Optional destination directory:
destinationDir = file("wildfly-custom")
configuration = file( 'wildfly-server-provisioning.xml' )
// Define variables which need replacing in the provisioning configuration!
variables['wildfly.version'] = '14.0.0.Final'
variables['hibernate-orm.version'] = '5.3.7.Final'
variables['hibernate-search.version'] = '5.10.4.Final'
variables['hibernate-ogm.version'] = '5.4.0.CR1'
}
由以下人员使用:
<server-provisioning xmlns="urn:wildfly:server-provisioning:1.1" copy-module-artifacts="true">
<feature-packs>
<feature-pack
groupId="org.wildfly"
artifactId="wildfly-feature-pack"
version="${wildfly.version}"/>
<feature-pack
groupId="org.hibernate"
artifactId="hibernate-orm-jbossmodules"
version="${hibernate-orm.version}"/>
<feature-pack
groupId="org.hibernate"
artifactId="hibernate-search-jbossmodules-orm"
version="${hibernate-search.version}"/>
<feature-pack
groupId="org.hibernate.ogm"
artifactId="hibernate-ogm-featurepack-mongodb"
version="${hibernate-ogm.version}"/>
</feature-packs>
</server-provisioning>
我的persistence.xml中的MongoDB持久性单元:
<persistence-unit name="nOTiFYwellMongoDBPersistenceUnit" transaction-type="JTA">
<provider>org.hibernate.ogm.jpa.HibernateOgmPersistence</provider>
<properties>
<!-- <property name="jboss.as.jpa.providerModule" value="org.hibernate:5.2"/> -->
<property name="jboss.as.jpa.providerModule" value="org.hibernate:5.3"/>
<!-- <property name="wildfly.jpa.hibernate.search.module" value="org.hibernate.search.orm:5.8"/> -->
<property name="wildfly.jpa.hibernate.search.module" value="org.hibernate.search.orm:5.10.4.Final"/>
<!-- <property name="hibernate.transaction.jta.platform" value="JBossTS"/> -->
<!-- <property name="hibernate.transaction.jta.platform" value="org.hibernate.service.jta.platform.internal.JBossAS"/> -->
<property name="hibernate.transaction.jta.platform" value="org.hibernate.service.jta.platform.internal.JBossStandAloneJtaPlatform"/>
<property name="hibernate.ogm.datastore.provider" value="org.hibernate.ogm.datastore.mongodb.impl.MongoDBDatastoreProvider"/>
<property name="hibernate.ogm.datastore.grid_dialect" value="org.hibernate.ogm.datastore.mongodb.MongoDBDialect"/>
<property name="hibernate.ogm.datastore.database" value="notifyWellDB"/>
<property name="hibernate.ogm.mongodb.host" value="127.0.0.1"/>
</properties>
</persistence-unit>
我已将相关模块从生成的WildFly 14.0.0.Final复制到安装的Home Brew中。
启用我部署的EAR后,我得到:
21:52:42,808 INFO [org.jboss.as.server.deployment] (MSC service thread 1-5) WFLYSRV0027: Starting deployment of "NOTiFYwell.ear" (runtime-name: "NOTiFYwell.ear")
21:52:43,318 INFO [org.jboss.as.server.deployment] (MSC service thread 1-5) WFLYSRV0207: Starting subdeployment (runtime-name: "NOTiFYwellJAR.jar")
21:52:43,318 INFO [org.jboss.as.server.deployment] (MSC service thread 1-2) WFLYSRV0207: Starting subdeployment (runtime-name: "NOTiFYwellWAR.war")
21:52:44,373 INFO [org.jboss.as.jpa] (MSC service thread 1-5) WFLYJPA0002: Read persistence.xml for nOTiFYwellMySQLPersistenceUnit
21:52:44,373 INFO [org.jboss.as.jpa] (MSC service thread 1-5) WFLYJPA0002: Read persistence.xml for nOTiFYwellMongoDBPersistenceUnit
21:52:44,585 WARN [org.jboss.as.jsf] (MSC service thread 1-6) WFLYJSF0005: Unknown JSF version 'NONE'. Default version 'main' will be used instead.
21:52:44,841 INFO [org.jboss.as.jpa] (ServerService Thread Pool -- 20) WFLYJPA0010: Starting Persistence Unit (phase 1 of 2) Service 'NOTiFYwell.ear/NOTiFYwellJAR.jar#nOTiFYwellMongoDBPersistenceUnit'
21:52:44,861 INFO [org.jboss.weld.deployer] (MSC service thread 1-2) WFLYWELD0003: Processing weld deployment NOTiFYwell.ear
21:52:44,911 ERROR [org.jboss.msc.service.fail] (ServerService Thread Pool -- 20) MSC000001: Failed to start service jboss.persistenceunit."NOTiFYwell.ear/NOTiFYwellJAR.jar#nOTiFYwellMongoDBPersistenceUnit".__FIRST_PHASE__: org.jboss.msc.service.StartException in service jboss.persistenceunit."NOTiFYwell.ear/NOTiFYwellJAR.jar#nOTiFYwellMongoDBPersistenceUnit".__FIRST_PHASE__: java.util.ServiceConfigurationError: org.hibernate.integrator.spi.Integrator: Provider org.hibernate.envers.boot.internal.EnversIntegrator not a subtype
at org.jboss.as.jpa.service.PhaseOnePersistenceUnitServiceImpl$1$1.run(PhaseOnePersistenceUnitServiceImpl.java:128)
at org.jboss.as.jpa.service.PhaseOnePersistenceUnitServiceImpl$1$1.run(PhaseOnePersistenceUnitServiceImpl.java:104)
at org.wildfly.security.manager.WildFlySecurityManager.doChecked(WildFlySecurityManager.java:650)
at org.jboss.as.jpa.service.PhaseOnePersistenceUnitServiceImpl$1.run(PhaseOnePersistenceUnitServiceImpl.java:137)
at org.jboss.threads.ContextClassLoaderSavingRunnable.run(ContextClassLoaderSavingRunnable.java:35)
at org.jboss.threads.EnhancedQueueExecutor.safeRun(EnhancedQueueExecutor.java:1985)
at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.doRunTask(EnhancedQueueExecutor.java:1487)
at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1378)
at java.lang.Thread.run(Thread.java:745)
at org.jboss.threads.JBossThread.run(JBossThread.java:485)
Caused by: java.util.ServiceConfigurationError: org.hibernate.integrator.spi.Integrator: Provider org.hibernate.envers.boot.internal.EnversIntegrator not a subtype
at java.util.ServiceLoader.fail(ServiceLoader.java:239)
at java.util.ServiceLoader.access$300(ServiceLoader.java:185)
at java.util.ServiceLoader$LazyIterator.nextService(ServiceLoader.java:376)
at java.util.ServiceLoader$LazyIterator.next(ServiceLoader.java:404)
at java.util.ServiceLoader$1.next(ServiceLoader.java:480)
at org.hibernate.boot.registry.classloading.internal.ClassLoaderServiceImpl.loadJavaServices(ClassLoaderServiceImpl.java:465)
at org.hibernate.integrator.internal.IntegratorServiceImpl.<init>(IntegratorServiceImpl.java:40)
at org.hibernate.boot.registry.BootstrapServiceRegistryBuilder.build(BootstrapServiceRegistryBuilder.java:224)
at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.buildBootstrapServiceRegistry(EntityManagerFactoryBuilderImpl.java:455)
at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.<init>(EntityManagerFactoryBuilderImpl.java:199)
at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.<init>(EntityManagerFactoryBuilderImpl.java:167)
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.wildfly.jpa.hibernateogm5.HibernateOGMPersistenceProviderAdaptor.getBootstrap(HibernateOGMPersistenceProviderAdaptor.java:87)
at org.jboss.as.jpa.service.PhaseOnePersistenceUnitServiceImpl.createContainerEntityManagerFactoryBuilder(PhaseOnePersistenceUnitServiceImpl.java:254)
at org.jboss.as.jpa.service.PhaseOnePersistenceUnitServiceImpl.access$900(PhaseOnePersistenceUnitServiceImpl.java:59)
at org.jboss.as.jpa.service.PhaseOnePersistenceUnitServiceImpl$1$1.run(PhaseOnePersistenceUnitServiceImpl.java:125)
... 9 more
还看到了其他一些错误相同的问题,但这些建议都无济于事。
谢谢。
答案 0 :(得分:0)
很抱歉,实际上Hibernate OGM 5.4.0.CR1的hibernate-ogm-featurepack- *模块仅适用于WildFly13.x。 WildFly 14.x有一个未解决的问题:https://hibernate.atlassian.net/browse/OGM-1523。
此处的解决方法是仅安装Hibernate OGM模块,而不覆盖Hibernate ORM和Hibernate Search模块。由于WildFly 14.0.x已提供的Hibernate ORM和Hibernate Search版本与Hibernate OGM 5.4.0.CR1(或5.4.0.Final)完全兼容。
我希望能对您有所帮助。 法比奥