[kf-users] Knopflerfish & RMI

Alin Dreghiciu adreghiciu at gmail.com
Fri Dec 19 14:13:52 CET 2008


Hi guys,

Basically I have a very simple setup. A bundle that will kick off an
RMI server and bind a remote service to it. Then from a standalone
client I want to access that service via RMI.
The problem: this works just fine in all open source frameworks
(versions) including knopflerfish 2.0.0. But it does not work in kf
versions >= 2.0.3.

The exception I get in the client code is:

Exception in thread "main" java.rmi.UnmarshalException: error
unmarshalling return; nested exception is:
       java.io.EOFException
       at sun.rmi.registry.RegistryImpl_Stub.lookup(Unknown Source)
       at org.ops4j.pax.exam.it.StandaloneRBCTest.main(StandaloneRBCTest.java:42)
Caused by: java.io.EOFException
       at java.io.ObjectInputStream$BlockDataInputStream.peekByte(ObjectInputStream.java:2498)
       at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1273)
       at java.io.ObjectInputStream.readObject(ObjectInputStream.java:348)
       ... 2 more

Then by setting the rmi logging on via
"-Djava.rmi.server.logCalls=true", the following is logged inside the
server part that runs within kf:

ava.lang.NoClassDefFoundError: sun/reflect/SerializationConstructorAccessorImpl
       at sun.misc.Unsafe.defineClass(Native Method)
       at sun.reflect.ClassDefiner.defineClass(ClassDefiner.java:45)
       at sun.reflect.MethodAccessorGenerator$1.run(MethodAccessorGenerator.java:381)
       at java.security.AccessController.doPrivileged(Native Method)
       at sun.reflect.MethodAccessorGenerator.generate(MethodAccessorGenerator.java:377)
       at sun.reflect.MethodAccessorGenerator.generateSerializationConstructor(MethodAccessorGenerator.java:95)
       at sun.reflect.ReflectionFactory.newConstructorForSerialization(ReflectionFactory.java:313)
       at java.io.ObjectStreamClass.getSerializableConstructor(ObjectStreamClass.java:1299)
       at java.io.ObjectStreamClass.access$1500(ObjectStreamClass.java:52)
       at java.io.ObjectStreamClass$2.run(ObjectStreamClass.java:420)
       at java.security.AccessController.doPrivileged(Native Method)
       at java.io.ObjectStreamClass.<init>(ObjectStreamClass.java:400)
       at java.io.ObjectStreamClass.lookup(ObjectStreamClass.java:297)
       at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1035)
       at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:302)
       at sun.rmi.registry.RegistryImpl_Skel.dispatch(Unknown Source)
       at sun.rmi.server.UnicastServerRef.oldDispatch(UnicastServerRef.java:375)
       at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:240)
       at sun.rmi.transport.Transport$1.run(Transport.java:153)
       at java.security.AccessController.doPrivileged(Native Method)
       at sun.rmi.transport.Transport.serviceCall(Transport.java:149)
       at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:466)
       at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:707)
       at java.lang.Thread.run(Thread.java:613)

So, adding boot delegation for "sun.*" solved the problem.

But now the question is, why I do not have the problem in kf 2.0.0 or
in any other framework implementations as Felix or Equinox. Is KF >=
2.0.3 right and all the others are having a bug or is the other way
around?


Thanx,
-- 
Alin Dreghiciu
http://www.ops4j.org         - New Energy for OSS Communities - Open
Participation Software.
http://www.qi4j.org            - New Energy for Java - Domain Driven
Development.
http://malaysia.jayway.net - New Energy for Projects - Great People
working on Great Projects at Great Places


More information about the Knopflerfish-users mailing list