我正在嘗試使用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?
你是指它從哪裏引用?從你沒有從CLASSPATH中刪除的DataNucleus 1.x jar文件 – DataNucleus
實際上,在你的類路徑中,你有一個「com.google.appengine.orm」v1.0.8,Google的文檔非常清楚地陳述了它將與DataNucleus 1 .x ...這是它支持的所有。 GAE/J SVN的代碼可以與DataNucleus 3.x一起使用 – DataNucleus