2

My on-going quest to migrate to Hibernate OGM 5.4 on JBoss WildFly 14.0.0.Final to use with MongoDB.

Had it working fine in WildFly 12 & 13 using earlier versions of OGM.

Using OGM 5.4, JPA 2.2, Hibernate ORM 5.3 & Hibernate Search 5.10

as per the: Compatibility matrix

My 'provision' in the Gradle Build is:

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'
}

which is used by:

<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>

The MongoDB persistence unit in my persistence.xml:

<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>

I've copied the relevant modules from the generated WildFly 14.0.0.Final to my Home Brew installed one.

When I enable my deployed EAR I get:

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

Seen a few other questions with the same error, but none of the suggestions help.

Thanks.

NOTiFY
  • 1,255
  • 1
  • 20
  • 36

1 Answers1

0

I’m sorry but actually the hibernate-ogm-featurepack-* modules of Hibernate OGM 5.4.0.CR1 work only with WildFly 13.x. There is open issue for WildFly 14.x: https://hibernate.atlassian.net/browse/OGM-1523.

The workaround here is to install just the Hibernate OGM modules without overriding the Hibernate ORM and Hibernate Search modules. Since the versions already provided of Hibernate ORM and Hibernate Search by WildFly 14.0.x are fully compatible with Hibernate OGM 5.4.0.CR1 (or 5.4.0.Final by the way).

I hope that will help you. Fabio

fax4ever
  • 81
  • 3
  • See my answer above. Can't find "search.orm.5.10.3.Final". The JAR (hibernate-search-orm-5.10.3.Final.jar) is in the modules: org/hibernate/search/orm/main. Any other suggestion? – NOTiFY Nov 23 '18 at 09:08
  • Try to remove `wildfly.jpa.hibernate.search.module` entry, since you are using now the default (the one already provided by WF 14). – fax4ever Nov 23 '18 at 12:32
  • As suggested I commented out the search module entry. Still won't deploy with either org.hibernate:5.3 or 5.4 in persistence.xml & jboss-deployment-structure.xml. When I set to OGM 5.3, I get "Caused by: org.jboss.modules.ModuleNotFoundException: org.hibernate.ogm:5.3". Which is there in modules. – NOTiFY Nov 23 '18 at 13:38
  • Caused by: org.jboss.modules.ModuleNotFoundException: org.hibernate:5.4 – NOTiFY Nov 23 '18 at 13:46
  • Noticed in the modules: org/hibernate/main/module.xml it says: "". Is something missing for WF 14.0.0.Final? – NOTiFY Nov 24 '18 at 11:47
  • You're right. I think that In order to use this workaround you need to change also "hibernate/ogm/jipijapa/module.xml" from to . As I did here: https://github.com/hibernate/hibernate-ogm/pull/1100/files. – fax4ever Nov 26 '18 at 09:56
  • Applied the above change. Still, get an error when I deploy the EAR: "Caused by: org.jboss.modules.ModuleNotFoundException: org.hibernate:5.4". I'm giving up with Hibernate OGM for MongoDB. I've spent weeks on this. – NOTiFY Dec 01 '18 at 16:26