Problem with Google AppEngine and Jersey with Java

I recently came across a significant problem with Google AppEngine 1.7.2 and Jersey. Whenever I tried to implement my Webservice, I got a 500 error. There was nothing really wrong with the code. So i took a look at the Logs in the Google AppEngine Dashboard and found the following exception:


// //


Uncaught exception from servlet
java.lang.IncompatibleClassChangeError: Implementing class
	at java.lang.ClassLoader.defineClass1(Native Method)
	at java.lang.ClassLoader.defineClass(
	at sun.reflect.GeneratedMethodAccessor5.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(
	at java.lang.reflect.Method.invoke(
	at java.lang.ClassLoader.loadClass(
	at com.sun.jersey.api.core.ScanningResourceConfig.init(
	at com.sun.jersey.api.core.PackagesResourceConfig.init(
	at com.sun.jersey.api.core.PackagesResourceConfig.<init>(
	at com.sun.jersey.api.core.PackagesResourceConfig.<init>(
	at com.sun.jersey.spi.container.servlet.WebComponent.createResourceConfig(
	at com.sun.jersey.spi.container.servlet.WebComponent.createResourceConfig(
	at com.sun.jersey.spi.container.servlet.WebComponent.init(
	at com.sun.jersey.spi.container.servlet.ServletContainer.init(
	at com.sun.jersey.spi.container.servlet.ServletContainer.init(
	at javax.servlet.GenericServlet.init(
	at org.mortbay.jetty.servlet.ServletHolder.initServlet(
	at org.mortbay.jetty.servlet.ServletHolder.doStart(
	at org.mortbay.component.AbstractLifeCycle.start(
	at org.mortbay.jetty.servlet.ServletHandler.initialize(
	at org.mortbay.jetty.servlet.Context.startContext(
	at org.mortbay.jetty.webapp.WebAppContext.startContext(
	at org.mortbay.jetty.handler.ContextHandler.doStart(
	at org.mortbay.jetty.webapp.WebAppContext.doStart(
	at org.mortbay.component.AbstractLifeCycle.start(
This exception is caused by compatibility issues between asm-4.0.jar and asm-3.1.jar. With the new Version of AppEngine, asm-4.0.jar is used and it is not compatible with Jersey, which relies on asm-3.1.jar. To make Jersey still work on GAE 1.7, you have to remove the dependency on asm-4.0.jar.

[widgets_on_pages id=”sb”]

To remove the dependency, simply right-click on the referenced library "asm-4.0.jar", select "Build Path" and click on "Remove from Build Path". You also have to remove the file physically.
However, now that you changed that, you will still run into other problems. Datanucleus 2.0 relies on asm-4.0.jar and now that we removed the dependency, we can't use it any more. Therefore, it is necessary to switch to Version 1.0. You can do this simply by right-clicking on the project - select "Google" - "App Engine Settings". In this dialog, simply switch to Version 1.0 and you are ready to go (again)
Set Datanucelus Version to 1.0 in Eclipse for AppEngine
Set Datanucelus Version to 1.0 in Eclipse for AppEngine

Published by

Mario Meir-Huber

I work as Principal for Data & Analytics at A1 Telekom Austria Group. I also teach this topic at various universities and frequently speak at various Conferences. In 2010 I wrote a book about Cloud Computing, which is often used at German & Austrian Universities. In my home country (Austria) I am part of several organisations on Big Data & Data Science.

One thought on “Problem with Google AppEngine and Jersey with Java”

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s