[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [xmlblaster] xmlBlaster client as OSGi bundle (eclipse plugin)
Hi Kai,
there are some requirements about classloader when using xmlBlaster
embedded:
http://www.xmlblaster.org/xmlBlaster/doc/requirements/util.classloader.ClassLoaderFactory.html
and
http://www.xmlblaster.org/xmlBlaster/doc/requirements/util.classloader.XmlBlasterClassLoader.html
particularly have you tried to set
classloader.xmlBlaster=true in the property file ?
I am not familiar with OSGI so could you tell me which implementation of
the Class loader is used ?
Regards
Michele
kai wrote:
> Brian Young schrieb:
>> I have used xmlBlaster within OSGI based libs before in conjuction with
>> Eclipse. Try switching to the context class loader b/f you access
>> xmlBlaster code, and then you can switch back to the custom class loader
>> afterwards.
>>
>> //need to use context class loader to make xmlBlaster happy
>> Thread current = Thread.currentThread();
>> ClassLoader oldLoader = current.getContextClassLoader();
>> try {
>> current.setContextClassLoader(getClass().getClassLoader());
>> // call library code here
>> } finally {
>> current.setContextClassLoader(oldLoader);
>> }
>
> Uh how ugly. Do I have to put this wrapper in every function I call
> xmlBlaster functions?
>
> I tried this, but with no success. Still getting the CCE:
>
> public void start(BundleContext context) throws Exception
> {
> this.bundleContext = context;
> // need to use context class loader to make xmlBlaster happy
> Thread current = Thread.currentThread();
> ClassLoader oldLoader = current.getContextClassLoader();
> try {
> current.setContextClassLoader(getClass().getClassLoader());
> // call library code here
> momConnector = new MOMConnector();
> } finally {
> current.setContextClassLoader(oldLoader);
> }
> }
>
>
> Ah someone how can help me?
>
>