I am working through the example from https://blogs.oracle.com/arungupta/entry/java_ee_6_and_nosql.
Here is a link to the model src http://dev.eclipse.org/svnroot/rt/org.eclipse.persistence/trunk/examples/org.eclipse.persistence.example.jpa.nosql.mongo/src/
The part that is causing me problems is:
EntityManagerFactory factory;
...
test.factory = Persistence.createEntityManagerFactory("mongo");
EntityManager em = test.factory.createEntityManager();
When org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl.createEntityManager is invoked I get
SEVERE: javax.persistence.PersistenceException: Exception [EclipseLink-7108] (Eclipse Persistence Services - 2.0.1.v20100213-r6600): org.eclipse.persistence.exceptions.ValidationException
Exception Description: This operation is not supported for non-relational platforms.
Here are all the dependencies I am using:
<classpath>
<classpathentry kind="src" path="src/main/java" including="**/*.java"/>
<classpathentry kind="src" path="src/main/resources" excluding="**/*.java"/>
<classpathentry kind="output" path="target/classes"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="var" path="M2_REPO/javax/javaee-web-api/6.0/javaee-web-api-6.0.jar"/>
<classpathentry kind="var" path="M2_REPO/com/sun/jersey/jersey-server/1.8/jersey-server-1.8.jar"/>
<classpathentry kind="var" path="M2_REPO/asm/asm/3.1/asm-3.1.jar"/>
<classpathentry kind="var" path="M2_REPO/com/sun/jersey/jersey-core/1.8/jersey-core-1.8.jar"/>
<classpathentry kind="var" path="M2_REPO/org/mongodb/mongo-java-driver/2.7.3/mongo-java-driver-2.7.3.jar"/>
<classpathentry kind="var" path="M2_REPO/org/eclipse/persistence/org.eclipse.persistence.oracle.nosql/2.4.0/org.eclipse.persistence.oracle.nosql-2.4.0.jar"/>
<classpathentry kind="var" path="M2_REPO/org/eclipse/persistence/javax.persistence/2.0.4.v201112161009/javax.persistence-2.0.4.v201112161009.jar"/>
<classpathentry kind="var" path="M2_REPO/org/eclipse/persistence/org.eclipse.persistence.asm/3.3.1.v201206041142/org.eclipse.persistence.asm-3.3.1.v201206041142.jar"/>
<classpathentry kind="var" path="M2_REPO/org/eclipse/persistence/org.eclipse.persistence.antlr/3.2.0.v201206041011/org.eclipse.persistence.antlr-3.2.0.v201206041011.jar"/>
<classpathentry kind="var" path="M2_REPO/org/eclipse/persistence/org.eclipse.persistence.jpa.jpql/2.4.0/org.eclipse.persistence.jpa.jpql-2.4.0.jar"/>
<classpathentry kind="var" path="M2_REPO/org/eclipse/persistence/org.eclipse.persistence.core/2.4.0/org.eclipse.persistence.core-2.4.0.jar"/>
<classpathentry kind="var" path="M2_REPO/org/eclipse/persistence/org.eclipse.persistence.nosql/2.4.0/org.eclipse.persistence.nosql-2.4.0.jar"/>
<classpathentry kind="var" path="M2_REPO/org/eclipse/persistence/org.eclipse.persistence.jpa/2.4.0/org.eclipse.persistence.jpa-2.4.0.jar"/>
</classpath>
Server is GlassFish Server Open Source Edition 3. I can't figure out why createEntityManager would not be allowed, when I copied it all from example code that worked for others??
The exception shows the EclipseLink build as 2.0.1.v20100213-r6600 while this feature requires EclipseLink 2.4 or later. How ever you setup your dependencies, it seems to be using the EclipseLink version shipped with Glassfish. You can try replacing/upgrading these bundles as described here: https://blogs.oracle.com/GlassFishPersistence/entry/updating_eclipselink_bundles_in_glassfish