Hello Marcel,
We tried setting the classloader in our own thread:
final ClassLoader cl = context.getClass().getClassLoader();
Thread thread = new Thread() {
public void run() {
Thread.currentThread().setContextClassLoader(cl);
PrifesPrinterService serv = new PrifesPrinterService();
PrifesPrinter pp = serv.getPrifesPrinterPort();
System.out.println(pp.sendData(1, 1, "Test"));
}
};
thread.start();
The context is the bundlecontext from the bundle which contains the
classes. We also tried getting the classloader from the master bundle,
but they all produce the same runtime modeler error.
Thanks for your help!
Stefan
On 4/8/08, Marcel Offermans <[EMAIL PROTECTED]> wrote:
> Hello Stefan,
>
> On Apr 8, 2008, at 15:30 , bitrain _ wrote:
>
>
> > We are building a bundle which must access a web service using jaxws,
> > but we keep hitting a problem.
> > When we load our bundle dynamically using another bundle we get the
> > following error: [...]
> >
>
> Just a wild guess, but sometimes these errors occur because of Java code
> using the context classloader to load classes. In OSGi, that context
> classloader might not be able to access all classes in the bundle.
>
> If that is indeed the problem, look for a way to set the correct
> classloader for that code (some libraries allows you to do that). The other
> alternative is to make sure that the thread that's going through your code
> has its context classloader set to the bundle classloader (but remember
> there that if this is not a thread you created, you might want to restore
> the original classloader afterwards). Alternatively, create your own, new
> thread and set its context classloader.
>
> Greetings, Marcel
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]