Eclipse + Google AppEngine + Vaadin

I’m not very good at setting up initial environments. I previously managed to get Google App Engine working by itself went through their tutorials all of that. But I’m stuck trying to get Vaadin and Google App Engine working together.

I’ve installed the newest version of Eclipse EE (Juno) as found on the Eclipse web site, and was following the Vaadin’s
Google App Engine instructions
.

I did deviate by installing tomcat and adding it to my servers in Eclipse. I did this in order to specify a target runtime, as part of step one of the
Google App Engine instructions
which linked to
this page
.

Once I completed all of the instructions I had the problem listed at the bottom of the page: “The App Engine SDK ‘C:<workspace path><project name>\war’ on the project’s build path is not valid”. I followed the instructions to fix that.

After this I attempted to run the application locally as a Google Web Application and had the following problem:

SEVERE: Received exception processing C: ..\war\WEB-INF/appengine-web.xml
com.google.apphosting.utils.config.AppEngineConfigException: appengine-web.xml does not contain a <threadsafe> element.
See http://code.google.com/appengine/docs/java/config/appconfig.html#Using_Concurrent_Requests for more information.
You probably want to enable concurrent requests.
	at com.google.apphosting.utils.config.AppEngineWebXmlReader.readAppEngineWebXml(AppEngineWebXmlReader.java:79)
	at com.google.apphosting.utils.config.EarHelper.readWebModule(EarHelper.java:130)
	at com.google.appengine.tools.development.AbstractContainerService.loadAppEngineWebXml(AbstractContainerService.java:334)
	at com.google.appengine.tools.development.JettyContainerService.initContext(JettyContainerService.java:160)
	at com.google.appengine.tools.development.AbstractContainerService.startup(AbstractContainerService.java:227)
	at com.google.appengine.tools.development.DevAppServerImpl.start(DevAppServerImpl.java:157)
	at com.google.appengine.tools.development.DevAppServerMain$StartAction.apply(DevAppServerMain.java:333)
	at com.google.appengine.tools.util.Parser$ParseResult.applyArgs(Parser.java:48)
	at com.google.appengine.tools.development.DevAppServerMain.<init>(DevAppServerMain.java:269)
	at com.google.appengine.tools.development.DevAppServerMain.main(DevAppServerMain.java:245)
com.google.apphosting.utils.config.AppEngineConfigException: Invalid appengine-web.xml(C: ...\war\WEB-INF/appengine-web.xml) - appengine-web.xml does not contain a <threadsafe> element.
See http://code.google.com/appengine/docs/java/config/appconfig.html#Using_Concurrent_Requests for more information.
You probably want to enable concurrent requests.
	at com.google.apphosting.utils.config.EarHelper.readWebModule(EarHelper.java:132)
	at com.google.appengine.tools.development.AbstractContainerService.loadAppEngineWebXml(AbstractContainerService.java:334)
	at com.google.appengine.tools.development.JettyContainerService.initContext(JettyContainerService.java:160)
	at com.google.appengine.tools.development.AbstractContainerService.startup(AbstractContainerService.java:227)
	at com.google.appengine.tools.development.DevAppServerImpl.start(DevAppServerImpl.java:157)
	at com.google.appengine.tools.development.DevAppServerMain$StartAction.apply(DevAppServerMain.java:333)
	at com.google.appengine.tools.util.Parser$ParseResult.applyArgs(Parser.java:48)
	at com.google.appengine.tools.development.DevAppServerMain.<init>(DevAppServerMain.java:269)
	at com.google.appengine.tools.development.DevAppServerMain.main(DevAppServerMain.java:245)

I added the following to appengine-web.xml:

<threadsafe>true</threadsafe>

Running it again I encountered:

