Google Docs API: UnsupportedDataTypeException MIME type application/atom+xml


When trying to use the Google Docs API inside an OSGi bundle, the following exception is thrown, for instance when trying to upload a document:

javax.activation.UnsupportedDataTypeException: no object DCH for MIME type application/atom+xml
        at javax.activation.ObjectDataContentHandler.writeTo(
        at javax.activation.DataHandler.writeTo(


Again this problem requires some tweaking with classloaders. The following code added before and after updateMedia helped in my case:

Thread cur = Thread.currentThread();
ClassLoader ccl = cur.getContextClassLoader();
                 ClassLoader classLoader = this.getClass().getClassLoader();


DocumentListEntry e = entry.updateMedia(true);


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