Tuesday, May 11, 2010

Using Vaadin with Google App Engine

Under the current situation of misalignment between Google and Vaadin in creating a project in Eclipse, to develop Vaadin applications that would work with Google Plugin for Eclipse, a few minor hurdles need to be jumped over. This tutorial outlines the simple steps that need to be taken to create a Vaadin project in Eclipse that runs on Google App Engine development environment.

Presuming the Google Plugin for Eclipse is already installed, follow the instructions found in http://vaadin.com/eclipse to install the Vaadin Plugin for Eclipse using [Help - Install new software] in Eclipse.

Have you ever wondered why [Install new software] item is found under [Help] menu in Eclipse? The help item is not instructions on how to install new software but actually installing new software. What are the nerds at Eclipse/IBM up to with this deliberate choice of menu structure? Difference between a nerd and a geek: a geek insists on being meticulously precise, whereas a nerd insists on being meticulously imprecise.

After restarting Eclipse (Do you really need to restart Eclipse? Could we just apply changes?), create a new Vaadin project.  You will find Vaadin section listed under the [New] menu item. If it is not within the first page of menu items, you would have to find it under [Other ...].
  • Give the project a name. Let's say you called it Zebra.
  • Set [Vaadin:Deployment configuration] to Google App Engine Servlet.
  • Choose the Vaadin version, or click download to download the latest one. This step may not be necessary because it is one of the causes of the project needing repair - but we have to fill in something no matter how erroneous, to be allowed to complete defining the project.
  • Then complete the rest as best as you can, before clicking [Finish].

Repairing the Vaadin project to use Google App Engine as development server
With a Vaadin project called Zebra,
  • Right-click on project Zebra for [Properties] item.
  • At [Java Build Path - Libraries tab], delete WebApps (under which is found the vaadin jar).
  • At [Google - App Engine] enable [Use Google App Engine] check box and fill the rest the best you could.

And again, voila Viola!

If you don't make these changes, you would encounter ClassNotFoundException when you try to launch the Vaadin Application. The reason being, there is disagreement of some sort between Vaadin and Google plugins on how plugins should build and dispense library references. Vaadin believes we should stick to the Eclipse standard and apparently Google has no vested interest in doing so.


You might also wish to allow OOPHM (browser plug-in debugging code server) to be used with debugging the project:
  • Delete the library references to vaadin downloaded gwt-user.jar and gwt-dev.jar files.
  • Create a new library reference for the vaadin.version.jar found in the WEB-INF/lib folder. If the jar is not found there, place a copy of the jar file there before making the library reference.
  • At [Google - Web Toolkit] enable [Use Google Web Toolkit] check box and fill the rest the best you could.
You should now be able to create a new Vaadin Application in the project from the context menu.

Do you have trouble correlating the term Out of Process Hosted Mode (OOPHM) with anything meaningful? Out of  what process? I think it is JVM-Based Browser Plug-in Hosting the Client-Side Debugging Co-Operand (of the Server-Side Debugger), which would be JVMBBPHtCSCO(oSSD). That's a mouthful. Hence, regardless being less precise, it is easier to say with a punch "Oophm!" Like someone had just punched you at the tummy.



5 comments:

  1. when I run the step: "Repairing the Vaadin project to use the Google App Engine development server" comes the following error:

    "java.lang.NoClassDefFoundError: com / google / appengine / tools / enhancer / Enhance
    Caused by: java.lang.ClassNotFoundException: com.google.appengine.tools.enhancer.Enhance
    at java.net.URLClassLoader $ 1.run (Unknown Source)
    at java.security.AccessController.doPrivileged (Native Method)
    at java.net.URLClassLoader.findClass (Unknown Source)
    at java.lang.ClassLoader.loadClass (Unknown Source)
    at sun.misc.Launcher $ AppClassLoader.loadClass (Unknown Source)
    at java.lang.ClassLoader.loadClass (Unknown Source)
    Exception in thread "main" "

    Any ideas?

    ReplyDelete