I am trying to develop an app in Java on App engine. But, have not
been able to make JDO work. It seems based on the exceptions. The JDO
is not able to initialize PersistenceManagerFactory object. I have
checked jdoconfig.xml file in src/META-INF and war/WEB-INF/classes/
META-INF, both have the same values as below. Please help. Below are
the files data and the exception stack trace.
<?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.store.appengine.jdo.DatastoreJDOPersistenceManagerFactory"/
<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"/>
</persistence-manager-factory>
</jdoconfig>
------------------------------------------------------------------------------------------------------------------------------------------
import javax.jdo.JDOHelper;
import javax.jdo.PersistenceManagerFactory;
public final class PMF {
private static final PersistenceManagerFactory pmfInstance =
JDOHelper.getPersistenceManagerFactory("transactions-
optional");
private PMF() {}
public static PersistenceManagerFactory get() {
return pmfInstance;
}
}
------------------------------------------------------------------------------------------------------------------------------------------
javax.jdo.JDOUserException: You have either specified for this PMF to
use a "persistence-unit" of "transactions-optional" (yet this doesnt
exist!) or you called JDOHelper.getPersistenceManagerFactory with
"transactions-optional" as the name of a properties file (and this
doesnt exist in the CLASSPATH)
at javax.jdo.JDOHelper.getPersistenceManagerFactory(JDOHelper.java:
856)
at javax.jdo.JDOHelper.getPersistenceManagerFactory(JDOHelper.java:
1092)
at javax.jdo.JDOHelper.getPersistenceManagerFactory(JDOHelper.java:
914)
at com.cards.services.PMF.<clinit>(PMF.java:8)
... 44 more
Caused by: javax.jdo.JDOUserException: You have either specified for
this PMF to use a "persistence-unit" of "transactions-optional" (yet
this doesnt exist!) or you called
JDOHelper.getPersistenceManagerFactory with "transactions-optional" as
the name of a properties file (and this doesnt exist in the CLASSPATH)
at
org.datanucleus.jdo.JDOPersistenceManagerFactory.initialiseProperties(JDOPersistenceManagerFactory.java:
377)
at
org.datanucleus.jdo.JDOPersistenceManagerFactory.<init>(JDOPersistenceManagerFactory.java:
260)
at
org.datanucleus.jdo.JDOPersistenceManagerFactory.getPersistenceManagerFactory(JDOPersistenceManagerFactory.java:
173)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:
39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:
25)
at java.lang.reflect.Method.invoke(Method.java:592)
at
com.google.appengine.tools.development.agent.runtime.Runtime.invoke(Runtime.java:
100)
at javax.jdo.JDOHelper$16.run(JDOHelper.java:1956)
at java.security.AccessController.doPrivileged(Native Method)
at javax.jdo.JDOHelper.invoke(JDOHelper.java:1951)
at
javax.jdo.JDOHelper.invokeGetPersistenceManagerFactoryOnImplementation(JDOHelper.java:
1159)
at javax.jdo.JDOHelper.getPersistenceManagerFactory(JDOHelper.java:
839)
... 47 more
Feb 8, 2010 10:29:16 AM com.google.apphosting.utils.jetty.JettyLogger
warn
WARNING: Nested in java.lang.ExceptionInInitializerError:
javax.jdo.JDOFatalUserException: A property named
javax.jdo.PersistenceManagerFactoryClass must be specified, or a jar
file with a META-INF/services/javax.jdo.PersistenceManagerFactory
entry must be in the classpath, or a property named
javax.jdo.option.PersistenceUnitName must be specified.
at javax.jdo.JDOHelper.getPersistenceManagerFactory(JDOHelper.java:
856)
at javax.jdo.JDOHelper.getPersistenceManagerFactory(JDOHelper.java:
1092)
at javax.jdo.JDOHelper.getPersistenceManagerFactory(JDOHelper.java:
914)
at com.cards.services.PMF.<clinit>(PMF.java:8)
at com.cards.services.UserService$Impl.create(UserService.java:42)
at
com.cards.spring.controllers.UserController.getUser(UserController.java:
54)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:
39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:
25)
at java.lang.reflect.Method.invoke(Method.java:592)