Hi,
I am trying to run a simple RMI example that uses dynamic class loading but I am hitting a problem I cannot get around - can anyone help?
The problem I am getting is that when I run my client program I get the exception listed at the bottom of my post.
I have the following in my server class called WarehouseServer:
I have the a server.policy file located in the same folder as my server class:
I run my server using the following command:
java -Djava.rmi.server.codebase=http://localhost:8080/ WarehouseServer
I have also tried running the server using this command:
java -Djava.rmi.server.codebase=http://localhost:8080/ -Djava.security.policy=server.policy WarehouseServer
But on both occasions I get the same exception when running my client program.
Any idea?
Cheers,
Sean.
=====================================================================
Exception in thread "main" java.rmi.UnmarshalException: error unmarshalling return; nested exception is:
java.lang.ClassNotFoundException: Book (no security manager: RMI class loader disabled)
at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:178)
at java.rmi.server.RemoteObjectInvocationHandler.invokeRemoteMethod(RemoteObjectInvocationHandler.java:178)
at java.rmi.server.RemoteObjectInvocationHandler.invoke(RemoteObjectInvocationHandler.java:132)
at $Proxy0.getProduct(Unknown Source)
at WarehouseClient.main(WarehouseClient.java:32)
Caused by: java.lang.ClassNotFoundException: Book (no security manager: RMI class loader disabled)
at sun.rmi.server.LoaderHandler.loadClass(LoaderHandler.java:375)
at sun.rmi.server.LoaderHandler.loadClass(LoaderHandler.java:165)
at java.rmi.server.RMIClassLoader$2.loadClass(RMIClassLoader.java:620)
at java.rmi.server.RMIClassLoader.loadClass(RMIClassLoader.java:247)
at sun.rmi.server.MarshalInputStream.resolveClass(MarshalInputStream.java:197)
at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1574)
at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1495)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1731)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1328)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:350)
at sun.rmi.server.UnicastRef.unmarshalValue(UnicastRef.java:306)
at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:155)
... 4 more