vendredi 18 mars 2011

Starting with atmosphere framework, GWT and Maven under Eclipse

Months ago i was searching for a push solution to integrate to my web applications and I discovered Atmosphere, a nice framework, developed by nice people.

Latest version of Atmosphere is 0.8. Project is growing fast and development is intensive.

In this post, I want to summarize steps I followed to get atmosphere-gwt-demo working.

I use Eclipse Helios (3.6 SR2), I've already Maven plugin installed (m2eclipse), and google-eclipse-plugin (even if this one will not be used for the purpose of this article)

Download atmosphere project:

git clone

Wait few minutes for download to complete then go to eclipse and import the entire project as a maven project.

Fix some maven properties:

Go to atmosphere-gwt-demo, we'll be editing the pom.xml. Locate the declaration of gwt-maven-plugin (see the complete configuration) and add

Without this line, maven will not copy files located under src/main/META-INF/ (Most important atmosphere.xml) and the application will not work.

For more information see:

Install dependencies:

Now, if you try to run the demo, you will get errors. This happens because you didn't install atmosphere runtime dependencies.

For each error (missing class), find its containing sub-project, right click on it -> run as ... -> maven install

Run the demo:

Right click on atmosphere-gwt-demo -> Run as -> Maven build ... and enter in the goal field: gwt:run

Wait few seconds for the embedded jetty server to start and load your application, then open the hosted mode url into your favorite browser (I use Google Chrome with the GWT plugin installed).

Debug atmosphere-gwt-demo

This post shows how to debug a GWT application with the gwt-maven-plugin.

I just changed the port from 8000 to 8001 because for some reason this port was already in use (I think eclipse uses it)

Add the following line to the gwt-maven-plugin configuration in pom.xml of atmosphere-gwt-demo


Right click on atmosphere-gwt-demo->Run As->Maven build ...
In the following dialog, enter "gwt:debug" as goals, save it.

Click on the dropdown of the debug button on the toolbar, select "Debug Configurations".

In the left panel, find “Remote Java Application”, select it and click the icon for "New launch configuration" (top left corner). Accept defaults, save, and close.

Now, you are ready, start the debug server by running the debug launcher we just created. (the one with goal gwt:debug). When you see "Listening for transport dt_socket at address: 8001" in the console output, run the attach launcher we just created (the remote debugger).

Finally, here is the complete gwt-maven-plugin

5 commentaires:

  1. I am getting a 404 error when contacting http://localhost:8888/gwtDemo/gwtComet. any ideas?

  2. May be you should try with:

  3. Ce commentaire a été supprimé par l'auteur.

  4. Thank you for the "copyWebapp" tip!

  5. I've worked through your instructions and it all goes well. But, on running the demo in Chrome I get:

    onModuleLoad() threw an exception
    Exception while loading module org.atmosphere.samples.client.GWTDemo. See Development Mode for details.

    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at Source)
    Caused by: Something other than a boolean was returned from JSNI method '@org.atmosphere.gwt.client.impl.WebSocket::isSupported()': JS value of type JavaScript object(56), expected boolean
    at org.atmosphere.gwt.client.impl.WebSocket$.isSupported(
    at org.atmosphere.gwt.client.impl.WebSocketCometTransport.hasWebSocketSupport(
    at org.atmosphere.gwt.client.AtmosphereClient$CometClientTransportWrapper.(
    at org.atmosphere.gwt.client.AtmosphereClient.(
    at org.atmosphere.gwt.client.AtmosphereClient.(
    at org.atmosphere.samples.client.GWTDemo.initialize(
    at org.atmosphere.samples.client.GWTDemo.onModuleLoad(
    ... 9 more

    Any idea what might have gone wrong?