遇见问题:
Caused by: java.lang.ClassNotFoundException: com.rule.CardUserInfo (no security manager: RMI class loader disabled)
at sun.rmi.server.LoaderHandler.loadClass(LoaderHandler.java:406)
at sun.rmi.server.LoaderHandler.loadClass(LoaderHandler.java:196)
at java.rmi.server.RMIClassLoader$2.loadClass(RMIClassLoader.java:648)
at java.rmi.server.RMIClassLoader.loadClass(RMIClassLoader.java:275)
at sun.rmi.server.MarshalInputStream.resolveClass(MarshalInputStream.java:228)
at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1662)
at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1583)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1819)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1416)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:419)
at sun.rmi.server.UnicastRef.unmarshalValue(UnicastRef.java:336)
at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:185)
... 38 more
问题原因:
异常说的很明确CardUserInfo这个对象无权限使用。因为服务端返回来的CardUserInfo这个对象和客户端的CardUserInfo不一致。RMI要求这两个类必须一直,包括包名和方法属性等。
解决方案:
将CardUserInfo这个类在客户端和服务端统一。