javaprocessrmiprocessbuilderrmiregistry

Client fails to connect with RMI registry when using ProcessBuilder


If i'm creating the RMI registry from command line, the client has no problem in binding objects to the registry.

However, if i'm starting the RMI registry using ProcessBuilder, it's giving error.

This is my code for creating rmiregistry using ProcessBuilder

ProcessBuilder obj = new ProcessBuilder ("rmiregistry","2500");

Process obj_process = obj.start();

The error that i'm getting for using ProcessBuilder when I'm trying to bind to my own RMI registry

java.rmi.ServerException: RemoteException occurred in server thread; nested exception is: 
java.rmi.UnmarshalException: error unmarshalling arguments; nested exception is: 
java.lang.ClassNotFoundException: node_func

node_func is an interface

Any ideas?


Solution

  • I don't see why you are starting a separate process when you could use LocateRegistry.createRegistry(). If you did that, this problem would disappear as well.