2011-08-03 66 views
0

我正在嘗試使用datanucleus作爲GAE的JPA提供程序。這是我pom.xml(一部分):DataNucleus 3.0.0-release需要哪些依賴項?

<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?

+0

你是指它從哪裏引用?從你沒有從CLASSPATH中刪除的DataNucleus 1.x jar文件 – DataNucleus

+0

實際上,在你的類路徑中,你有一個「com.google.appengine.orm」v1.0.8,Google的文檔非常清楚地陳述了它將與DataNucleus 1 .x ...這是它支持的所有。 GAE/J SVN的代碼可以與DataNucleus 3.x一起使用 – DataNucleus

回答

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

+1

不,你不知道。那是DataNucleus 2.x – DataNucleus

+0

好吧,我可能是錯的。但是請提供正確的解決方案給提出問題的人。 – cheekoo

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> 
1

Official Link For Maven

將提供所需的信息。如果沒有,請在此處提及@DataNucleus可以在此類事件中更新網站。

相關問題