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
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(
at sun.reflect.DelegatingMethodAccessorImpl.invoke(
at java.lang.reflect.Method.invoke(
... 2 more
Caused by: org.datanucleus.exceptions.NucleusException: Plugin (Bundle) "" 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/" 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/"
at org.datanucleus.plugin.NonManagedPluginRegistry.registerBundle(
at org.datanucleus.plugin.NonManagedPluginRegistry.registerBundle(
at org.datanucleus.plugin.NonManagedPluginRegistry.registerExtensions(
at org.datanucleus.plugin.NonManagedPluginRegistry.registerExtensionPoints(
at org.datanucleus.plugin.PluginManager.registerExtensionPoints(
at org.datanucleus.OMFContext.<init>(
at org.datanucleus.enhancer.DataNucleusEnhancer.<init>(
at org.datanucleus.enhancer.DataNucleusEnhancer.<init>(
at org.datanucleus.enhancer.DataNucleusEnhancer.main(
... 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: