4

运行我的 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
4

2 回答 2

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>
于 2014-01-09T22:09:27.570 回答
-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 的两个版本(因此类的重复)

于 2013-08-02T13:41:55.003 回答