I am trying to invoke a remote method via RMI that takes 1 argument of type MyData
, which is an interface known in both server side and client side.
In my client class MyClass
, I created an anonymous object of type MyData
, and passed it to the remote method, and got an exception:
Caused by: java.lang.reflect.InvocationTargetException
at wt.method.RemoteMethodServer.invoke(RemoteMethodServer.java:795)
at
... 2 more
Caused by: java.lang.ClassNotFoundException: MyClass$1 (no security manager: RMI class loader disabled)
Question: Must I use an implementation of the interface MyData
to pass RMI method argument? That implementation is known on both server and client sides.
It's possible if:
Serializable
, and(2) May not be true, and may not need to be true for any reason other than this, and (3) is very likely to be untrue, as it is very likely to be a client-only class that is none of the server's business.
Don't do this. There is no advantage, and several disadvantages. Use an outer or static class.