-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: ClassNotFoundException: HibernateOgmPersistence
PostPosted: Fri Jan 20, 2017 12:36 pm 
Newbie

Joined: Fri Jan 20, 2017 12:15 pm
Posts: 4
I am developing a JBoss application server and I would like to use Hibernate OGM for Mongo. But I can't figure out what I should do. Following the instruction online, here's what I have done:

this is part of my pom.xml


Code:

  <dependencyManagement>
    <dependencies>
                <dependency>
         <groupId>org.hibernate</groupId>
         <artifactId>hibernate-core</artifactId>
         <scope>provided</scope>
         <version>5.2.6.Final</version>
      </dependency>
      
      <dependency>
         <groupId>org.hibernate</groupId>
         <artifactId>hibernate-validator-cdi</artifactId>
         <version>5.3.4.Final</version>
         <scope>provided</scope>
      </dependency>
      
      <dependency>
         <groupId>org.hibernate</groupId>
         <artifactId>hibernate-entitymanager</artifactId>
         <version>3.4.0.GA</version>
         <scope>provided</scope>
         <exclusions>
            <exclusion>
               <artifactId>dom4j</artifactId>
               <groupId>dom4j</groupId>
            </exclusion>
            <exclusion>
               <artifactId>jboss-logging</artifactId>
               <groupId>org.jboss.logging</groupId>
            </exclusion>
         </exclusions>
      </dependency>

        <dependency>
            <groupId>org.hibernate.ogm</groupId>
            <artifactId>hibernate-ogm-bom</artifactId>
            <version>5.0.4.Final</version>
         <type>pom</type>
            <scope>import</scope>
        </dependency>
      
      <dependency>
         <groupId>org.hibernate.ogm</groupId>
         <artifactId>hibernate-ogm-mongodb</artifactId>
         <version>5.0.4.Final</version>
      </dependency>
    </dependencies>

  </dependencyManagement>
<dependencies>
   <dependency>
      <groupId>org.hibernate</groupId>
      <artifactId>hibernate-validator-cdi</artifactId>
   </dependency>

   <dependency>
      <groupId>org.hibernate</groupId>
      <artifactId>hibernate-core</artifactId>
   </dependency>

   <dependency>
      <groupId>org.hibernate</groupId>
      <artifactId>hibernate-entitymanager</artifactId>
      <exclusions>
         <exclusion>
            <artifactId>dom4j</artifactId>
            <groupId>dom4j</groupId>
         </exclusion>
         <exclusion>
            <artifactId>jboss-logging</artifactId>
            <groupId>org.jboss.logging</groupId>
         </exclusion>
      </exclusions>
   </dependency>
   
   <dependency>
        <groupId>org.hibernate.ogm</groupId>
        <artifactId>hibernate-ogm-mongodb</artifactId>
    </dependency>
   
       <!-- standard APIs dependencies - provided in a Java EE container -->
    <dependency>
        <groupId>org.hibernate.javax.persistence</groupId>
        <artifactId>hibernate-jpa-2.1-api</artifactId>
       <version>1.0.0.Final</version>
    </dependency>
    <dependency>
        <groupId>org.jboss.spec.javax.transaction</groupId>
        <artifactId>jboss-transaction-api_1.2_spec</artifactId>
      <version>1.0.1.Final</version>
    </dependency>
</dependencies>


This is my persistence.xml

Code:
<?xml version="1.0" encoding="UTF-8"?>
<persistence version="2.0" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd">

  <persistence-unit name="ComelitIot" transaction-type="JTA">
    <provider>org.hibernate.ogm.jpa.HibernateOgmPersistence</provider>
   
    <jta-data-source>java:jboss/datasources/ComelitIot</jta-data-source>
   
    <properties>
      <property name="hibernate.transaction.jta.platform" value="org.hibernate.service.jta.platform.internal.JBossAppServerJtaPlatform"/>
      <property name="hibernate.ogm.datastore.database" value="comelit"/>
      <property name="hibernate.ogm.datastore.host" value="localhost"/>
      <property name="hibernate.ogm.datastore.provider" value="mongodb"/>
      <!-- Just in case your DB needs user/name password
            <property name="hibernate.ogm.datastore.username" value="db_user" />
            <property name="hibernate.ogm.datastore.password" value="top_secret!" />
       -->
    </properties>
  </persistence-unit>
</persistence>


This is my jboss-deployment-structure.xml

Code:
<jboss-deployment-structure>
   <deployment>
      <exclusions>
         <!-- Exclude slf4j di JBoss perchè voglio usare logback -->
         <module name="org.apache.commons.logging" />
         <module name="org.slf4j" />
         <module name="org.slf4j.ext" />
         <module name="org.slf4j.jcl-over-slf4j" />
         <module name="org.slf4j.impl" />
         <module name="org.apache.log4j" />
         <module name="org.apache.httpcomponents" />
         <module name="org.jboss.resteasy.resteasy-jackson-provider"/>
      </exclusions>
      <dependencies>
         <module name="org.apache.commons.beanutils" />
         <module name="org.apache.commons.io" />
            <module name="org.infinispan" />
         <module name="org.dom4j" />
         <module name="org.joda.time" />
         <module name="org.jboss.resteasy.resteasy-multipart-provider" />
         <module name="org.jboss.resteasy.resteasy-jaxrs" />
         <module name="org.jboss.resteasy.resteasy-jackson2-provider" />
         <module name="org.wildfly.clustering.api" />
         <module name="com.google.guava" />
      </dependencies>
   </deployment>


The project compiles, but when I run it in wildfly-10 I get these errors

Quote:
16:42:18,085 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-7) MSC000001: Failed to start service jboss.deployment.unit."comelit-iot-server.war".FIRST_MODULE_USE: org.jboss.msc.service.StartException in service jboss.deployment.unit."comelit-iot-server.war".FIRST_MODULE_USE: WFLYSRV0153: Failed to process phase FIRST_MODULE_USE of deployment "comelit-iot-server.war"
at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:154)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1948)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1881)
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:745)
Caused by: org.jboss.as.server.deployment.DeploymentUnitProcessingException: WFLYJPA0019: Could not deploy application packaged persistence provider 'org.hibernate.ogm.jpa.HibernateOgmPersistence'
at org.jboss.as.jpa.processor.PersistenceProviderHandler.deploy(PersistenceProviderHandler.java:79)
at org.jboss.as.jpa.processor.PersistenceBeginInstallProcessor.deploy(PersistenceBeginInstallProcessor.java:49)
at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:147)
... 5 more
Caused by: java.lang.reflect.InvocationTargetException
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:422)
at org.jboss.as.jpa.processor.PersistenceProviderHandler.deploy(PersistenceProviderHandler.java:74)
... 7 more
Caused by: java.lang.NoClassDefFoundError: org/hibernate/jpa/HibernatePersistenceProvider
at org.hibernate.ogm.jpa.HibernateOgmPersistence.<init>(HibernateOgmPersistence.java:39)
... 12 more
Caused by: java.lang.ClassNotFoundException: org.hibernate.jpa.HibernatePersistenceProvider from [Module "deployment.comelit-iot-server.war:main" from Service Module Loader]
at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:198)
at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:363)
at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:351)
at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:93)
... 13 more


What should I do?


Top
 Profile  
 
 Post subject: Re: ClassNotFoundException: HibernateOgmPersistence
PostPosted: Mon Jan 23, 2017 7:55 am 
Hibernate Team
Hibernate Team

Joined: Fri Sep 09, 2011 3:18 am
Posts: 295
Could you tell me which version of JBoss AS (do you mean WildFly?), Hibernate OGM and MongoDB are you trying to use?


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.