google app engine - GAE and JPA persistence exception -


i've created gae 1.8.2 project using jpa 2.0. when try launch junit tests throws following exception:

java.lang.exceptionininitializererror     @ it.bfm.dbutility.dbaccess.<init>(dbaccess.java:10)     @ it.bfm.businesslogic.utenteimpl.<init>(utenteimpl.java:16)     @ it.bfm.test.utentetest.testcreautente(utentetest.java:13)     @ sun.reflect.nativemethodaccessorimpl.invoke0(native method)     @ sun.reflect.nativemethodaccessorimpl.invoke(nativemethodaccessorimpl.java:57)     @ sun.reflect.delegatingmethodaccessorimpl.invoke(delegatingmethodaccessorimpl.java:43)     @ java.lang.reflect.method.invoke(method.java:601)     @ org.junit.runners.model.frameworkmethod$1.runreflectivecall(frameworkmethod.java:47)     @ org.junit.internal.runners.model.reflectivecallable.run(reflectivecallable.java:12)     @ org.junit.runners.model.frameworkmethod.invokeexplosively(frameworkmethod.java:44)     @ org.junit.internal.runners.statements.invokemethod.evaluate(invokemethod.java:17)     @ org.junit.runners.parentrunner.runleaf(parentrunner.java:271)     @ org.junit.runners.blockjunit4classrunner.runchild(blockjunit4classrunner.java:70)     @ org.junit.runners.blockjunit4classrunner.runchild(blockjunit4classrunner.java:50)     @ org.junit.runners.parentrunner$3.run(parentrunner.java:238)     @ org.junit.runners.parentrunner$1.schedule(parentrunner.java:63)     @ org.junit.runners.parentrunner.runchildren(parentrunner.java:236)     @ org.junit.runners.parentrunner.access$000(parentrunner.java:53)     @ org.junit.runners.parentrunner$2.evaluate(parentrunner.java:229)     @ org.junit.runners.parentrunner.run(parentrunner.java:309)     @ org.eclipse.jdt.internal.junit4.runner.junit4testreference.run(junit4testreference.java:50)     @ org.eclipse.jdt.internal.junit.runner.testexecution.run(testexecution.java:38)     @ org.eclipse.jdt.internal.junit.runner.remotetestrunner.runtests(remotetestrunner.java:467)     @ org.eclipse.jdt.internal.junit.runner.remotetestrunner.runtests(remotetestrunner.java:683)     @ org.eclipse.jdt.internal.junit.runner.remotetestrunner.run(remotetestrunner.java:390)     @ org.eclipse.jdt.internal.junit.runner.remotetestrunner.main(remotetestrunner.java:197) caused by: javax.persistence.persistenceexception: explicit persistence provider error(s) occurred "transactions-optional" after trying following discovered implementations: org.datanucleus.api.jpa.persistenceproviderimpl, org.datanucleus.api.jpa.persistenceproviderimpl provider: org.datanucleus.api.jpa.persistenceproviderimpl     @ javax.persistence.persistence.createpersistenceexception(persistence.java:242)     @ javax.persistence.persistence.createentitymanagerfactory(persistence.java:184)     @ javax.persistence.persistence.createentitymanagerfactory(persistence.java:70)     @ it.bfm.dbutility.entitybfmmanager.<clinit>(entitybfmmanager.java:8)     ... 26 more caused by: org.datanucleus.exceptions.nucleusexception: plugin (bundle) "org.datanucleus.api.jpa" registered. ensure dont have multiple jar versions of same plugin in classpath. url "file:/applications/eclipse/plugins/com.google.appengine.eclipse.sdkbundle_1.8.2/appengine-java-sdk-1.8.2/lib/opt/user/datanucleus/v2/datanucleus-api-jpa-3.1.3.jar" registered, , trying register identical plugin located @ url "file:/users/stefano/.m2/repository/org/datanucleus/datanucleus-api-jpa/3.1.3/datanucleus-api-jpa-3.1.3.jar."     @ org.datanucleus.plugin.nonmanagedpluginregistry.registerbundle(nonmanagedpluginregistry.java:541)     @ org.datanucleus.plugin.nonmanagedpluginregistry.registerbundle(nonmanagedpluginregistry.java:395)     @ org.datanucleus.plugin.nonmanagedpluginregistry.registerextensions(nonmanagedpluginregistry.java:219)     @ org.datanucleus.plugin.nonmanagedpluginregistry.registerextensionpoints(nonmanagedpluginregistry.java:160)     @ org.datanucleus.plugin.pluginmanager.<init>(pluginmanager.java:65)     @ org.datanucleus.plugin.pluginmanager.createpluginmanager(pluginmanager.java:427)     @ org.datanucleus.api.jpa.jpaentitymanagerfactory.<init>(jpaentitymanagerfactory.java:328)     @ org.datanucleus.api.jpa.persistenceproviderimpl.createentitymanagerfactory(persistenceproviderimpl.java:91)     @ javax.persistence.persistence.createentitymanagerfactory(persistence.java:150)     ... 28 more 

