Reputation: 20196
I am trying to get an AppEngine instance set up with JPA using DataNucleus. But I am getting the following error at runtime when the persistence unit is loaded:
[INFO] Caused by: java.lang.ExceptionInInitializerError
[INFO] at org.apache.jsp.guestbook_jsp._jspService(guestbook_jsp.java:123)
[INFO] ... 45 more
[INFO] Caused by: org.datanucleus.exceptions.NucleusUserException: There is no available StoreManager of type "appengine". Make sure that you have put the relevant DataNucleus store plugin in your CLASSPATH and if defini
ng a connection via JNDI or DataSource you also need to provide persistence property "datanucleus.storeManagerType"
[INFO] at org.datanucleus.NucleusContext.createStoreManagerForProperties(NucleusContext.java:1276)
[INFO] at org.datanucleus.NucleusContext.initialise(NucleusContext.java:357)
[INFO] at org.datanucleus.api.jpa.JPAEntityManagerFactory.initialiseNucleusContext(JPAEntityManagerFactory.java:816)
[INFO] at org.datanucleus.api.jpa.JPAEntityManagerFactory.initialise(JPAEntityManagerFactory.java:437)
[INFO] at org.datanucleus.api.jpa.JPAEntityManagerFactory.<init>(JPAEntityManagerFactory.java:396)
[INFO] at org.datanucleus.api.jpa.PersistenceProviderImpl.createEntityManagerFactory(PersistenceProviderImpl.java:116)
[INFO] at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:79)
[INFO] at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:54)
This error occurs for both local and AppEngine deployments.
What value should I be providing for the datanucleus.ConnectionURL property is not AppEngine? NB I couldn't find any doco which explained what this value actually means in an AppEngine environment. What is it meant to link up to?
Am I meant to define a StoreManager somewhere?
Am I missing some library? If so what?
My persistence.xml is:
<persistence-unit name="main">
<provider>org.datanucleus.api.jpa.PersistenceProviderImpl</provider>
<mapping-file>/META-INF/user.xml</mapping-file>
<properties>
<property name="datanucleus.NontransactionalRead" value="true"/>
<property name="datanucleus.NontransactionalWrite" value="true"/>
<property name="datanucleus.ConnectionURL" value="appengine"/>
<!--property name="datanucleus.appengine.datastoreReadConsistency" value="EVENTUAL" /-->
<!--property name="javax.persistence.query.timeout" value="5000" /-->
<!--property name="datanucleus.datastoreWriteTimeout" value="10000" /-->
<property name="datanucleus.singletonEMFForName" value="true"/>
</properties>
</persistence-unit>
The dependencies in my POM are: com.google.appengine appengine-api-1.0-sdk ${appengine.target.version}
..
<!-- Persistence APIs -->
<dependency> <!-- why do I need this if I am using JPA? -->
<groupId>javax.jdo</groupId>
<artifactId>jdo-api</artifactId>
<version>3.0.1</version>
</dependency>
<dependency>
<groupId>org.eclipse.persistence</groupId>
<artifactId>javax.persistence</artifactId>
<version>2.1.0</version>
</dependency>
<dependency>
<groupId>org.datanucleus</groupId>
<artifactId>datanucleus-core</artifactId>
<version>[3.2.0, 3.2.99)</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.datanucleus</groupId>
<artifactId>datanucleus-api-jpa</artifactId>
<version>[3.3.0-release, 3.3.99)</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.datanucleus</groupId>
<artifactId>datanucleus-rdbms</artifactId>
<version>[3.2.0, 3.2.99)</version>
<scope>runtime</scope>
</dependency>
</dependencies>
And the datanucleus-plugin is:
<plugin>
<groupId>org.datanucleus</groupId>
<artifactId>datanucleus-maven-plugin</artifactId>
<version>3.3.0-release</version>
<configuration>
<api>JPA</api>
<persistenceUnitName>main</persistenceUnitName>
<verbose>true</verbose>
</configuration>
<executions>
<execution>
<phase>process-classes</phase>
<goals>
<goal>enhance</goal>
</goals>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>org.datanucleus</groupId>
<artifactId>datanucleus-core</artifactId>
<version>[3.2.0, 3.2.99)</version>
</dependency>
<dependency>
<groupId>org.datanucleus</groupId>
<artifactId>datanucleus-api-jpa</artifactId>
<version>[3.3.0-release, 3.3.99)</version>
</dependency>
</dependencies>
</plugin>
Upvotes: 1
Views: 1877
Reputation: 11531
If you're persisting to an RDBMS (as opposed to GAE/Datastore) then perhaps follow their documentation for the URL http://www.datanucleus.org/products/accessplatform/datastores/rdbms.html
If you're persisting to GAE/Datastore, then you remove "datanucleus-rdbms" from your CLASSPATH and add com.google.appengine.orm "datanucleus-appengine". And pay attention to the compatibility doc at https://code.google.com/p/datanucleus-appengine/wiki/Compatibility which says you cannot use DataNucleus 3.2/3.3 unless you use a manually built (unreleased) version of datanucleus-appengine from Google's SVN
Upvotes: 3