我正在尝试通过Maven创建GAE项目,我遇到了持久性库配置问题。我尝试包含不同的依赖项并指定不同的范围,但我总是遇到一些错误:
java.lang.NoClassDefFoundError: org/datanucleus/ObjectManagerFactoryImpl
java.lang.NoClassDefFoundError: javax/persistence/spi/ProviderUtil
java.lang.NoClassDefFoundError: org/datanucleus/ClassLoaderResolver
Invocation of init method failed; nested exception is javax.persistence.PersistenceException: No persistence providers available for "transactions-optional" after trying the following discovered implementations: org.datanucleus.api.jpa.PersistenceProviderImpl
答案 0 :(得分:2)
好吧,最终我找到了解决方案:
<!-- Persistence Dependencies -->
<dependency>
<groupId>com.google.appengine.orm</groupId>
<artifactId>datanucleus-appengine</artifactId>
<version>2.1.2</version>
</dependency>
<dependency>
<groupId>javax.jdo</groupId>
<artifactId>jdo-api</artifactId>
<version>3.0.1</version>
</dependency>
<dependency>
<groupId>org.apache.geronimo.specs</groupId>
<artifactId>geronimo-jpa_2.0_spec</artifactId>
<version>1.1</version>
</dependency>
<dependency>
<groupId>org.datanucleus</groupId>
<artifactId>datanucleus-core</artifactId>
<version>[3.1.1, 3.1.99]</version>
</dependency>
<dependency>
<groupId>org.datanucleus</groupId>
<artifactId>datanucleus-api-jpa</artifactId>
<version>[3.1.1, 3.1.99]</version>
</dependency>
<dependency>
<groupId>org.datanucleus</groupId>
<artifactId>datanucleus-jpa-query</artifactId>
<version>3.0.2</version>
</dependency>
我希望它会帮助有同样问题的人。
答案 1 :(得分:1)
在此处查看GAE依赖项 https://code.google.com/p/datanucleus-appengine/wiki/Compatibility 你可能会使用一些不兼容的版本。