相关疑难解决方法(0)

java.rmi.ServerException:服务器线程中发生RemoteException(ClassNotFoundException)

以下方法:

private void startServer() { // snippet that starts the server on the local machine
    try {
         RemoteMethodImpl impl = new RemoteMethodImpl();
         Naming.rebind( "Illusive-Server" , impl );
    }catch(Exception exc) {
        JOptionPane.showMessageDialog(this, "Problem starting the server", "Error", JOptionPane.ERROR_MESSAGE);
        System.out.println(exc);
    }
}
Run Code Online (Sandbox Code Playgroud)

抛出此异常:java.rmi.ServerException: RemoteException occurred in server thread; nested exception is: java.rmi.UnmarshalException: error unmarshalling arguments; nested exception is: java.lang.ClassNotFoundException: Interfaces.RemoteMethodIntf

当我启动我的项目时,我会收到JOptionPane中的消息,说服务器启动服务器然后出现上述异常.这可能是什么原因?

我不明白为什么最后一个异常声明说当我导入了正确的包时没有找到类

java rmi exception

8
推荐指数
2
解决办法
5万
查看次数

RMI服务器异常

当我尝试运行使用远程注册表的服务器时,我从RMI获得以下异常.

我在Server2类中的主要方法的注册表编码是

Registry registry = LocateRegistry.getRegistry("192.168.1.4",1100);
registry.rebind("Hello",stub);
Run Code Online (Sandbox Code Playgroud)

192.168.1.4是同一局域网中的另一台机器.

请帮我.

Server2 exception:java.rmi.ServerException: RemoteException occurred in server thread; nested exception is: 
 java.rmi.UnmarshalException: error unmarshalling arguments; nested exception is: 
 java.lang.ClassNotFoundException: example.Hello.RemoteHello2
java.rmi.ServerException: RemoteException occurred in server thread; nested exception is: 
 java.rmi.UnmarshalException: error unmarshalling arguments; nested exception is: 
 java.lang.ClassNotFoundException: example.Hello.RemoteHello2
 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)
 at sun.rmi.transport.Transport.serviceCall(Transport.java:155)
 at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:535)
 at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:790)
 at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:649)
 at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
 at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
 at java.lang.Thread.run(Thread.java:619)
 at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:273)
 at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:251)
 at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:377)
 at sun.rmi.registry.RegistryImpl_Stub.rebind(Unknown Source)
 at example.Hello.Server2.main(Server2.java:29) …
Run Code Online (Sandbox Code Playgroud)

java rmi

3
推荐指数
1
解决办法
3万
查看次数

标签 统计

java ×2

rmi ×2

exception ×1