In my plugin, I'm accessing a JMX service through RMI. Unfortunately I get a ClassCastException. The code is as follows:
The exception is:
The classes seem the same but I guess they get loaded by different ClassLoaders. My plugin depends on the JMX jars and somehow the JARS are loaded by IDEA's classloader instead of the system classloader?
When I run the code as a separate application everything works fine. What should I do to avoid the exception?