[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [xmlblaster] xmlBlaster client as OSGi bundle (eclipse plugin)



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);
		}

Good luck and God bless!
Brian

From: Kai <yavin at gmx.com>
Reply-To: xmlblaster at server.xmlBlaster.org
To: xmlblaster at server.xmlBlaster.org
Subject: Re: [xmlblaster] xmlBlaster client as OSGi bundle (eclipse plugin)
Date: Fri, 27 Jan 2006 17:43:02 +0100

Okay the problem is in StandClassLoaderFactory.getXmlBlasterClassLoader.
This line is raises the exception:
URL[] urls = ((URLClassLoader)this.getClass().getClassLoader()).getURLs();

kai schrieb:
> Hello everybody,
>
> I'm trying to run a xmblaster client as an osgi bundle. When loading the
>  standard prop file xmblaster ends in a class cast exeception, because
> it is not loaded with a URLClassloader.
>
> What will be the solution for this problem?
>
> Regards, Kai
>