You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tuscany.apache.org by Rajini Sivaram <ra...@googlemail.com> on 2007/10/03 11:35:10 UTC

Tuscany and the thread context classloader

Hello,

I couldn't get any response from Bill Barnhill about the status of host-osgi
(running Tuscany modules in an OSGi runtime) either through the Tuscany
mailing list or his email. If there is anyone else looking at this, we would
be very interested in using the code.

In the meantime, I am trying to run Tuscany as a single bundle on top of an
OSGi runtime. The only difference this has with running Tuscany in the
normal way should be that the classloader used to load Tuscany is no longer
the normal application classloader, but a classloader associated with
the Tuscany bundle. This bundle contains all the jar files listed in
tuscany-sca-manifest.jar, so it does find all the classes using a single
bundle with a single classloader.

I have run into problems with libraries trying to load classes using the
context classloader.
The first problem was at:
   at javax.xml.stream.XMLOutputFactory.newInstance(XMLOutputFactory.java
:98)
This is called from a thread which is creating an SCA domain, and so I can
set the thread context classloader before the SCA library is invoked.

And then I ran into the second problem at:
   at javax.xml.datatype.DatatypeFactory.newInstance(Unknown Source)
This is called from a different thread in another OSGi bundle which invoking
an SCA proxy which was found in the OSGi registry, and this bundle itself
does not know anything about SCA.

The only fix that I can think of is to use another proxy which sets the
context classloader and then calls the SCA proxy, but that seems like lot of
indirection, and I would like to avoid it if possible.

Is the use of thread context classloader pervasive across Tuscany (or code
that it uses)? Is it possible for me to use Tuscany modules in some other
way without having to set the thread context classloader for every thread
that might potentially run into Tuscany code?


Thank you...

Regards,

Rajini