Google App Engine JDO enhancement is failing

喜欢而已 提交于 2020-04-06 10:50:35

问题


I am trying to build my first Google App Engine WAR and am setting up my own external (outside of Eclipse) Ant build to be executed from the terminal. I'm trying to get the <enhance_war/> Ant macro working and am running into a bizarre NoSuchMethodError.

Here's my Ant target:

<target name="package" depends="gendocs">
    <echo message="Enhancing WAR JDO classes." />
    <enhance_war war="war" />

    <echo message="Packaging the WAR file." />
    <war destfile="gen/dist/myapp.war" webxml="war/web.xml">
        <fileset dir="war">
            <includes name="**/*.xml" />
        </fileset>
        <lib dir="war/WEB-INF/lib" />
        <classes dir="war/WEB-INF/classes" />
    </war>
</target>

Here's the Ant output when it attempts to execute the package target:

package:
     [echo] Enhancing WAR JDO classes.
  [enhance] Encountered a problem: Unexpected exception
  [enhance] Please see the logs [/tmp/enhance4426322586552955387.log] for further information.

BUILD FAILED
/home/myuser/sandbox/workbench/eclipse/workspace/myapp/build/build-local.xml:193: The following error occurred while executing this line:
/home/myuser/sandbox/workbench/google/gae-sdk/1.7.1/appengine-java-sdk-1.7.1/config/user/ant-macros.xml:95: Java returned: 1

That ant-macros.xml:95 corresponds to the following line:

<enhance failonerror="true" api="@{api}">
    <!-- Rest of the enhance task def -->
</enhance>

So something is going wrong while executing this <enhance /> task, but I can't figure out what.

And finally the log file at /tmp/enhance4426322586552955387.log:

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: java.lang.NoSuchMethodError: org.datanucleus.plugin.PluginManager.<init>(Lorg/datanucleus/PersistenceConfiguration;Lorg/datanucleus/ClassLoaderResolver;)V
    at org.datanucleus.OMFContext.<init>(OMFContext.java:159)
    at org.datanucleus.enhancer.DataNucleusEnhancer.<init>(DataNucleusEnhancer.java:172)
    at org.datanucleus.enhancer.DataNucleusEnhancer.<init>(DataNucleusEnhancer.java:150)
    at org.datanucleus.enhancer.DataNucleusEnhancer.main(DataNucleusEnhancer.java:1157)
    ... 7 more

What's going on here? I don't think it's a classpath issue because the org.datanucleus.plugin.PluginManager class is defined inside of datanucleus-core-1.1.5.jar, which I absolutely have on the build classpath. Plus its a NoSuchMethodError, so it makes me feel like I have a JAR hell/versioning issue going on. Any ideas?


回答1:


You have a different version of datanucleus-core in your classpath to what the enhancer requires. Verify what the enhancer is using and fix it. See http://code.google.com/p/datanucleus-appengine/wiki/Compatibility for conpatibility requirements.

The latest GAE SDK provides "GAE JDO plugin" v2.1.1 IIRC, which is the most recent release (though there is more recent not yet released fwiw), and it is present under lib/opt/blahblahblah. This makes use of DataNucleus v3.1.x. This is what people are recommended to run against. The GAE JDO plugin is developed at http://code.google.com/p/datanucleus-appengine/



来源:https://stackoverflow.com/questions/14554774/google-app-engine-jdo-enhancement-is-failing

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!