XmlRpc library conflict

Hi there,

I'm developing a plugin that allows users to interact with Code Collaborator, a third party tool for performing code reviews.
Upon upgrading to a more recent version of Code Collaborator, I can no longer use their Java API from within IntelliJ, because there seems to be some kind of library conflict:

java.lang.IncompatibleClassChangeError: Implementing class
     at java.lang.ClassLoader.defineClass1(Native Method)
     at java.lang.ClassLoader.defineClass(ClassLoader.java:621)
     at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)
     at java.net.URLClassLoader.defineClass(URLClassLoader.java:260)
     at java.net.URLClassLoader.access$000(URLClassLoader.java:56)
     at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
     at java.security.AccessController.doPrivileged(Native Method)
     at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
     at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
     at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
     at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
     at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)

It looks like this happens the moment XmlRpcClient is instantiated from the Code Collaborator API. Both XmlRpc-client.jar (v3.1.2) that comes with the Code Collaborator API, and xmlrpc-2.0.jar that is shipped with IntelliJ 7.0.5 (the version I use) contain this class; as soon as I remove the latter from the classpath of my IntelliJ IDEA SDK, the problem is gone.

I have no idea how I could resolve this issue; I don't think I can remove either of the two libraries without seriously breaking stuff.
Perhaps someone here can be of assistance?




Hello Guno,

plugins are loaded in separate class loaders in a special manner to prevent conflicts between plugin and core versions of same libraries. Which libraries your plugin use? Which piece of code causes that error?


Hi Roman,

I'm afraid I cannot give you the exact code that causes it, as I do not have that source code. The error occurs in code that is part of the Code Collaborator API.

I did decompile the class where the error occured to see that it occurs when the following line is executed:

XmlRpcClient xmlRpcClient = new XmlRpcClient();

Now the Code Collaborator API includes an xmlrpc-client.jar, version 3.1.2 (according to MANIFEST.MF). This library contains an XmlRpcClient.
The xmlrpc-2.0.jar that is shipped with IntelliJ 7.0.5 also contains an XmlRpcClient, and as soon as I remove that library from the classpath of my IntelliJ IDEA SDK, the problem is gone. That's why I suspect those two libraries/classes are in conflict!


Hi Guno,

I tried to say that I was able to create quick test plugin wich uses it's own version of xml-rpc (3.1.3, to be exact) without any conflicts, and exactly same line worked good in it. Here is code snippet:

import com.intellij.openapi.actionSystem.AnAction;
import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.ui.Messages;
import org.apache.xmlrpc.client.XmlRpcClient;
import org.apache.xmlrpc.client.XmlRpcClientConfigImpl;

import java.net.URL;

public class TestAction extends AnAction {
    public void actionPerformed(AnActionEvent anActionEvent) {
        try {
            XmlRpcClientConfigImpl config = new XmlRpcClientConfigImpl();
            config.setServerURL(new URL("http://jira.atlassian.com/rpc/xmlrpc"));
            XmlRpcClient client = new XmlRpcClient();
            System.out.println("config=" + config);
            System.out.println("client=" + client);

            final Object response = client.execute("jira1.login", new String[]{"test", "test"});
            Messages.showInfoMessage("response: " + response, "Test");
        } catch (Exception e) {
            Messages.showErrorDialog("error: " + e.getMessage(), "Test");

Hi Roman,

Still haven't solved the problem, which also occurs in IntelliJ 9.0.1.
The  following code is enough for the problem to occur:

import org.apache.xmlrpc.client.XmlRpcClient;

public class Example {

  public static void main(String[] args) throws Exception {
    XmlRpcClient xmlRpcClient = new XmlRpcClient();

My classpath consists of the default intellij plugin classpath and two libraries (xmlrpc-client.jar, xmlrpc-common.jar). Perhaps I can email you the project (in total about 150 kb) so that you can try to reproduce it yourself?


The libs xmlrpc-client.jar and xmlrpc.common.jar mentioned above are from the XmlRpc 3.1.2 distribution.
These two libraries, combined with the trivial class Example pasted above, cause the error I reported when run from IntelliJ using IntelliJ IDEA Plugin SDK.

Attached the project files. Perhaps someone can try to run the Example class from that project to try to reproduce my problem?


Well, you just trying to execute plugin code in a wrong way. I've modified you project to make it work as a real plugin. Open the project, execute it via "Test plugin" run configuration, click on Tools - Test Action menu item, see how it works.


You're right. Whilst running the Examples class generates an error, it does work when running the plugin itself.
I tried this in my plugin project, same there. I was under the impression that the error occured there also, but it looks like I was wrong.

Thanks for your time!



Please sign in to leave a comment.