一个出现很多的RMI异常,入门级。

vage 2005-08-26 12:27:57
我编了一个入门的RMI程序,也成功调用rmic生成了两个框架类,安全文件也编写的没问题,但运行服务端时,老是报这样一个错:
HelloImpl.main: an exception occured:
java.rmi.ServerException: Server RemoteException; nested exception is:
java.rmi.UnmarshalException: error unmarshalling arguments; nested excep
tion is:
java.lang.ClassNotFoundException: hello.HelloImpl_Stub
at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(Stream
RemoteCall.java:247)
at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:
223)
at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:350)
at sun.rmi.registry.RegistryImpl_Stub.rebind(Unknown Source)
at java.rmi.Naming.rebind(Naming.java:160)
at hello.HelloImpl.main(HelloImpl.java:27)
Caused by: java.rmi.UnmarshalException: error unmarshalling arguments; nested ex
ception is:
java.lang.ClassNotFoundException: hello.HelloImpl_Stub
Caused by: java.lang.ClassNotFoundException: hello.HelloImpl_Stub

问题应该是找不到框架类hello.HelloImpl_Stub,但我已经成功调用过rmic了,而且也已经把它的相关位置设进了-classpath中了。

我看以前的帖子说“rmiregistry必须要能够找到stub,skeleton”
我不明白如何才能让rmiregistry找到stub,skeleton,
有高人告诉我应该这样调用rmiregistry -Jjava.rmi.codebase=某个url
我分别这样试了试(我的桩类在g:/hello/hello里面):
rmiregistry -Jjava.rmi.codebase=g:/hello
rmiregistry -Jjava.rmi.codebase=g:/hello/
rmiregistry -Jjava.rmi.codebase=g:/hello/hello/
rmiregistry -Jjava.rmi.codebase=file://g:/hello
rmiregistry -Jjava.rmi.codebase=file://g:/hello/hello
rmiregistry -Jjava.rmi.codebase=file://g:/hello/
rmiregistry -Jjava.rmi.codebase=file://g:/hello/hello/
报告如下错误:
Error loading class java/rmi/codebase=g:/hello/hello: Bad major version number

下面该怎么办啊,请高人指点指点,万分感激。

(我在网上查了一下,有这个问题的很多,有的解决了,但都没有具体帖出是如何解决的)
...全文
150 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
treeroot 2005-09-05
  • 打赏
  • 举报
回复
试一下rmiregistry -J-Djava.rmi.codebase=file://g:/hello/
congliu 2005-08-28
  • 打赏
  • 举报
回复
路径问题,在 与“hello文件夹同层”的地方 执行javac
yema55 2005-08-26
  • 打赏
  • 举报
回复
可以不管三七二十一,把hello.HelloImpl_Stub和hello.HelloImpl_skeleton同时放在客户端和服务端的
classpath中试试
eureka0891 2005-08-26
  • 打赏
  • 举报
回复
ClassNotFoundException只能说明是你的ClassPath设置有问题,不关rmi的什么事情

你的程序应该是hello.HelloImpl.class吧,
把hello.HelloImpl_Stub和hello.HelloImpl_skeleton放到你的相应的class目录下就行了,
还有,你的java -version是什么?

62,614

社区成员

发帖
与我相关
我的任务
社区描述
Java 2 Standard Edition
社区管理员
  • Java SE
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