RMI Version Compatibility and Alternatives

I hope someone can help me.

I am working on a system which will generally be running on Java SE 6. However, there is one small part that runs as a thin client on a different machine using a J2SE 1.3 VM. This thin client will talk to a server program that should reuse a component from the main guts of the v6 system and allow two-way communication between the v1.3 object(s) and that component.

I want to reuse as much of the code as possible and make the transfer details as transparent as possible, so I was thinking I would use RMI to communicate between the VMs. Unfortunately, despite making all required objects 1.3 compatible, I have not been able to connect to a Java 6 rmiregistry from a Java 1.3 VM or visa-versa. So my questions are:

1) Is it possible to use RMI to communicate between v1.3 and v6 VMs?

2) What other options do I have for two way communication? I have looked into JMS, JINI and web services but without experience of those technologies I do not know which ones I could use in this situation.

Thanks a lot for your time,

Russ

[1095 byte] By [triplesuba] at [2007-11-27 5:48:11]
# 1

> Unfortunately, despite making all

> required objects 1.3 compatible, I have not been able

> to connect to a Java 6 rmiregistry from a Java 1.3 VM

> or visa-versa.

It should work. What problem did you get? You will need to generate stubs for your remote objects, and you will need to compile all the stubs and remote interfaces and any other application classes they refer to, and so on until closure, with javac -source 1.3 -target 1.3. You will have to use rmic -keepgenerated so you can compile the stub yourself with these javac options.

> So my questions are:

>

> 1) Is it possible to use RMI to communicate between

> v1.3 and v6 VMs?

Yes.

> 2) What other options do I have for two way

> communication? I have looked into JMS, JINI and web

> services but without experience of those technologies

> I do not know which ones I could use in this

> situation.

You could try RMI/IIOP but I think there really is a 1.3/later compatibility problem there.

ejpa at 2007-7-12 15:33:24 > top of Java-index,Core,Core APIs...
# 2

Thanks a lot for your reply, sounds very hopeful for me. :)

Below is the exception I am getting with a v1.3 VM connecting to a v6 RMI registry. I googled it and what I found suggested that it was a VM incompatibility, but hopefully not.

java.rmi.UnmarshalException: error unmarshalling return; nested exception is:

java.lang.ClassNotFoundException: java.rmi.server.RemoteObjectInvocationHandler

java.lang.ClassNotFoundException: java.rmi.server.RemoteObjectInvocationHandler

at java.net.URLClassLoader$1.run(URLClassLoader.java:200)

at java.security.AccessController.doPrivileged(Native Method)

at java.net.URLClassLoader.findClass(URLClassLoader.java:188)

at java.lang.ClassLoader.loadClass(ClassLoader.java:297)

at java.lang.ClassLoader.loadClass(ClassLoader.java:253)

at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:313)

at java.lang.Class.forName0(Native Method)

at java.lang.Class.forName(Class.java:195)

at sun.rmi.server.LoaderHandler.loadClass(LoaderHandler.java:354)

at sun.rmi.server.LoaderHandler.loadClass(LoaderHandler.java:88)

at sun.rmi.server.MarshalInputStream.resolveClass(MarshalInputStream.java:145)

at java.io.ObjectInputStream.inputClassDescriptor(ObjectInputStream.java:918)

at java.io.ObjectInputStream.readObject(ObjectInputStream.java:366)

at java.io.ObjectInputStream.readObject(ObjectInputStream.java:236)

at java.io.ObjectInputStream.inputObject(ObjectInputStream.java:1186)

at java.io.ObjectInputStream.readObject(ObjectInputStream.java:386)

at java.io.ObjectInputStream.inputClassFields(ObjectInputStream.java:2262)

at java.io.ObjectInputStream.defaultReadObject(ObjectInputStream.java:519)

at java.io.ObjectInputStream.inputObject(ObjectInputStream.java:1411)

at java.io.ObjectInputStream.readObject(ObjectInputStream.java:386)

at java.io.ObjectInputStream.readObject(ObjectInputStream.java:236)

at sun.rmi.registry.RegistryImpl_Stub.lookup(Unknown Source)

...

I have stripped the code down to the bare minimum to avoid class file incompatibility issues. If I connect to a 1.3 rmiregistry with a v6 VM then I get a very similar error.

Thanks for your help,

Russ

triplesuba at 2007-7-12 15:33:24 > top of Java-index,Core,Core APIs...
# 3
After looking into my tests further it turns out I hadn't compiled my stubs properly and of course they are vital for v1.3. So it seems to work fine now, thanks a lot for your help ejp!Cheers,Russ
triplesuba at 2007-7-12 15:33:24 > top of Java-index,Core,Core APIs...