2

我正在尝试通过 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
4

2 回答 2

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>

我希望它能帮助有同样问题的人。

于 2013-10-22T18:07:51.173 回答
1

在此处检查 GAE 依赖项 https://code.google.com/p/datanucleus-appengine/wiki/Compatibility 您可能正在使用一些不兼容的版本。

于 2013-10-22T05:49:06.630 回答