Classloaders: GWT RPC, OSGi and Restlet


Restlet works well with GWT RPC calls. However, for GWT‘s RPC deserialization mechanism, the classes of transmitted objects must reside in the servlet‘s thread classloader. In an OSGi environment, the classes, which need to be deserialized often reside within a different bundle than the servlet. This leads to GWT deserialization exceptions.


In the following case the class Name needs to be deserialized but resides within another bundle. Adding the following code to the ServerResource fixed the problem:

        public Representation handle() {
                 CompositeClassLoader customCL =
new CompositeClassLoader();
                 ClassLoader oldCL = Thread.currentThread().getContextClassLoader();
                Representation rep =
return rep;


GWT Issue 1888: Allow to pass classloader to GWT deserialization

One thought on “Classloaders: GWT RPC, OSGi and Restlet

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 )

Twitter picture

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

Facebook photo

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

Google+ photo

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

Connecting to %s