RMI does not work when called from plugin

Answered

Dear all,

My team and I are trying to integrate an automated test generation tool (EvoSuite) into our plugin. Internally, it relies on spawning a separate thread or process that runs the actual generation process and communicates the results afterwards. This communication happens through Java RMI and we’re running into several issues that stem from this.

The following exception happens on the thread that is spawned by our plugin. It is thrown upon calling `registry.rebind()`

clientNode = new ClientNodeImpl<>(registry, identifier);

Remote stub = UtilsRMI.exportObject(clientNode);

registry.rebind(clientNode.getClientRmiIdentifier(), stub);
[MASTER] 12:51:57.896 [client] ERROR ClientServices - Failed to register client services

java.rmi.ServerException: RemoteException occurred in server thread; nested exception is: 

    java.rmi.UnmarshalException: error unmarshalling arguments; nested exception is: 

    java.lang.ClassNotFoundException: org.evosuite.rmi.service.ClientNodeRemote

The class `org.evosuite.rmi.service.ClientNodeRemote` is located in the tool’s jar which is loaded inside our `build.gradle.kts`:

dependencies {

   implementation(files("evo/evosuite.jar"))

}

The jar can also be located in the lib directory of the plugin which should mean that the jar is loaded into the classpath of the application. It should be noted that attempting to execute the same code in a normal process (outside of the environment of the plugin) works fine and no such issues occur.

Does IntelliJ have any special security requirements that may prevent Java RMI from working correctly within the scope of a plugin? Is there a way to disable those?

 

What we use for development: 

Kotlin support ("org.jetbrains.kotlin.jvm") version "1.6.10"

Gradle IntelliJ Plugin ("org.jetbrains.intellij") version "1.4.0"

Different versions of IntelliJ on team members’ laptops: 2020.x.x, 2021.x.x and 2022.x.x

Plugin development based on IntelliJ Github Template

Thank you in advance!

5 comments
Comment actions Permalink

Unrelated to the actual problem, but

Gradle IntelliJ Plugin ("org.jetbrains.intellij") version "1.4.0"

is outdated version, please always update to latest available version https://github.com/JetBrains/gradle-intellij-plugin/

 

Checking...

0
Comment actions Permalink

Hi, we do not use ServiceLoader anywhere. 

0
Comment actions Permalink

It seems there are no known general problems with using RMI in a plugin. Is it possible to share the plugin sources for further investigation? You can upload them to https://uploads.services.jetbrains.com/ if necessary.

0
Comment actions Permalink

Hi,

We have found a workaround for our problem by launching a jar file as an external process.

Thank you for your time and help. 

0

Please sign in to leave a comment.