scheglov / google-plugin-for-eclipse

Automatically exported from code.google.com/p/google-plugin-for-eclipse
Eclipse Public License 1.0
0 stars 3 forks source link

Plugin (Bundle) "org.datanucleus" is already registered #200

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Take the first five steps of issue 116 (source code updated to match this 
test case), 
https://code.google.com/p/google-plugin-for-eclipse/issues/detail?id=116
2. Run as junit test the method, 
cn.renfeng.fourhour.server.ArtistServiceImplTest.test()

What is the expected output? What do you see instead?
The expected output is a success. Rather than the failure trace. See below for 
the full stack trace.

What version of the product are you using? On what operating system?
$ uname -a
Linux dreadnought 3.2.0-23-generic #36-Ubuntu SMP Tue Apr 10 20:39:51 UTC 2012 
x86_64 x86_64 x86_64 GNU/Linux

Please provide any additional information below.
A nasty work around is to remove app engine sdk from java build path during 
junit test. Run mvn datanucleus:enhance, and junit test will succeed.

Now, it's an error for the project

The App Engine SDK 
'/home/renfeng/.m2/repository/com/google/appengine/appengine-api-1.0-sdk/1.7.5/a
ppengine-api-1.0-sdk-1.7.5.jar' on the project's build path is not valid (SDK 
location 
'/home/renfeng/.m2/repository/com/google/appengine/appengine-api-1.0-sdk/1.7.5/a
ppengine-api-1.0-sdk-1.7.5.jar' is not a directory)

To get rid of the error, repeat the steps of 3 and 4 from issue 116.

----
Here is the full stack trace for the junit test.
java.lang.ExceptionInInitializerError
    at cn.renfeng.fourhour.server.ArtistServiceImpl.list(ArtistServiceImpl.java:53)
    at cn.renfeng.fourhour.server.ArtistServiceImplTest.test(ArtistServiceImplTest.java:28)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:616)
    at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)
    at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
    at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
    at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
    at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
    at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
    at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
    at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
    at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
    at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
    at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
    at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
    at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:49)
    at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
Caused by: javax.jdo.JDOFatalUserException: A property named 
javax.jdo.PersistenceManagerFactoryClass must be specified, or a jar file with 
a META-INF/services/javax.jdo.PersistenceManagerFactory entry must be in the 
classpath, or a property named javax.jdo.option.PersistenceUnitName must be 
specified.
NestedThrowables:
javax.jdo.JDOFatalInternalException: Unexpected exception caught.
NestedThrowables:
java.lang.reflect.InvocationTargetException
javax.jdo.JDOFatalInternalException: Unexpected exception caught.
NestedThrowables:
java.lang.reflect.InvocationTargetException
    at javax.jdo.JDOHelper.getPersistenceManagerFactory(JDOHelper.java:861)
    at javax.jdo.JDOHelper.getPersistenceManagerFactory(JDOHelper.java:1093)
    at javax.jdo.JDOHelper.getPersistenceManagerFactory(JDOHelper.java:919)
    at cn.renfeng.fourhour.server.PersistenceService.<clinit>(PersistenceService.java:9)
    ... 27 more
Caused by: javax.jdo.JDOFatalInternalException: Unexpected exception caught.
NestedThrowables:
java.lang.reflect.InvocationTargetException
    at javax.jdo.JDOHelper.invokeGetPersistenceManagerFactoryOnImplementation(JDOHelper.java:1193)
    at javax.jdo.JDOHelper.getPersistenceManagerFactory(JDOHelper.java:844)
    ... 30 more
Caused by: java.lang.reflect.InvocationTargetException
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:616)
    at javax.jdo.JDOHelper$16.run(JDOHelper.java:1965)
    at java.security.AccessController.doPrivileged(Native Method)
    at javax.jdo.JDOHelper.invoke(JDOHelper.java:1960)
    at javax.jdo.JDOHelper.invokeGetPersistenceManagerFactoryOnImplementation(JDOHelper.java:1166)
    ... 31 more
