users@jersey.java.net

Re: [Jersey] Client Help

From: Paul Sandoz <Paul.Sandoz_at_Sun.COM>
Date: Wed, 09 Jun 2010 17:00:20 +0200

On Jun 9, 2010, at 4:25 PM, Scott Glass wrote:

> Paul,
> Thank you for the reply. I haven't repackaged it, but it is being
> used in a "plug-in" for BMC's Action Request System (Remedy).
> I was including (in the classpath) jersey-core-1.2.jar then switched
> over to the jersey-bundle-1.2.jar. Both of which have resulted in
> the same response.
> Would it make more sense to re-package it and include my code?
>

No, i think this is a class loader issue as i suspect the plugin
defines some class loading scope.

Is it possible to set the thread context class loader to the class
loader of the current class?

   ClassLoader old = Thread.currentThread().getContextClassLoader();
    
Thread
.currentThread
().setContextClassLoader(this.getClass().getClassLoader());
   try {
     // Jersey client stuff
   } finally {
     Thread.currentThread().setContextClassLoader(old);
   }



I have fixed the loading of classes to use the class loader of the
current class if class loading fails using the context class loader.
When a new 1.3-SNAPSHOT is available on the maven repo could you give
that a try and see if that fixes the problem for you?

Paul.