com.google.apphosting.utils.jetty.JettyLogger warn
WARNING: EXCEPTION 
java.lang.ClassNotFoundException: com.vaadin.server.GAEVaadinServlet
	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 com.google.appengine.tools.development.IsolatedAppClassLoader.loadClass(IsolatedAppClassLoader.java:213)
	at java.lang.ClassLoader.loadClass(Unknown Source)
	at org.mortbay.util.Loader.loadClass(Loader.java:91)
	at org.mortbay.util.Loader.loadClass(Loader.java:71)
	at org.mortbay.jetty.servlet.Holder.doStart(Holder.java:73)
	at org.mortbay.jetty.servlet.ServletHolder.doStart(ServletHolder.java:242)
	at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
	at org.mortbay.jetty.servlet.ServletHandler.initialize(ServletHandler.java:685)
	at org.mortbay.jetty.servlet.Context.startContext(Context.java:140)
	at org.mortbay.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1250)
	at org.mortbay.jetty.handler.ContextHandler.doStart(ContextHandler.java:517)
	at org.mortbay.jetty.webapp.WebAppContext.doStart(WebAppContext.java:467)
	at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
	at org.mortbay.jetty.handler.HandlerWrapper.doStart(HandlerWrapper.java:130)
	at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
	at org.mortbay.jetty.handler.HandlerWrapper.doStart(HandlerWrapper.java:130)
	at org.mortbay.jetty.Server.doStart(Server.java:224)
	at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
	at com.google.appengine.tools.development.JettyContainerService.startContainer(JettyContainerService.java:205)
	at com.google.appengine.tools.development.AbstractContainerService.startup(AbstractContainerService.java:232)
	at com.google.appengine.tools.development.DevAppServerImpl.start(DevAppServerImpl.java:157)
	at com.google.appengine.tools.development.DevAppServerMain$StartAction.apply(DevAppServerMain.java:333)
	at com.google.appengine.tools.util.Parser$ParseResult.applyArgs(Parser.java:48)
	at com.google.appengine.tools.development.DevAppServerMain.<init>(DevAppServerMain.java:269)
	at com.google.appengine.tools.development.DevAppServerMain.main(DevAppServerMain.java:245)
Jan 27, 2013 10:28:15 PM com.google.appengine.tools.development.ApiProxyLocalImpl log
SEVERE: javax.servlet.ServletContext log: unavailable
javax.servlet.UnavailableException: com.vaadin.server.GAEVaadinServlet
	at org.mortbay.jetty.servlet.Holder.doStart(Holder.java:79)
	at org.mortbay.jetty.servlet.ServletHolder.doStart(ServletHolder.java:242)
	at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
	at org.mortbay.jetty.servlet.ServletHandler.initialize(ServletHandler.java:685)
	at org.mortbay.jetty.servlet.Context.startContext(Context.java:140)
	at org.mortbay.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1250)
	at org.mortbay.jetty.handler.ContextHandler.doStart(ContextHandler.java:517)
	at org.mortbay.jetty.webapp.WebAppContext.doStart(WebAppContext.java:467)
	at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
	at org.mortbay.jetty.handler.HandlerWrapper.doStart(HandlerWrapper.java:130)
	at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
	at org.mortbay.jetty.handler.HandlerWrapper.doStart(HandlerWrapper.java:130)
	at org.mortbay.jetty.Server.doStart(Server.java:224)
	at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
	at com.google.appengine.tools.development.JettyContainerService.startContainer(JettyContainerService.java:205)
	at com.google.appengine.tools.development.AbstractContainerService.startup(AbstractContainerService.java:232)
	at com.google.appengine.tools.development.DevAppServerImpl.start(DevAppServerImpl.java:157)
	at com.google.appengine.tools.development.DevAppServerMain$StartAction.apply(DevAppServerMain.java:333)
	at com.google.appengine.tools.util.Parser$ParseResult.applyArgs(Parser.java:48)
	at com.google.appengine.tools.development.DevAppServerMain.<init>(DevAppServerMain.java:269)
	at com.google.appengine.tools.development.DevAppServerMain.main(DevAppServerMain.java:245)