Caused by: org.datanucleus.exceptions.NucleusException: Plugin (Bundle) 
"org.datanucleus" is already registered. Ensure you dont have multiple JAR 
versions of the same plugin in the classpath. The URL 
"file:/home/renfeng/.m2/repository/org/datanucleus/datanucleus-core/3.1.3/datanu
cleus-core-3.1.3.jar" is already registered, and you are trying to register an 
identical plugin located at URL 
"file:/opt/appengine-java-sdk-1.7.5/lib/opt/user/datanucleus/v2/datanucleus-core
-3.1.3.jar."
    at org.datanucleus.plugin.NonManagedPluginRegistry.registerBundle(NonManagedPluginRegistry.java:541)
    at org.datanucleus.plugin.NonManagedPluginRegistry.registerBundle(NonManagedPluginRegistry.java:395)
    at org.datanucleus.plugin.NonManagedPluginRegistry.registerExtensions(NonManagedPluginRegistry.java:219)
    at org.datanucleus.plugin.NonManagedPluginRegistry.registerExtensionPoints(NonManagedPluginRegistry.java:160)
    at org.datanucleus.plugin.PluginManager.<init>(PluginManager.java:65)
    at org.datanucleus.plugin.PluginManager.createPluginManager(PluginManager.java:427)
    at org.datanucleus.NucleusContext.<init>(NucleusContext.java:224)
    at org.datanucleus.NucleusContext.<init>(NucleusContext.java:204)
    at org.datanucleus.NucleusContext.<init>(NucleusContext.java:182)
    at org.datanucleus.api.jdo.JDOPersistenceManagerFactory.<init>(JDOPersistenceManagerFactory.java:409)
    at org.datanucleus.api.jdo.JDOPersistenceManagerFactory.createPersistenceManagerFactory(JDOPersistenceManagerFactory.java:294)
    at org.datanucleus.api.jdo.JDOPersistenceManagerFactory.getPersistenceManagerFactory(JDOPersistenceManagerFactory.java:195)
    ... 39 more

Original issue reported on code.google.com by renfeng...@gmail.com on 11 May 2013 at 1:00

GoogleCodeExporter commented 9 years ago
Here is a screenshot of app engine settings when you see the error caused by 
remove app engine sdk from java build path.

Original comment by renfeng...@gmail.com on 11 May 2013 at 1:02

Attachments:

GoogleCodeExporter commented 9 years ago
I don't use app engine but I got something similar using just datanucleus.  It 
was caused by the DataNucleus enhancer plugin depending on a different version 
of datanucleus-core than the project was using.  Since the enhancer was pulling 
in a different version, it caused two versions of datanucleus-core to be in the 
classpath and due to datanucleus's plugin architecture, it was seeing to 
plugins with the same signature registering.

I fixed it by forcing the enhancer plugin to use the same dependency the 
project was using.

Here is relevant section of my (current) POM.  The forced dependency is now 
commented out since all versions align.  Previously, I was using a 3.x.x 
version of the enhancer but 4.0.0-release in the project.  At least that's what 
I think was the case (YMMV).

        <plugin>
            <groupId>org.datanucleus</groupId>
            <artifactId>datanucleus-maven-plugin</artifactId>
            <version>4.0.0-release</version>
            <configuration>
               <api>JDO</api>
               <props>${basedir}/datanucleus-maven-plugin-jdo.properties</props>
               <outputFile>schema.ddl</outputFile>
               <completeDdl>true</completeDdl>
               <log4jConfiguration>${basedir}/datanucleus-maven-plugin-log4j.properties</log4jConfiguration>
               <verbose>true</verbose>
               <fork>true</fork>
            </configuration>
            <executions>
               <execution>
                  <phase>process-classes</phase>
                  <goals>
                     <goal>enhance</goal>
                  </goals>
               </execution>
            </executions>
<!--                <dependencies> -->
<!--                <dependency> -->
<!--                <groupId>org.datanucleus</groupId> -->
<!--                <artifactId>datanucleus-core</artifactId> -->
<!--                <version>4.0.0-release</version> -->
<!--                </dependency> -->
<!--                </dependencies> -->
         </plugin>

Original comment by wgtthomp...@gmail.com on 5 Nov 2014 at 10:14