开发者

java: rmiregistry setup

开发者 https://www.devze.com 2023-02-25 00:11 出处:网络
So I was using LocateRegistry.createRegistry(), but this has a problem: namely, it runs within the process that calls it, so if I am using more than one JVM, then a crash to the JVM that started the r

So I was using LocateRegistry.createRegistry(), but this has a problem: namely, it runs within the process that calls it, so if I am using more than one JVM, then a crash to the JVM that started the registry will take down the registry for all the JVMs.

So it looks like I need to use rmiregistry (or something?) to isolate the process开发者_如何学JAVA that does RMI lookup/binding from the server JVMs.

I tried to do this, and now I get this error when I try to do Registry.rebind():

java.rmi.ServerException: RemoteException occurred in server thread; nested exception is: 
    java.rmi.UnmarshalException: error unmarshalling arguments; nested exception is: 
    java.lang.ClassNotFoundException: {my remote interface name}
    at sun.rmi.server.UnicastServerRef.oldDispatch(UnicastServerRef.java:396)
    at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:250)
    at sun.rmi.transport.Transport$1.run(Transport.java:159)
    at java.security.AccessController.doPrivileged(Native Method)

What am I doing wrong? I googled this exception & it has something to do with the RMI codebase, but I'm really lost here. If the problem is in the rmiregistry command, what are the command-line options to tell it what to do? If the problem is in my server JVM, what do I need to do?


What crash? I haven't seen a JVM crash for years. Unless you have JNI the JVM containing your RMI servers is no more likely to crash than the standalone JVM started by the rmiregistry command. And using LocateRegistry.createRegistry() solves your class path problems forever.

0

精彩评论

暂无评论...
验证码 换一张
取 消