I am trying to write a Vaadin application on the GAE platform using JDO, and when I want to call this method:
public void createUser(String login, String password, String email) {
PersistenceManager pm = PMF.get().getPersistenceManager();
User user = new User(login, password, email);
try {
pm.makePersistent(user);
} finally {
pm.close();
}
}
I get this error:
... property named javax.jdo.option.PersistenceUnitName. NestedThrowables: javax.jdo.JDOUserException: you indicated that this PMF uses a "persistence unit" for "transaction-optional" (but it does not exist!), Or you called JDOHelper.getPersistenceManagerFactory using "transaction-optional" as the name properties file (and this does not exist in CLASSPATH) in javax.jdo.JDOHelper.getPersistenceManagerFactory (JDOHelper.java:856) in javax.jdo.JDOHelper.getPersistenceManagerFactory (JDOHelper.java:1092) in javax.jdo.getPersistenceManagerFactory (JDOHelper.java:914) in myapp.PMF. (PMF.java:8) ... 43 more Reason: javax.jdo.JDOUserException: you specified for this PMF to use a "persistence unit" for "transaction-optional" (but this does not exist!), Or you called JDOHelper.getPersistenceManagerFactory using "transaction-optional" as the name of the properties file (and this does not exist in CLASSPATH) (...)
Google , ( - ).
, this . , jdoconfig.xml META-INF.
- , , .
EDIT: jdoconfig:
<?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>