DataNucleus 3.0.0版本需要哪些依赖项?

时间:2011-08-03 22:02:38

标签: java jpa google-cloud-datastore datanucleus

我正在尝试将datanucleus用作GAE的JPA提供程序。这是我的pom.xml(部分内容):

<dependency>
  <groupId>org.apache.geronimo.specs</groupId>
  <artifactId>geronimo-jpa_2.0_spec</artifactId>
  <version>1.1</version>
</dependency>
<dependency>
  <groupId>org.apache.geronimo.specs</groupId>
  <artifactId>geronimo-jta_1.1_spec</artifactId>
  <version>1.1.1</version> 
</dependency>
<dependency>
  <groupId>org.datanucleus</groupId>
  <artifactId>datanucleus-api-jpa</artifactId>
  <version>3.0.0-release</version>
</dependency>
<dependency>
  <groupId>org.datanucleus</groupId>
  <artifactId>datanucleus-core</artifactId>
  <version>3.0.0-release</version>
</dependency>
<dependency>
  <groupId>org.datanucleus</groupId>
  <artifactId>datanucleus-rdbms</artifactId>
  <version>3.0.0-release</version>
</dependency>
<dependency>
  <groupId>com.google.appengine.orm</groupId>
  <artifactId>datanucleus-appengine</artifactId>
  <version>1.0.8</version>
</dependency>

在运行时抛出类查找异常:

java.lang.NoClassDefFoundError: org/datanucleus/jpa/exceptions/NoPersistenceXmlException
at java.lang.Class.getDeclaredConstructors0(Native Method)
at java.lang.Class.privateGetDeclaredConstructors(Class.java:2389)
at java.lang.Class.getConstructor0(Class.java:2699)
at java.lang.Class.newInstance0(Class.java:326)
at java.lang.Class.newInstance(Class.java:308)
at org.apache.geronimo.osgi.locator.ProviderLocator.getServices(ProviderLocator.java:319)
at javax.persistence.spi.PersistenceProviderResolverHolder$DefaultPersistenceProviderResolver.getPersistenceProviders(PersistenceProviderResolverHolder.java:108)
at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:91)
at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:72)
...

org.datanucleus.jpa.exceptions.NoPersistenceXmlException班级位于何处?我错过了什么JAR?

3 个答案:

答案 0 :(得分:1)

Official Link For Maven

会提供所需的信息。如果没有,请在此提及,因为@DataNucleus可以在这样的事件中更新网站。

答案 1 :(得分:0)

你需要

<dependency>
  <groupId>org.datanucleus</groupId>
  <artifactId>datanucleus-jpa</artifactId>
  <version>2.1.8</version>
</dependency>

Source

另外,请注意它有
Geronimo的jpa_2.0_spec
DataNucleus将核
geronimo-validation_1.0_spec

答案 2 :(得分:0)

这是它的工作原理(它是datanucleus 1.x,这是与GAE一起使用的最高版本):

    <dependency>
        <groupId>org.apache.geronimo.specs</groupId>
        <artifactId>geronimo-jpa_3.0_spec</artifactId>
        <version>1.1.1</version>
    </dependency>
    <dependency>
        <groupId>org.datanucleus</groupId>
        <artifactId>datanucleus-jpa</artifactId>
        <version>1.1.5</version>
        <scope>runtime</scope>
    </dependency>
    <dependency>
        <groupId>org.datanucleus</groupId>
        <artifactId>datanucleus-core</artifactId>
        <version>1.1.5</version>
        <scope>runtime</scope>
    </dependency>
    <dependency>
        <groupId>org.datanucleus</groupId>
        <artifactId>datanucleus-rdbms</artifactId>
        <version>1.1.5</version>
        <scope>runtime</scope>
    </dependency>
    <dependency>
        <groupId>javax.jdo</groupId>
        <artifactId>jdo-api</artifactId>
        <version>3.0</version>
        <scope>runtime</scope>
    </dependency>
    <dependency>
        <groupId>com.google.appengine.orm</groupId>
        <artifactId>datanucleus-appengine</artifactId>
        <version>1.0.8</version>
        <scope>runtime</scope>
    </dependency>