the persistence.xml this:

<?xml version="1.0" encoding="utf-8" ?> <persistence xmlns="http://java.sun.com/xml/ns/persistence"     xmlns:xsi="http://www.w3.org/2001/xmlschema-instance"     xsi:schemalocation="http://java.sun.com/xml/ns/persistence         http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd" version="1.0">      <persistence-unit name="transactions-optional">         <provider>org.datanucleus.api.jpa.persistenceproviderimpl</provider>         <properties>             <property name="datanucleus.nontransactionalread" value="true"/>             <property name="datanucleus.nontransactionalwrite" value="true"/>             <property name="datanucleus.connectionurl" value="appengine"/>             <property name="datanucleus.singletonemfforname" value="true"/>         </properties>     </persistence-unit> </persistence> 

and pom.xml this:

<project xmlns="http://maven.apache.org/pom/4.0.0" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance"     xsi:schemalocation="http://maven.apache.org/pom/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">     <modelversion>4.0.0</modelversion>     <groupid>it.bfm</groupid>     <artifactid>bfm</artifactid>     <version>0.0.1-snapshot</version>     <packaging>war</packaging>     <dependencies>         <dependency>             <groupid>junit</groupid>             <artifactid>junit</artifactid>             <version>4.11</version>         </dependency>         <dependency>             <groupid>javax</groupid>             <artifactid>javaee-api</artifactid>             <version>7.0</version>         </dependency>         <dependency>             <groupid>com.google.appengine</groupid>             <artifactid>appengine-api-1.0-sdk</artifactid>             <version>1.8.2</version>         </dependency>         <dependency>         <groupid>com.google.appengine.orm</groupid>         <artifactid>datanucleus-appengine</artifactid>         <version>2.1.2</version>         </dependency>         <dependency>         <groupid>org.datanucleus</groupid>         <artifactid>datanucleus-core</artifactid>         <version>3.1.3</version>         <scope>runtime</scope>         </dependency>         <dependency>         <groupid>org.datanucleus</groupid>         <artifactid>datanucleus-api-jpa</artifactid>         <version>3.1.3</version>         </dependency>         <!-- <dependency> -->         <!-- <groupid>org.datanucleus</groupid> -->         <!-- <artifactid>datanucleus-api-jdo</artifactid> -->         <!-- <version>3.1.3</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.0</version>         </dependency>         <dependency>             <groupid>com.google.appengine</groupid>             <artifactid>appengine-jsr107cache</artifactid>             <version>1.8.2</version>         </dependency>         <dependency>             <groupid>com.google.appengine</groupid>             <artifactid>appengine-endpoints</artifactid>             <version>1.8.2</version>         </dependency>         <dependency>             <groupid>net.sf.jsr107cache</groupid>             <artifactid>jsr107cache</artifactid>             <version>1.1</version>         </dependency>     </dependencies>     <build>         <sourcedirectory>${basedir}/src/it/bfm</sourcedirectory>         <testsourcedirectory>${basedir}/src/it/bfm/test</testsourcedirectory>         <outputdirectory>${basedir}/war/web-inf/classes</outputdirectory>         <testoutputdirectory>${basedir}/war/web-inf/test-classes</testoutputdirectory> <!--        <resources> --> <!--            <resource> --> <!--                <directory>${basedir}/src</directory> --> <!--            </resource> --> <!--        </resources> -->         <pluginmanagement>             <plugins>                 <plugin>                     <groupid>org.apache.maven.plugins</groupid>                     <version>3.1</version>                     <artifactid>maven-compiler-plugin</artifactid>                     <configuration>                         <source>1.7</source>                         <target>1.7</target>                     </configuration>                 </plugin>                 <plugin>                     <groupid>org.apache.maven.plugins</groupid>                     <artifactid>maven-war-plugin</artifactid>                     <version>2.3</version>                     <configuration>                         <archiveclasses>true</archiveclasses>                         <webresources>                             <!-- in order interpolate version pom appengine-web.xml -->                             <resource>                                 <directory>${basedir}/war/web-inf</directory>                                 <filtering>true</filtering>                                 <targetpath>web-inf</targetpath>                             </resource>                         </webresources>                     </configuration>                 </plugin>             </plugins>         </pluginmanagement>     </build> </project> 

can me please? thank much.

the error message seems clear

the url "file:/applications/eclipse/plugins/com.google.appengine.eclipse.sdkbundle_1.8.2/appengine-java-sdk-1.8.2/lib/opt/user/datanucleus/v2/datanucleus-api-jpa-3.1.3.jar" registered, , trying register identical plugin located @ url "file:/users/stefano/.m2/repository/org/datanucleus/datanucleus-api-jpa/3.1.3/datanucleus-api-jpa-3.1.3.jar."

so suggest put single version of jar in classpath, otherwise class loading problems.


Comments

Popular posts from this blog

Detect support for Shoutcast ICY MP3 without navigator.userAgent in Firefox? -

web - SVG not rendering properly in Firefox -

java - JavaFX 2 slider labelFormatter not being used -