0

I have the following persistence.xml file for my mongoDB connection:

<persistence-unit name="mailbox" transaction-type="JTA">
    <!-- Use Hibernate OGM provider: configuration will be transparent -->
    <provider>org.hibernate.ogm.jpa.HibernateOgmPersistence</provider>

    <properties>
        <property name="jboss.as.jpa.providerModule" value="org.jboss.as.jpa.hibernate:3"/>
        <property name="hibernate.ogm.datastore.provider" value="mongodb" />
        <property name="hibernate.ogm.datastore.host" value="localhost" />
        <property name="hibernate.ogm.datastore.port" value="27017" />
        <property name="hibernate.ogm.mongodb.database" value="mailbox" />
    </properties>
</persistence-unit>

but when i call the following line:

com.google.inject.persist.jpa.JpaPersistService.start(JpaPersistService.java:110)

I get the following error:

java.lang.NoClassDefFoundError: org/hibernate/engine/transaction/spi/TransactionFactory

my gradle script has the following line to install the dependency:

compile "javax.transaction:jta:$jtaVersion"
compile "org.hibernate.ogm:hibernate-ogm-mongodb:4.2.0.Final"

Any idea what am I doing wrong as I am new to the hibernate OGM world.

EDITED: I am using the JpaPersistModule JPA persist provider for guice

Obaid Maroof
  • 1,523
  • 2
  • 19
  • 40
  • Which version of Hibernate ORM are you using? Hibernate OGM 4.2 requires ORM 4.3, so it won't work with ORM 3.x (which you may be trying to use as per your "jboss.as.jpa.providerModule" setting). – Gunnar Jan 06 '16 at 16:13
  • I am not really using the ORM, at least i dont have it in my gradle file, I am only using hibernate-core and hibernate-entitymanager both at version 4.2. – Obaid Maroof Jan 07 '16 at 09:43
  • However, I got the problem solved by changing the transation-type of the persistance-unit to 'RESOURCE_LOCAL' instead of 'JTA'. – Obaid Maroof Jan 07 '16 at 09:44
  • Hibernate OGM uses ORM underneath; Make sure to use of 4.3 (not 4.2) of hibernate-core and hibernate-entitymanager. – Gunnar Jan 07 '16 at 17:23

0 Answers0