A custom RMI Activator process

149 views Asked by At

I am trying to implement a custom RMI activation scheme, in which remote Activatable objects will be hosted in a custom EXE process, instead of the standard Java.exe/Javaw.exe.

In RMI 'Activatable' objects can be persisted and restored or launched on demand. After an 'Activatable' object is registered with the RMI registry and requested for the first time, RMID launches a host child process (typically java.exe/javaw.exe), passes two pieces of information through the stdin of the child process and asks the child process to run the main method of a special hidden class 'sun.rmi.server.ActivationGroupInit'. This class is bootstraps everything else prepares the process to create and host instances of the 'Activatable' object. Here after the client and server communicate over RMI.

I've gotten as far as defining a simple Win32 EXE project, writing some JNI code to launch the JVM inside this EXE and managed to invoke the main method of the 'sun.rmi'server.ActivationGroupInit'. This class is able to parse stdin and extract whatever it needs to create the ActivationGroup. However I am running into some issues that is ultimately causing the activation of the remote object to fail (with an UnknownObjectException) and I am in the process of troubleshooting it.

At this point I just wanted to take a step back and ask if anyone has attempted this before, and knows if there are any gotchas that I should know early on?

Thanks, Ranjit

1

There are 1 answers

0
user207421 On

As we have discussed endlessly on the Oracle forums, you don't need any of this. Just copy java.exe or javaw.exe, or write your own wrapper that just starts a JVM using all the arguments it is passed in exactly the same way that java.exe does. You don't need to worry about what the activation system sends you on stdin etc, the existing activation classes will do all that for you.