Hi,
I’m currently experimenting mongo datastore using hibernate-ogm v 5.4.0.Beta2. I created a project from javaee7 maven archetype and followed the configuration procedures in https://docs.jboss.org/hibernate/ogm/5.4/reference/en-US/html_single/#mongodb-built-in-types. But when I run the Arquillian test in Wildfly13 I got:
Caused by: javax.naming.NameNotFoundException: ---PlaceHolderDSForOGM--- -- service jboss.naming.context.java.---PlaceHolderDSForOGM---
at org.jboss.as.naming@13.0.0.Final//org.jboss.as.naming.ServiceBasedNamingStore.lookup(ServiceBasedNamingStore.java:106)
at org.jboss.as.naming@13.0.0.Final//org.jboss.as.naming.NamingContext.lookup(NamingContext.java:207)
at org.jboss.as.naming@13.0.0.Final//org.jboss.as.naming.InitialContext$DefaultInitialContext.lookup(InitialContext.java:237)
at org.jboss.as.naming@13.0.0.Final//org.jboss.as.naming.NamingContext.lookup(NamingContext.java:184)
at java.naming/javax.naming.InitialContext.lookup(InitialContext.java:413)
at java.naming/javax.naming.InitialContext.lookup(InitialContext.java:413)
at org.hibernate.orm:5.3.2.Final@5.3.2.Final//org.hibernate.engine.jndi.internal.JndiServiceImpl.locate(JndiServiceImpl.java:97)
... 30 more
Here are the most important files:
persistence.xml
<persistence version="2.1"
xmlns="http://xmlns.jcp.org/xml/ns/persistence"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://xmlns.jcp.org/xml/ns/persistence
http://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd">
<persistence-unit name="primary"
transaction-type="JTA">
<provider>org.hibernate.ogm.jpa.HibernateOgmPersistence</provider>
<jta-data-source>java:jboss/datasources/hibernate-ogm-mongodb-demoTestDS</jta-data-source>
<properties>
<property name="jboss.as.jpa.providerModule" value="org.hibernate:5.3" />
<property name="wildfly.jpa.hibernate.search.module" value="org.hibernate.search.orm:5.10.2.Final" />
<property name="hibernate.ogm.datastore.provider" value="mongodb" />
<property name="hibernate.connection.resource" value="java:jboss/mongodb/client"/>
<property name="hibernate.ogm.datastore.host" value="localhost" />
<property name="hibernate.ogm.mongodb.authentication_mechanism" value="BEST" />
<property name="hibernate.ogm.datastore.database" value="mydb" />
<property name="hibernate.ogm.mongodb.authentication_database" value="admin" />
<property name="hibernate.ogm.datastore.username" value="admin" />
<property name="hibernate.ogm.datastore.password" value="admin" />
<property name="hibernate.ogm.datastore.create_database" value="true" />
<property name="hibernate.ogm.mongodb.write_concern" value="JOURNALED" />
<property name="hibernate.ogm.mongodb.read_preference" value="NEAREST" />
</properties>
</persistence-unit>
</persistence>
Parts of pom.xml:
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-search-orm</artifactId>
<scope>provided</scope>
<exclusions>
<exclusion>
<groupId>dom4j</groupId>
<artifactId>dom4j</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-search-engine</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.hibernate.ogm</groupId>
<artifactId>hibernate-ogm-core</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.hibernate.ogm</groupId>
<artifactId>hibernate-ogm-mongodb</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.mongodb</groupId>
<artifactId>mongo-java-driver</artifactId>
</dependency>
<dependency>
<groupId>org.hibernate.ogm</groupId>
<artifactId>hibernate-ogm-core</artifactId>
<type>test-jar</type>
<scope>test</scope>
</dependency>
server-provisioning.xml
<server-provisioning xmlns="urn:wildfly:server-provisioning:1.1" copy-module-artifacts="true">
<feature-packs>
<feature-pack groupId="org.hibernate" artifactId="hibernate-orm-jbossmodules" version="5.3.2.Final" />
<feature-pack groupId="org.hibernate" artifactId="hibernate-search-jbossmodules-engine" version="5.10.2.Final" />
<feature-pack groupId="org.hibernate" artifactId="hibernate-search-jbossmodules-orm" version="5.10.2.Final" />
<feature-pack groupId="org.hibernate.ogm" artifactId="hibernate-ogm-featurepack-core" version="5.4.0.Beta2" />
<feature-pack groupId="org.hibernate.ogm" artifactId="hibernate-ogm-featurepack-mongodb" version="5.4.0.Beta2" />
<feature-pack groupId="org.wildfly" artifactId="wildfly-feature-pack" version="13.0.0.Final" />
</feature-packs>
</server-provisioning>
jboss-deployment-structure.xml
<jboss-deployment-structure
xmlns="urn:jboss:deployment-structure:1.1">
<deployment>
<dependencies>
<module name="org.hibernate.ogm" slot="5.4" services="export" />
<module name="org.hibernate.ogm.mongodb" slot="5.4" services="export" />
</dependencies>
</deployment>
</jboss-deployment-structure>
Here’s the complete code: https://github.com/czetsuya/Hibernate-OGM-MongoDB-Demo
Any idea?