Google App Engine JDO enhancement not working
I am trying to build my first version of Google App Engine WAR and set up my own external (outside of Eclipse) Ant construct to be executed from the terminal. I am trying to get an <enhance_war/>
Ant macro and I am running fancy 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 output from Ant when it tries to execute the target package
:
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
Which ant-macros.xml:95
matches the following line:
<enhance failonerror="true" api="@{api}">
<!-- Rest of the enhance task def -->
</enhance>
So, <enhance />
something is going wrong while doing this task , but I can't figure out what.
And finally, the log file in /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 this is a classpath issue because the class org.datanucleus.plugin.PluginManager
is defined internally datanucleus-core-1.1.5.jar
, which I absolutely have in the assembly classpath . Plus its a NoSuchMethodError
, so I feel like I have a hellish JAR version / version problem. Any ideas?
source to share
You have a different version of datanucleus-core in your classpath which requires an enhancer. Check what the enhancer is using and correcting. See http://code.google.com/p/datanucleus-appengine/wiki/Compatibility for compatibility requirements.
The latest GAE SDK provides the "GAE JDO Plugin" v2.1.1 IIRC, which is the most recent release (although there is still a recently released fwiw) and is present in lib / opt / blahblahblah. This uses DataNucleus v3.1.x. This is what people recommend fighting for. GAE JDO plugin is developed at http://code.google.com/p/datanucleus-appengine/
source to share