[kf-users] Knopflerfish & RMI

Alin Dreghiciu adreghiciu at gmail.com
Sat Dec 20 11:54:45 CET 2008


Thanx Gunnar for your answer,

See bellow.

On Fri, Dec 19, 2008 at 3:44 PM, Gunnar Ekolin <gunnar at ekolin.se> wrote:
> On Fri, Dec 19, 2008 at 03:13:52PM +0200, Alin Dreghiciu wrote:
>> Hi guys,
>>
> ...
>
>> 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:
>>
>> java.lang.NoClassDefFoundError: sun/reflect/SerializationConstructorAccessorImpl
>>
>> So, adding boot delegation for "sun.*" solved the problem.
>>
>
> Since the RMI code called from the bundle wants to load a class in
> package that does not start with "java." then that package must either
> be imported by the bundle or made available via boot delegation.

The exception does not appear by the moment of starting up the rmi
registry or exporting the remote object. It appears by the moment that
the client code lookup the remote object, and it appears on the server
part. And in my view I should not import the package or have boot
delegation because my code uses classes from java.rmi.* package which
as stated by the specs should automatically be using the system class
loaded. If that code wanna load any class from its own class loader
(hence system class loader in this case) it is its own business and I
should not import it or have boot delegation for it. This is like with
the URL class: the fact that by the end the actual classes are sun
classes it does not make me import them or have boot delegation setup
for sun classes.

>
> My guess is that different frameworks and versions of them uses
> different default settings for the boot delegation property. It can
> also be that someone has set up a context classloader that searches
> the call stack for a class loader that can load the requested class.

I do not think that is the case. Felix only delegates for java.*, and
for the eclipse case I am controlling the boot delegation property
(I'm using pax Runner) and the value is again only "java.*".
Also there is no context class loader involved as I specifically set
the context class loader to "null" while setting up the RMI registry
and exporting teh remote object.

>
>
> The default xargs-file (props.xargs) comming with KF 2.1, 2.2 actually
> sets boot delegation to '*'.

I'm using Pax Runner and there is no props.xargs involved, so the
default value of that property is used. But is that a good thing that
you do by default boot delegation for "*"? This will make unaware
people think that is normal that they use for example javax.* classes
and do not import them, which is not the case.

>
>
> Regards,
>        Gunnar
> _______________________________________________
> Knopflerfish-users mailing list
> Knopflerfish-users at knopflerfish.org
> http://www.knopflerfish.org/mailman/listinfo.cgi/knopflerfish-users
>



-- 
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