Google App Engine + JAX-RS Jersey

This is a “how to” mini tutorial for running JAX-RS Jersey on Google App Engine Java environment.

Sandbox Environment:
Operating System:        Windows Vista
Integrated Development Environment: Eclipse Galileo

Setting up:

Start a Google App Engine project from Eclipse. Download Jersey 1.1.5-ea-SNAPSHOT from here . Explode the zip into a local folder. Grab the following jars and put them into GAEJ project’s /war/WEB-INF/lib folder.


Following user-guide.pdf create a resource class as follow. You can download the Jersey user guide from here.

package com.dclonline.jerseytest;


//The Java class will be hosted at the URI path "/helloworld"
public class HelloWorldResources {

	// The Java method will process HTTP GET requests
	// The Java method will produce content identified by the MIME Media
	// type "text/plain"
	public String getClichedMessage() {
		// Return some cliched textual content
		return "Hello World";


Edit web.xml as follow.

<?xml version="1.0" encoding="utf-8"?>
<web-app xmlns:xsi=""
xsi:schemaLocation="" version="2.5">
        <servlet-name>Jersey Web Application</servlet-name>
        <servlet-name>Jersey Web Application</servlet-name>

Test the service

After deployment to Google App Engine you can test the Hello World service using the following url.

http://<your google app engine app id>

A live link can be found here


  1. Razan Paul says:


  2. Ahmed says:

    Worked like a charm! Thanks Iqbal!

  3. Chris Pilsworth says:

    Thanks, this came in very helpful.

  4. Anish Sneh says:

    Great initiative for REST on GAE…
    Stay tuned… 🙂

  5. sairn says:

    Could you possibly provide a directory structure?

    While I’m certain that the example will work, I cannot determine where your sample code fits in to the standard eclipse “greeting” gwt code example.

    I am attempting to reconstitute your example using a gwt maven project with tomcat.


  6. sairn says:

    Please ignore my earlier post.
    –I too quickly assumed/hoped — i.e., after seeing the GAE reference — that you were demontrating using GWT and Jersey together, as I’ve been researching how this is done. Thx, s

  7. E says:

    I am new in Java and GAE. Can you please upload your project-files somewhere? (github, fileshare, dropbox)

    I cant get this to work. Do I need a pom?
    Please expand the blog post with more info

  8. ibsta says:


    I understand that there were some problems running Jersey under Google’s App Engine. Specifically some problems with the JAX B package that Jersey uses.

    do you you know if this is still the case?

    I am trying to make a decision about which rest API to use at the moment


    • iqbalyusuf says:

      I haven’t been playing with GAE and JAX-RS for a while. From reading GAEJ forum I do see people some time complaining about JAXB problem. However there are other XML serialization libraries (i.e. Simple XML) that seems to work just fine.

  9. Joseph says:

    Thanks for the post. It helped get me started!!!

  10. riaz says:

    Thank you very much!!!!!!
    I was really stuck with this for around 4 days.
    Thanks to you, you made my day.

  11. Very nice and simple. Easy to understand

  12. Michele says:

    Finally a working example =)
    Thanks a lot!

  13. Peter says:

    Lovely piece of tutorial. Simple & straight-forward.

  14. Sakey says:

    Haha, been searching sth like this for 2 week.
    It really help.

  15. Could someone please upload his project?
    I keep getting the 500 server error problem…

Leave a Reply

Your email address will not be published. Required fields are marked *