UPDATE
I was able to get my rmi working by placing exporting the classpath before launching rmiregistry.
> export CLASSPATH=/opt/filtec/syscom.jar
> rmiregistry
The java 6 registry did not require the classpath to be set because codebases were configured and apparently working.
ORIGINAL POST
We are having quite a difficult time porting a legacy rmi implementation from java 6 to a java 8 environment. First I should mention we have been trying permutations of solutions mentioned here:
How do I set the classpath that rmiregistry uses?
and here:
Why RMI registry is ignoring the java.rmi.server.codebase property
But we keep getting this ClassNotFoundException
WARNING: An exception was logged instead of thrown as a RuntimeException, thread: 1-main:
java.rmi.ServerException: RemoteException occurred in server thread; nested exception is:
java.rmi.UnmarshalException: error unmarshalling arguments; nested exception is:
java.lang.ClassNotFoundException: com.s3.systemcommandcaller.SystemCommandServerInterface
at sun.rmi.server.UnicastServerRef.oldDispatch(UnicastServerRef.java:421)
at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:272)
at sun.rmi.transport.Transport$1.run(Transport.java:200)
at sun.rmi.transport.Transport$1.run(Transport.java:197)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.Transport.serviceCall(Transport.java:196)
at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:568)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:826)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.lambda$run$0(TCPTransport.java:683)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:682)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:276)
at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:253)
at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:379)
at sun.rmi.registry.RegistryImpl_Stub.bind(Unknown Source)
at com.s3.peripheral.RMIWatchdog.bindToRegistry(RMIWatchdog.java:177)
at com.s3.peripheral.RMIWatchdog.<init>(RMIWatchdog.java:109)
at com.s3.peripheral.RMIWatchdog.<init>(RMIWatchdog.java:88)
at com.s3.systemcommandcaller.SystemCommandServer.setupServer(SystemCommandServer.java:103)
at com.s3.systemcommandcaller.SystemCommandServer.<init>(SystemCommandServer.java:68)
at com.s3.systemcommandcaller.SystemCommandServer.main(SystemCommandServer.java:81)
Caused by: java.rmi.UnmarshalException: error unmarshalling arguments; nested exception is:
java.lang.ClassNotFoundException: com.s3.systemcommandcaller.SystemCommandServerInterface
at sun.rmi.registry.RegistryImpl_Skel.dispatch(Unknown Source)
at sun.rmi.server.UnicastServerRef.oldDispatch(UnicastServerRef.java:411)
at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:272)
at sun.rmi.transport.Transport$1.run(Transport.java:200)
at sun.rmi.transport.Transport$1.run(Transport.java:197)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.Transport.serviceCall(Transport.java:196)
at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:568)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:826)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.lambda$run$0(TCPTransport.java:683)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:682)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.ClassNotFoundException: com.s3.systemcommandcaller.SystemCommandServerInterface
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.rmi.server.LoaderHandler$Loader.loadClass(LoaderHandler.java:1207)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:348)
at sun.rmi.server.LoaderHandler.loadClassForName(LoaderHandler.java:1221)
at sun.rmi.server.LoaderHandler.loadProxyInterfaces(LoaderHandler.java:731)
at sun.rmi.server.LoaderHandler.loadProxyClass(LoaderHandler.java:674)
at sun.rmi.server.LoaderHandler.loadProxyClass(LoaderHandler.java:611)
at java.rmi.server.RMIClassLoader$2.loadProxyClass(RMIClassLoader.java:646)
at java.rmi.server.RMIClassLoader.loadProxyClass(RMIClassLoader.java:311)
at sun.rmi.server.MarshalInputStream.resolveProxyClass(MarshalInputStream.java:265)
at java.io.ObjectInputStream.readProxyDesc(ObjectInputStream.java:1566)
at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1518)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1781)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1353)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:373)
... 15 more
We are launching our app with the following:
java -Djava.util.logging.config.file=syscom_logging.properties -Djava.library.path=. -Djava.rmi.server.codebase=file:/opt/myapp/syscom.jar -Djava.rmi.server.useCodebaseOnly=false -Dcom.sun.management.jmxremote=true -Dcom.sun.management.jmxremote.port=1096 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false -jar syscom.jar
and I have tried running the rmiregistry process with and without the CLASSPATH set
CLASSPATH=$CLASSPATH:/opt/filtec/syscom.jar
rmiregistry
and not set:
CLASSPATH=
rmiregistry
we've also tried using the default setting for java seven:
-Djava.rmi.server.useCodebaseOnly=true
and have tried setting the classpath before launching the syscom.jar by:
CLASSPATH=/opt/filtec/syscom.jar
export CLASSPATH
Really any help on what we need to do to get this working in a java 8 VM would be hugely appreciated. It does run in java 6. We are using the new rmiregistry provided in the JAVA_HOME/bin. I've checked the syscom.jar and the classfiles are there.
My environment is:
java version "1.8.0_101"
Java(TM) SE Runtime Environment (build 1.8.0_101-b13)
Java HotSpot(TM) Server VM (build 25.101-b13, mixed mode)