Posted by: Josh | October 25, 2009

Sun Jersey and Google App Engine 1.2.6

You most likely have come across the following “warning” level log entry in your Google App Engine logs if you’ve been using Sun’s jersey-core 1.0.x jar and the Google App Engine 1.2.6 SDK:

com.sun.jersey.core.spi.component.ProviderFactory __getComponentProvider: The provider class, class com.sun.jersey.core.impl.provider.entity.XMLListElementProvider$App, could not be instantiated. Processing will continue but the class will not be utilized
java.lang.SecurityException: Unable to get members for class com.sun.jersey.core.impl.provider.entity.XMLListElementProvider$App
at java.lang.Class.getMethods(
at com.sun.jersey.core.reflection.MethodList.<init>(
at com.sun.jersey.core.spi.component.ComponentConstructor.getPostConstructMethod(
at com.sun.jersey.core.spi.component.ComponentConstructor.<init>(
at com.sun.jersey.core.spi.component.ProviderFactory.__getComponentProvider(
at com.sun.jersey.core.spi.component.ProviderFactory.getComponentProvider(
at com.sun.jersey.core.spi.component.ProviderServices.getComponent(
at com.sun.jersey.core.spi.component.ProviderServices.getProvidersAndServices(
at com.sun.jersey.core.spi.factory.MessageBodyFactory.getProviderMap(
at com.sun.jersey.core.spi.factory.MessageBodyFactory.initReaders(
at com.sun.jersey.core.spi.factory.MessageBodyFactory.init(
at com.sun.jersey.api.client.Client.<init>(
at com.sun.jersey.api.client.Client.<init>(
at com.sun.jersey.api.client.Client.create(
at com.socialjava.TinyFBClient.<init>(
at com.socialjava.TinyFBClient.<init>(
at com.socialjava.TinyFBClient.<init>(
Pictured: a broken jar.

A broken jar.

… and so on, for a lot longer.

In my case, this was due to the Jersey implementation that goes along side Social Java’s Tiny Facebook Client. The App engine admin panel reports that these exceptions are using up a lot of cpu time per request, which is never a good thing. Here’s how to silence them.



The problem just appears to be related to Google App Engine’s restrictive nature on allowed JRE classes. The following prevents these classes from ever being invoked.

Method 1:

Use this JAR I made. Replace your current implementation of jersey-core.jar with the one I’ve packaged.

Download jersey-core-gae.jar (compiled for Java 1.5) . Full Readme. (change the file extension from .zip to .jar)

Commented out calls to com.sun.jersey.core.reflection.MethodList in the following classes:

Eclipse project SVN link. I extracted the original jersey-core.jar, removed the classes I overrode, and recompiled it as a .jar.


Method 2:

DIY class over-riding. The key is to load the unmodifier .jar first, and then override its implementation with your own.

You might like to do it yourself, if for whatever reason you can’t use method 1. You can keep the original jersey-core.jar in your classpath (/war/WEB-INF/lib), and in your build path (/src) add the package com.sun.jersey.core.spi.component and drop in these 3 java classes.


I’m not sure what the side effects of making it GAE compatible are, but so far, the implementation of Social Java’s Tiny Facebook Client seems to be unaffected. Enjoy!


  1. […] And if you’re interested in the fix on the Sun Jersey Core library, see my post here. […]

  2. Has the Jersey team been made aware of this bug? Should be a great improvement to make Jersey GAE-friendly out-of-the-box.

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


%d bloggers like this: