I am building the basic functionality for client-server communication using RMI.
When I try to lookup the RemoteData object (present in "suncertify.server" package) from a client (present in "client" package), I get
the following error:
RemoteConnection exception: suncertify.server.RemoteData_Stub
java.lang.ClassCastException: suncertify.server.RemoteData_Stub
at client.RemoteConnection.getConnection(RemoteConnection.java:11)
at client.clientTest.main(clientTest.java:258)
Remote Implementation available.
Exception in thread "main" java.lang.NullPointerException
at client.clientTest.<init>(clientTest.java:63)
at client.clientTest.main(clientTest.java:259)
But, when I copy the client class to the "suncertify.server" and access the RemoteData object, the application is running. Where am I making a mistake?!
I also tried copying the RemoteData_Stub to the "client" folder, but still the above error was thrown.
(RemoteData is the class which extends extends UnicastRemoteObject and implements DBMain (which extends Remote). RemoteData's main method binds the RemoteData object with the rmi-registry. The client lookups this object using rmi://ipaddress/obj)
Dayanand.