Jan 27, 2013 10:28:15 PM com.google.apphosting.utils.jetty.JettyLogger warn
WARNING: failed Midrash Application: java.lang.NullPointerException
Jan 27, 2013 10:28:15 PM com.google.apphosting.utils.jetty.JettyLogger warn
WARNING: Failed startup of context com.google.appengine.tools.development.DevAppEngineWebAppContext@52639bf1{/,C:\Users\Kevin\workspace\Midrash\war}
java.lang.NullPointerException
	at java.lang.Class.isAssignableFrom(Native Method)
	at org.mortbay.jetty.servlet.ServletHolder.doStart(ServletHolder.java:256)
	at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
	at org.mortbay.jetty.servlet.ServletHandler.initialize(ServletHandler.java:685)
	at org.mortbay.jetty.servlet.Context.startContext(Context.java:140)
	at org.mortbay.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1250)
	at org.mortbay.jetty.handler.ContextHandler.doStart(ContextHandler.java:517)
	at org.mortbay.jetty.webapp.WebAppContext.doStart(WebAppContext.java:467)
	at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
	at org.mortbay.jetty.handler.HandlerWrapper.doStart(HandlerWrapper.java:130)
	at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
	at org.mortbay.jetty.handler.HandlerWrapper.doStart(HandlerWrapper.java:130)
	at org.mortbay.jetty.Server.doStart(Server.java:224)
	at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
	at com.google.appengine.tools.development.JettyContainerService.startContainer(JettyContainerService.java:205)
	at com.google.appengine.tools.development.AbstractContainerService.startup(AbstractContainerService.java:232)
	at com.google.appengine.tools.development.DevAppServerImpl.start(DevAppServerImpl.java:157)
	at com.google.appengine.tools.development.DevAppServerMain$StartAction.apply(DevAppServerMain.java:333)
	at com.google.appengine.tools.util.Parser$ParseResult.applyArgs(Parser.java:48)
	at com.google.appengine.tools.development.DevAppServerMain.<init>(DevAppServerMain.java:269)
	at com.google.appengine.tools.development.DevAppServerMain.main(DevAppServerMain.java:245)
Jan 27, 2013 10:28:15 PM com.google.apphosting.utils.jetty.JettyLogger info
INFO: Started SelectChannelConnector@127.0.0.1:8888
Jan 27, 2013 10:28:15 PM com.google.appengine.tools.development.DevAppServerImpl start
INFO: The server is running at http://localhost:8888/
Jan 27, 2013 10:28:15 PM com.google.appengine.tools.development.DevAppServerImpl start
INFO: The admin console is running at http://localhost:8888/_ah/admin

Going to the locally running server all it reports is:

HTTP ERROR: 503
Problem accessing /. Reason: 

    SERVICE_UNAVAILABLE

Sorry for the long post, but I didn’t want to accidentally overlook anything. I’m pretty much stuck here, what am I missing?

I was dealing with this exact same problem for days and dedicated hours of reading forums. I never found the answer written out directly, but I did find enough information to infer that there is some problem with Ivy’s integration with Eclipse. You too may have noticed that Vaadin 6 projects do work – because Ivy isn’t integrated with these projects.

Anyway, the fix:

I’m not sure how this works on a PC, but on my Mac, I manually (using the ‘Go’ menu) opened the /.ivy2/cache folder in my home directory and found a huge selecting of .jars. I copied every single one of them and pasted each one inside the WEB-INF/lib folder. This worked.

I also have the same problem with Vaadin 7. and interestingly as Ben noticed, it works fine with Vaadin 6.

However copying the files from ~/.ivy2/cache///jars/*.jar did not help. Now, i’m getting error with no error description at all… I assume I might have copied to many libraries over.

