App Engine, JDO and Maven. Error on startup
Asked Answered
E

2

5

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

Extinct answered 2/2, 2013 at 8:16 Comment(3)
There may be a conflict with JDO version with datanucleus. change datanucleus-core to 3.0Habituate
@Sabarish, I have tried many version combinations. Starting with those referenced in the App Engine ORM project (i.e., JDO:3.0.1, DataNucleus:[3.1.1,3.2), ORM:2.1.1): code.google.com/p/datanucleus-appengine/source/browse/branches/… JOD/datanucleus conflicts seem to show up earlier in the enhance stage.Extinct
So, this seems to have the right info (very difficult to find from the GAE docs): datanucleus-appengine 2.1.1 requires org.datanucleus 3.1 (and the plugin needs to match also). However, now I have a different build error: "The class "XXX" is not persistable. This means that it either hasnt been enhanced, or that the enhanced version of the file is not in the CLASSPATH". (mvn datanuclues:enhance runs fine). Starting to wade through the prolix and so far unintelligible log file...Extinct
E
7

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.

Extinct answered 2/2, 2013 at 21:26 Comment(2)
code.google.com/p/datanucleus-appengine/wiki/Compatibility defines what versions are needed, in combination with the Maven pom.xml of the various plugins; that is what pom.xml dependencies are for after allCalabria
@rsb: thanks a lot for posting your resulting pom. I was turning crazy by the end. This solved my problems.Spunk
C
0

I have added false in pom.xml and it works for me

<plugins>
            <plugin>
                <groupId>org.datanucleus</groupId>
                <artifactId>maven-datanucleus-plugin</artifactId>
                <version>3.1.2</version>
                <configuration>
                    **<fork>false</fork>**
                    <log4jConfiguration>${basedir}/log4j.properties</log4jConfiguration>
                    <verbose>true</verbose>
                </configuration>
                <executions>
                    <execution>
                        <phase>process-classes</phase>
                        <goals>
                            <goal>enhance</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
Churning answered 10/7, 2014 at 6:8 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.