DataNucleus / AppEngine - 类路径中同一插件的多个JAR版本

时间:2013-08-02 03:41:01

标签: java google-app-engine datanucleus

运行Java / AppEngine应用程序时在日志文件中发现问题。在哪里查看上述多个JAR版本?

java.lang.RuntimeException: Unexpected exception
    at com.google.appengine.tools.enhancer.Enhancer.execute(Enhancer.java:76)
    at com.google.appengine.tools.enhancer.Enhance.<init>(Enhance.java:71)
    at com.google.appengine.tools.enhancer.Enhance.main(Enhance.java:51)
Caused by: java.lang.reflect.InvocationTargetException
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at com.google.appengine.tools.enhancer.Enhancer.execute(Enhancer.java:74)
    ... 2 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:/opt/appengine-java-sdk-1.8.2/lib/opt/user/datanucleus/v1/datanucleus-core-1.1.5.jar" is already registered, and you are trying to register an identical plugin located at URL "file:/opt/appengine-java-sdk-1.8.2/lib/opt/tools/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.enhancer.DataNucleusEnhancer.<init>(DataNucleusEnhancer.java:160)
    at org.datanucleus.enhancer.DataNucleusEnhancer.main(DataNucleusEnhancer.java:1133)
    ... 7 more

2 个答案:

答案 0 :(得分:0)

我有同样的问题

将相同的datanucleus-core依赖项添加到plugin-config解决了问题:

        <plugin>
            <groupId>org.datanucleus</groupId>
            <artifactId>maven-datanucleus-plugin</artifactId>
            <version>${datanucleus.jpa.version}</version>
            <configuration>
                <api>JPA</api>
                <persistenceUnitName>gae-persistence</persistenceUnitName>
                <!-- <log4jConfiguration>${basedir}/log4j.properties</log4jConfiguration> -->
                <verbose>true</verbose>
            </configuration>
            <dependencies>
                <dependency>
                    <groupId>org.datanucleus</groupId>
                    <artifactId>datanucleus-core</artifactId>
                    <version>${datanucleus.jpa.version}</version>
                </dependency>
            </dependencies>
            <executions>
                <execution>
                    <phase>process-classes</phase>
                    <goals>
                        <goal>enhance</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>

答案 1 :(得分:-2)

邮件内容怎么样?

The URL "file:/opt/appengine-java-sdk-1.8.2/lib/opt/user/datanucleus/v1/datanucleus-core-1.1.5.jar" is already registered, and you are trying to register an identical plugin located at URL "file:/opt/appengine-java-sdk-1.8.2/lib/opt/tools/datanucleus/v2/datanucleus-core-3.1.3.jar.

要避免在CLASSPATH中使用相同jar的两个版本(因此重复类)