Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

App Engine, JDO and Maven. Error on startup

I'm trying to create a simple test using JDO with App Engine and a Maven configuration.

My compile and data enhancement steps succeed. But at runtime (both mvn:test and appengine:devserver) I get:

1) Error in custom provider, javax.jdo.JDOFatalInternalException: 
Class "com.google.appengine.datanucleus.DatastoreManager" was not found in the CLASSPATH.
Please check your specification and your CLASSPATH.

However, my classpath (target/demo/WEB-INF/lib) does contain: datanucleus-appengine-2.1.1.jar

And my dependencies are the same as those specified in the Google datanucleus project's POM:

  <dependency>
    <groupId>javax.jdo</groupId>
    <artifactId>jdo-api</artifactId>
    <version>3.0.1</version>
  </dependency>
  <dependency>
    <groupId>org.datanucleus</groupId>
    <artifactId>datanucleus-core</artifactId>
    <version>[3.1.1, 3.2)</version>
    <scope>runtime</scope>
  </dependency>
  <dependency>
    <groupId>org.datanucleus</groupId>
    <artifactId>datanucleus-api-jdo</artifactId>
    <version>[3.1.1, 3.2)</version>
  </dependency>
  <dependency>
    <groupId>com.google.appengine.orm</groupId>
    <artifactId>datanucleus-appengine</artifactId>
    <version>2.1.1</version>
  </dependency>

Appreciate any suggestions.

RB

like image 365
rsb Avatar asked Feb 02 '13 08:02

rsb


1 Answers

I have everything working now. I thought I'd share a couple of the gotchas (since it took me several days to plough through all of this):

1). All of the versions really matter (esp. matching the App Engine ORM 2.1.1 to DataNucleus 3.1.1 -- including the plugin).

http://www.datanucleus.org/products/accessplatform_3_2/datastores/appengine.html

Here's what I ended up with:

  <dependency>
    <groupId>javax.jdo</groupId>
    <artifactId>jdo-api</artifactId>
    <version>3.0.1</version>
  </dependency>
  <dependency>
    <groupId>org.datanucleus</groupId>
    <artifactId>datanucleus-core</artifactId>
    <version>3.1.1</version>
    <scope>runtime</scope>
  </dependency>
  <dependency>
    <groupId>org.datanucleus</groupId>
    <artifactId>datanucleus-api-jdo</artifactId>
    <version>3.1.2</version>
  </dependency>
  <dependency>
    <groupId>com.google.appengine.orm</groupId>
    <artifactId>datanucleus-appengine</artifactId>
    <version>2.1.2</version>
  </dependency>

  ...

  <plugin>
    <groupId>org.datanucleus</groupId>
    <artifactId>maven-datanucleus-plugin</artifactId>
    <version>3.1.2</version>
    <configuration>
      <log4jConfiguration>${basedir}/log4j.properties</log4jConfiguration>
      <verbose>false</verbose>
      <fork>false</fork>
    </configuration>
    <executions>
      <execution>
        <phase>process-classes</phase>
        <goals>
          <goal>enhance</goal>
        </goals>
      </execution>
    </executions>
  </plugin>

2). Check the tail of the datanucleus.log to confirm that your classes were enhanced (via mvn datanucleus:enhance). I eventually realized that my test classes (in src/test) were being ignored.

like image 62
rsb Avatar answered Sep 27 '22 23:09

rsb