开发者

rmi java.lang.ClassNotFoundException: RMIServerImpl_Stub

开发者 https://www.devze.com 2023-02-11 01:00 出处:网络
when i start rmiserver implementation class it displays this error message Remote exception: java.rmi.ServerException: RemoteException occurred in server t

when i start rmiserver implementation class it displays this error message

Remote exception: java.rmi.ServerException: RemoteException occurred in server t
hread; nested exception is:
        java.rmi.UnmarshalException: error unmarshalling arguments; nested excep
tion is:
        java.lang.ClassNotFoundException: RMIServerImpl_Stub

commands ran

start rmiregistry

start java -Djava.security.policy=policyfile RMIServerImpl

what can i do to resolve this. Please help

This is my rmi server code

import java.rmi.*;
import java.rmi.server.*;
import java.rmi.registry.*;

public class RMIServerImpl extends UnicastRemoteObject implements RMIServer {

RMIServerImpl() throws RemoteException {


    super();
}


public static void main(String args[]) {


    try {
        System.setSecurityManager(new RMISecurityManager());

        RMIServerImpl Server = new RMIServerImpl();


        Naming.rebind("SAMPLE-SERVER", Server);

        System.out.println("Server waiting.....");
    } catch (java.net.MalformedURLException mue) {
        System.out.println("Malformed URL: " + mue.toString());
    } catch (Re开发者_运维知识库moteException re) {
        System.out.println("Remote exception: " + re.toString());
    }

}

}


Sounds like you didn't run the rmic compiler to generate stubs and skeletons.

It's been so long since I've done raw RMI by hand that I don't know if that step is still required. But it was the last time I did RMI.

If you did run rmic, then I'd guess that you didn't package the stub and skeleton properly with the server and client sides. If you can find those .class files, check your packaging and deployment.

0

精彩评论

暂无评论...
验证码 换一张
取 消