Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Class org.datanucleus.api.jdo.PersistenceManagerFactoryClass was not found

I am using Google App Engine (appengine-java-sdk-1.6.6) for an application using JDO and maven (maven-gae-plugin) for the project structure and build. The build is successful along with enhancing my domain classes with DataNucleus Enhancer.

When running the application, I am facing this issue:Class org.datanucleus.api.jdo.PersistenceManagerFactoryClass was not found. Could anyone please advise. Thanks

PS: I have done a grep (on linux) to find the PersistenceManagerFactoryClass in the APP Engine SDK folder, I could not find it.

Could not instantiate bean class [com.peerbuccoss.apps.mtp.dao.impl.CommonDaoImpl]:  Constructor threw exception; nested exception is javax.jdo.JDOFatalUserException: Class     org.datanucleus.api.jdo.PersistenceManagerFactoryClass was not found.
NestedThrowables:
java.lang.ClassNotFoundException:     org.datanucleus.api.jdo.PersistenceManagerFactoryClass:
java.lang.ClassNotFoundException: org.datanucleus.api.jdo.PersistenceManagerFactoryClass
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:423)
at com.google.appengine.tools.development.IsolatedAppClassLoader.loadClass(IsolatedAppClassLoader.java:176)
at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:264)
at javax.jdo.JDOHelper$18.run(JDOHelper.java:2018)
at javax.jdo.JDOHelper$18.run(JDOHelper.java:2017)
at java.security.AccessController.doPrivileged(Native Method)
at javax.jdo.JDOHelper.forName(JDOHelper.java:2015)
at javax.jdo.JDOHelper.invokeGetPersistenceManagerFactoryOnImplementation(JDOHelper.java:1162)
at javax.jdo.JDOHelper.getPersistenceManagerFactory(JDOHelper.java:808)
at javax.jdo.JDOHelper.getPersistenceManagerFactory(JDOHelper.java:1093)
at javax.jdo.JDOHelper.getPersistenceManagerFactory(JDOHelper.java:919)
like image 738
shameem_z Avatar asked Jun 21 '12 18:06

shameem_z


1 Answers

In my case I was using datanucleus-appengine-2.1.2 instead of datanucleus-appengine-1.0.10. With version 2.1.2 you must update your jdconfig.xml with the following PersistenceManagerFactoryClass:

<property name="javax.jdo.PersistenceManagerFactoryClass"
       value="org.datanucleus.api.jdo.JDOPersistenceManagerFactory"/>

My jdconfig.xml is:

<?xml version="1.0" encoding="utf-8"?>
<jdoconfig xmlns="http://java.sun.com/xml/ns/jdo/jdoconfig"
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xsi:noNamespaceSchemaLocation="http://java.sun.com/xml/ns/jdo/jdoconfig">

   <persistence-manager-factory name="transactions-optional">
       <property name="javax.jdo.PersistenceManagerFactoryClass"
           value="org.datanucleus.api.jdo.JDOPersistenceManagerFactory"/>
       <property name="javax.jdo.option.ConnectionURL" value="appengine"/>
       <property name="javax.jdo.option.NontransactionalRead" value="true"/>
       <property name="javax.jdo.option.NontransactionalWrite" value="true"/>
       <property name="javax.jdo.option.RetainValues" value="true"/>
       <property name="datanucleus.appengine.autoCreateDatastoreTxns" value="true"/>
       <property name="datanucleus.appengine.singletonPMFForName" value="true"/>
   </persistence-manager-factory>
</jdoconfig>
like image 164
Juan Diego Avatar answered Oct 22 '22 17:10

Juan Diego