I have a simple RMI server which stores files in a map and returns them when requested. The type of the files stored in the map is Object. I have done this so I won't need to import library with the other part of the project containing the specific file stored( is there any other way to do it ?).
Shouldn't I be ok without importing, since the type stored is Object? At the same time with the error I am getting java Finalizer thread crash . Here is the stack :
java.rmi.ServerException: RemoteException occurred in server thread; nested exception is:
java.rmi.UnmarshalException: error unmarshalling arguments; nested exception is:
java.lang.ClassNotFoundException: util.MyClass (no security manager: RMI class loader disabled)
Invalid memory access of location 0x0 rip=0x7fff91016390 <<< this is from crash
at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:334)
at sun.rmi.transport.Transport$1.run(Transport.java:159)
at java.security.AccessController.doPrivileged(Native Method)
Also here is some of the code from Client :
public void uploadProjects(List<MyClass> projects) {
try {
Object obj = projects;
rmiServer.upload(channel, obj); // <<<< exception on this line
} catch (RemoteException ex) {
Logger.getLogger(RMIClient.class.getName()).log(Level.SEVERE, null, ex);
}
}
And here is the interface method :
void upload(String channel, Object projects) throws RemoteException;
Am I doing something wrong there? Shouldn't it work fine with Object without needed import of the specific class?Also I have tried using Security manager in the past but it only lead to more trouble and had to do AllPermissions for it to work(on other project)...
The crash doesn't happen always but it must be cause by RMI.
The type of the objects stored in the Map is whatever you put into it, and whatever type that is must be accessible to the client via its CLASSPATH.