UPDATE:
the solution i found was that Ivy retrieves the artifacts, instead compiling and running from ~/.ivy2/cache folder (it seems that GAE server is not able to find the libs from ivy.

therefore in Project Properties > Java Build Path > Libraries
I have deleted the Ivy libs and added them new
selected the new Ivy library and pressed the Edit button > in the new IvyDE Managed Libraries window > Classpath
and select the “Enable project specific dependencies”
and select Build the classpath with: “retrieved artifacts”

Retrieve patter: "war/WEB-INF/lib/[artifact]
-[revision]
.[ext]
"
check Delete old artifacts
Types: “jar”
(the last one needs to be jar, otherwise it will also retrieve source and docs and they will conflict with the lib name that you actually want to have.

hope this helps others…
cheers.

Thanks – works great!

I still get an exception that no UIProvider is available when running locally for testing. However, it works fine deploying on GAE. Have you any solution for local running?

sorry, no clue on your UIProvider problem… could it be that you have created a plain Vaadin Application instead of GAE ?

anyhow, this guidance works for me, and i was able to reproduce it mutiple times.

  1. create a vaadin 7 project
    in eclipse:
    • File > New > Other
    • select “Vaadin 7 Project” > Next
    • enter Project Name
    ∘ Target runtime => leave it empty
    ∘ Configuration => Vaadin 7, Java 6, Servlet 2.4 ( since GAE still doesn’t support servlet 3.0, and Java7 is experimental)
    ∘ Deployment configuration => Google App Engine servlet
    ∘ > Next > Next > Next > Finish

  2. Add the following line to war/WEB-INF/appengine-web.xml
    • assure that ‘session-enabled’ is active true
    • add ‘threasafe’ true

  3. fix Project Built-Path
    • right click the project and select Properties
    ∘ select Google > App Engine
    ‣ check “Use Google App Engine”
    ‣ enter “Application ID”
    ‣ enter “Version”
    ‣ select “Datanucleus JDO/JPA version” => v2
    ‣ OK (close the Properties window)
    • right click the project and select Properties
    ∘ select Java Built Path => Libraries
    ‣ select the double entry of “App Engine SDK” > Remove
    ‣ select "ivy.xml [default]
    " > Edit…
    • select Classpath tab
    ∘ check “Enable project specific settings”
    ∘ check “retrieved artifacts”
    ∘ Retrieve pattern => "war/WEB-INF/lib/[artifact]
    -[revision]
    .[ext]
    " (without the quotes)
    ∘ Types => jar
    ∘ Finish (close Edit Library window)
    ∘ select Java Built Path > Order and Export tab
    ‣ set the order accordingly
    • ${project_name}/src
    • ivy.xml [widgetset-compile]

• JRE System Library
• EAR Libraries
• App Engine SDK => this must be above Web App Libraries
• Web App Libraries
• ivy.xml [default]
=> this must be checked

  1. remove strange errors in eclipse
    • open the “Problems” view in eclipse > select Errors > right click on it > Delete
    • to clean up the project, select from the menu Project > Clean…
    ∘ select “Clean projects selected below” > select the Vaadin+GAE project > OK
    this removes all errors from the view and cleans the project, so the project can re-compile it-self. otherwise eclipse will keep asking if you’re sure that you want to debug/run/deploy even with errors

  2. debug/run the application
    right click the project > Debug As > Web Application
    in case any single of the steps should be missing you will receive an error and it won’t work…

  3. smoke test (deploy to GAE)
    right click the project > Google > Deploy to App Engine…

Thanks so much I followed your directions but get a different result in some areas and in the end I still end up with the save exception.

I am using Vaadin 7.0.2, App Engine SDK 1.7.5, and JDK1.6.0_37 using Eclipse Juno (with all updates applied). I see the same issue on two different computers running a similar software stack, but one is Windows XP 32-bit and the other is Windows 8 64-bit.

I only have one App Engine SDK entry.

I can delete the errors, but as soon as I do Project->Clean and rebuild the errors reappear. But they don’t prevent me from starting the app.

The project launches locally and appears correct until I do anything that would send info to the server (for example as soon as I click the button in the default template app).

I am stumped about the cause of the problem. Is your environment different?

hi again,
my environment is debian linux 64bit, openjdk 6, eclipse juno JEE edition with all current patches. I have installed the Vaadin and GAE plugins from the MarketPlace since i noticed (was using previously Apatana Studio due to nice Python integration) that Aptana had some quirks.
However this actually should create any different odds…

I have seen that Vaadin 7.0.3 is out today, maybe this would fix it…

btw: what is your exact error output?

sorry, can’t be more helpful since i’m also a newbie…

I’ll give the new release a try. I started another tread with the stack trace:
GAE UIProvider Exception Forum Post

i just found this video on youtube, might be another hint:
https://www.youtube.com/watch?v=oTAK-NGs9ng

Mar 14, 2013 2:21:02 PM com.vaadin.server.DefaultErrorHandler doDefault
SEVERE:
javax.servlet.ServletException: No UIProvider returned a UI for the request.
    at com.vaadin.server.VaadinServlet.service(VaadinServlet.java:312)

also isn’t this due that the vaadin libraries are not packaged/copied by IvyDE to
war/WEB-INF/lib
?
on project, right click > Ivy > Clean All Cache
and
on project, right click > Ivy > Resolve
might help to fix this.

btw: these are the libs that are in my war/WEB-INF/lib folder:

appengine-api-1.0-sdk-1.7.5.jar
appengine-api-labs.jar
appengine-endpoints.jar
appengine-jsr107cache-1.7.5.jar
asm-4.0.jar
commons-cli-1.2.jar
commons-jexl-2.1.1.jar
commons-logging-1.1.1.jar
cssparser-0.9.5.jar
datanucleus-api-jdo-3.1.3.jar
datanucleus-api-jpa-3.1.3.jar
datanucleus-appengine-2.1.2.jar
datanucleus-core-3.1.3.jar
geronimo-jpa_2.0_spec-1.0.jar
jdo-api-3.0.1.jar
jsoup-1.6.3.jar
jsr107cache-1.1.jar
jta-1.1.jar
sac-1.3.jar
vaadin-client-7.0.2.jar
vaadin-client-compiled-7.0.2.jar
vaadin-server-7.0.2.jar
vaadin-shared-7.0.2.jar
vaadin-shared-deps-1.0.2.jar
vaadin-theme-compiler-7.0.2.jar
vaadin-themes-7.0.2.jar
validation-api-1.0.0.GA.jar

Thanks. I have seen that video before. As I mentioned I can deploy the app and it seems to work OK.

The exception seem to occur only when I try to run as a web application from eclipse. In the case of the default Vaadin template app with the Button (“Click Me”) all is OK until I click the button. Then I get the exception.

The contents of my lib directory are very similar to yours (not quite the same since I am not using JDO/JPA).

I still don’t see the 7.0.3 build. I hope the problem is in Vaadin. If I create an app engine project using the app engine plugin and run in as a web application that project seems to be OK.

Where did you not see it?

Typically, the replication to Maven Central can take an hour or sometimes even two from release, but for any new artifacts (not just Vaadin) to show up in Maven search engines can take many hours or even days. Thus, always just try to use the version number if you think it should be there. The artifacts have been in Maven Central a long time already.

Hi, i could deploy to https://macedomain.appspot.com/ but as you click the click me button on a high rate you got a communication problem red alert. How can it be solved ?

Edit: Looks like it was some kind of replication problem, after 1 day of the deploy the communication error is not happening anymore for me.

Yes I see the same Communication Error! I would also like to know how to solve it.

I did solve the UIProvider error on local running by unjarring the themes and widgetset. I also deployed to appengine with the exploded jars and still get the Communication Error.

And also 7.0.3 did show up a couple hours after my previous post.

I’m having problems with the jar files. I get
Encountered a problem: Unexpected exception
in the console window, and directed to a log file. Within the log file the following error is described:

Caused by: org.datanucleus.exceptions.NucleusException: Plugin (Bundle) "org.datanucleus" is already registered. 
Ensure you dont have multiple JAR versions of the same plugin in the classpath. 
The URL "file:/E:/appengine-java-sdk-1.7.6/appengine-java-sdk-1.7.6/lib/opt/tools/datanucleus/v2/datanucleus-core-3.1.3.jar" is already registered, and you are trying to register an identical plugin located at URL "file:/E:/appengine-java-sdk-1.7.6/appengine-java-sdk-1.7.6/lib/opt/user/datanucleus/v1/datanucleus-core-1.1.5.jar."

In a previous forum post I, it’s all getting a little bit blurred, I saw to delete the Web App libraries, but there are jars in there that are not included in the App Engine SDK (I have moved the order in the
order and export
tab about).

How do I overcome this error?

(Is there any body who has got vaadin, eclipse and gae working willing to put a detailed, step-by-step, pictures, the lot, guide together? The vaadin guide does not cut it).

As a follow up to my previous post, I found the youtube vid
Deploy Vaadin 7 Application on Google App Engine
by pixilabs. I get to about 46 seconds but then get,

Client Error (400)
The request is invalid for an unspecified reason.

Has anyone been able to deply vaadin 7.0.3 to the google app engine, and if so how did you do it?

I had the same issue as Kevin above and solved it with a variant of Ben’s solution. I exited Eclipse. I copied all the jars from lib/jars to war\WEB-INF\lib. I deleted lib and the two ivy xml files. I went back to Eclipse which gives an Ivy error. Go to the Ivy menu for the project from the right click menu and remove Ivy dependency management.

It still wouldn’t work until I got the “Order and Export” order right in the Java Build Path. The order that works for me is JRE at the top, followed by GAE SDK, followed by Web App Libraries (which contains the Vaadin jars), EAR Libraries and lastly the projects src.

Unfortunately, I find that when the order matters in the build path, we’ve entered the world of scary Java voodoo. Somehow, when the Vaadin libraries are higher in the order than the GAE SDK, Java can’t get to the GAE classes it needs to run. Possibly there’s some naming conflict in Vaadin 7 (which should be fixed if that indeed is the issue) which blocks Java seeing through to GAE SDK. If that’s not what it is, I have no idea. But for now it works.

I found the solution to this problem:

Eclipse puts the application name in the appengine-web.xml as the name of the project, I changed this so … is the application name as defined in google “My Applications”< /application>.