我正在尝试使用带有App Engine的JDO和Maven配置创建一个简单的测试。
我的编译和数据增强步骤成功。但是在运行时(mvn:test和appengine:devserver)我得到:
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.
但是,我的classpath(target / demo / WEB-INF / lib)确实包含:datanucleus-appengine-2.1.1.jar
我的依赖关系与Google datanucleus项目的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>
感谢任何建议。
RB
答案 0 :(得分:7)
我现在一切都在工作。我以为我会分享一些问题(因为我花了几天时间来完成所有这些工作):
1)。所有版本都很重要(特别是将App Engine ORM 2.1.1与DataNucleus 3.1.1相匹配 - 包括插件)。
http://www.datanucleus.org/products/accessplatform_3_2/datastores/appengine.html
这是我最终的结果:
<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)。检查datanucleus.log的尾部以确认您的类已增强(通过mvn datanucleus:enhance)。我终于意识到我的测试类(在src / test中)被忽略了。
答案 1 :(得分:0)
我在pom.xml中添加了 false ,它适用于我
<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>