服务器端运行命令rmiregistry,然后java HelloServer(这两条命令都是在/root/Test/server/目录下运行的)
客户端运行命令java -Djava.rmi.server.codebase=http://192.168.2.51/ HelloClient 192.168.2.51
其中最后192.168.2.51是HelloServer所在host的ip地址,-Djava.rmi.server.codebase=http://192.168.2.51/是HelloImpl_Stub.class所在位置
在服务器端的/root/Test/目录下运行命令rmiregistry,然后在/root/Test/server/目录目录下运行java -Djava.rmi.server.codebase=file:/root/Test/server/ HelloServer
客户端运行命令java -Djava.rmi.server.codebase=http://192.168.2.51/ HelloClient 192.168.2.51
不成功
倘若在服务器端运行java -Djava.rmi.server.codebase=http://192.168.2.51/ HelloServer
成功
原因:
1、The codebase set on the server JVM is annotated to the remote object reference in the RMI registry.
4、The codebase the client uses is the URL that was annotated to the stub instance when the stub class was loaded by the registry.
客户端运行命令java -Djava.rmi.server.codebase=http://192.168.2.51/ HelloClient 192.168.2.51
其中最后192.168.2.51是HelloServer所在host的ip地址,-Djava.rmi.server.codebase=http://192.168.2.51/是HelloImpl_Stub.class所在位置
在服务器端的/root/Test/目录下运行命令rmiregistry,然后在/root/Test/server/目录目录下运行java -Djava.rmi.server.codebase=file:/root/Test/server/ HelloServer
客户端运行命令java -Djava.rmi.server.codebase=http://192.168.2.51/ HelloClient 192.168.2.51
不成功
倘若在服务器端运行java -Djava.rmi.server.codebase=http://192.168.2.51/ HelloServer
成功
原因:
1、The codebase set on the server JVM is annotated to the remote object reference in the RMI registry.
4、The codebase the client uses is the URL that was annotated to the stub instance when the stub class was loaded by the registry.