java.rmi.ServerException: RemoteException occurred in server thread java.lang.ClassNotFoundException

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

在根据http://docs.oracle.com/javase/tutorial/rmi/running.html学习RIM,不过在启动server的时候老是报如上的错误

官方文档的命令行命令有误:

c:\home\ann\src>start rmiregistry  -J-Djava.rmi.server.codebase=file:///c:/home/ann/public_html/classes/compute.jar

c:\home\ann\src>java -cp c:\home\ann\src;c:\home\ann\public_html\classes\compute.jar  -Djava.rmi.server.codebase=file:///c:/home/ann/public_html/classes/compute.jar  -Djava.rmi.server.hostname=localhost  -Djava.security.policy=server.policy engine.ComputeEngine
ComputeEngine bound


现在是服务端可以启动了,但是客户端却总是报错误


c:\home\ann\src>start rmiregistry  -J-Djava.rmi.server.useCodebaseOnly=false

c:\home\ann\src>java -cp c:\home\ann\src;c:\home\ann\public_html\classes\compute.jar  -Djava.rmi.server.useCodebaseOnly=false -Djava.rmi.server.codebase=file:///c:/home/ann/public_html/classes/compute.jar  -Djava.rmi.server.hostname=localhost  -Djava.security.policy=server.policy  engine.ComputeEngine

c:\home\jones\src>java -cp  c:\home\jones\src;c:\home\jones\public_html\classes\compute.jar -Djava.rmi.server.codebase=file:/c:/home/jones/public_html/classes/ -Djava.security.policy=client.policy client.ComputePi 127.0.0.1 45

完整源代码:http://www.kuaipan.cn/file/id_122162699692933140.htm?source=1

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值