This entry describes how easy it is to get your Jersey web application running on Google App Engine.

For the illustration purpose lets see how we can deploy the simple Helloworld-Webapp Jersey sample on the Google App Engine.

Simple Steps:

  1. Download Google App Engine.
  2. Follow the installation instructions for installing the app engine on your machine. It isn't really too much work, just unzip the bundle, and add its bin directory to your path.
  3. Download the Jersey helloworld-webapp sample, if you do not already have it.
  4. Create an XML file named appengine-web.xml, under WEB-INF parallel to the deployment descriptor web.xml. Google App Engine requires this file in the webapp's WEB-INF directory, for it to be able to run the application.
  5. Copy the following content to the created appengine-web.xml file:
    <?xml version="1.0" encoding="utf-8"?>
    <appengine-web-app xmlns="http://appengine.google.com/ns/1.0">
        <application></application>
        <version>1</version>
    </appengine-web-app>
    
  6. Package the application using: mvn clean package -Dmaven.test.skip=true
  7. Deploy the application on Google App Engine using the command: dev_appserver.sh target/helloworld-webapp
  8. You will see the message which says server is running at http://localhost:8080/.
  9. In a web browser enter http://localhost:8080/helloworld. You see the application running.
That's it. You got the Jersey application running on Google App Engine :)



Comments:

Note that while you can run a Jersey web app in the local dev environment, it will not run "completely" on the real Google App Engine environment due to security restrictions. Plans are underway to make Jersey more compliant with GAE (> version 1.0.3), but when I tried last week, the current snapshot (1.1.1) still had complications. There is a hack to make Jersey run on GAE (http://lqd.hybird.org/journal/?p=123), but not a complete solution.

Posted by Elliot Smith on May 27, 2009 at 03:35 PM PDT #

Thanks Elliot.

I realized only later that there's some problem when we deploy the app on GAE. It seems its because of the sandboxing which they are using.

At a recent conference, I spoke to a couple of the GAE engineers, and they said they are working on a solution for such problems. Lets see if they come up with a solution soon.

Posted by Naresh on June 07, 2009 at 11:01 PM PDT #

I really hope they (GAE engineers) come up with a solution soon... as Jersey seems to be the nicest Java REST framework.

Posted by JP Richardson on June 29, 2009 at 05:48 PM PDT #

Looks like its going to take some time before the solution comes from GAE.
However, someone has been successful in finding a hack for getting the Jersey apps running on GAE. Please refer http://lqd.hybird.org/journal/?p=123

Posted by Naresh on July 08, 2009 at 11:02 PM PDT #

Post a Comment:
  • HTML Syntax: NOT allowed

This blog copyright 2009 by Naresh