Friday, October 22, 2010

Configuring Vaadin, GAE, and DataNucleus JDO using Vaadin Eclipse Plugin and Google Eclipse Plugin

The following combination:
  • Vaadin 6.4.6
  • GAE SDK 1.3.8
  • DataNucleus JDO 1.1.5 for Google App Engine (adapter version: 1.0.7)
  • Vaadin Eclipse Plugin 1.2.1
  • Google Plugin for Eclipse 1.3.3
  • Eclipse Helios 3.6SR1
When building a Google App Engine project and your encounter the following error message:

Encountered a problem: Unexpected exception
Please see the logs [/tmp/enhance7599385286098074928.log] for further information.

that log file contains:

java.lang.RuntimeException: Unexpected exception
at com.google.appengine.tools.enhancer.Enhancer.execute(Enhancer.java:59)
at com.google.appengine.tools.enhancer.Enhance.<init>(Enhance.java:60)
at com.google.appengine.tools.enhancer.Enhance.main(Enhance.java:41)
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:57)
... 2 more
Caused by: org.datanucleus.exceptions.NucleusException: Plugin (Bundle) "org.datanucleus.store.appengine" is already registered. Ensure you dont have multiple JAR versions of the same plugin in the classpath. The URL "file:/home/ceefour/Vendor/appengine-java-sdk-1.3.8/lib/user/orm/datanucleus-appengine-1.0.7.final.jar" is already registered, and you are trying to register an identical plugin located at URL "file:/home/ceefour/project/AbisPulsa/abispulsabisnis/war/WEB-INF/lib/datanucleus-appengine-1.0.7.final.jar."
at org.datanucleus.plugin.NonManagedPluginRegistry.registerBundle(NonManagedPluginRegistry.java:434)
at org.datanucleus.plugin.NonManagedPluginRegistry.registerBundle(NonManagedPluginRegistry.java:340)
at org.datanucleus.plugin.NonManagedPluginRegistry.registerExtensions(NonManagedPluginRegistry.java:222)
at org.datanucleus.plugin.NonManagedPluginRegistry.registerExtensionPoints(NonManagedPluginRegistry.java:153)
at org.datanucleus.plugin.PluginManager.registerExtensionPoints(PluginManager.java:82)
at org.datanucleus.OMFContext.<init>(OMFContext.java:160)
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

* * * * * * * *

The Solution to this problem:
  1. Go to Project > Properties > Java Build Path
  2. Remove Web App Libraries
  3. Click Add JARs... , and add your Vaadin JAR from your project's war/WEB-INF/lib

* * * * * * * *

The reason is because Google Plugin for Eclipse copies DataNucleus libraries to war/WEB-INF/lib (which is "Web App Libraries") and itself (the Google App Engine SDK) already contains DataNucleus libraries.

The problem is in how GAE plugin interacts with the standard Eclipse Web Tools Platform (WTP). The Google plugin is designed to work primarily with its own non-WTP projects, and apparently does not handle WTP projects correctly. There is minimal documentation for using the Google plugin in existing projects (such as WTP), but it does not address this issue.

In summary, considering this a Google plugin WTP incompatibility, not a Vaadin plugin specific problem.

For more info see: