一个出现很多的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
下面该怎么办啊,请高人指点指点,万分感激。
(我在网上查了一下,有这个问题的很多,有的解决了,但都没有具体帖出是如何解决的)