try setting the context classloader to the classloader of your bundle
before you make calls that use axis.

ClassLoader tccl = Thread.currentThread().getContextClassLoader();
try
{
    
Thread.currentThread().setContextClassLoader(this.getClass().getClassLoader());
    // do stuff
}
finally
{
    Thread.currentThread().setContextClassLoader(tccl);
}

Alternatively, try to set the context classloader to null before you
create and start felix.

Let us know whether that helps.

regards,

Karl

On Thu, Oct 16, 2008 at 1:53 AM, Per-Erik Svensson
<[EMAIL PROTECTED]> wrote:
> Hi,
>
>
>
> I am using Felix (embedded-style) to create a small plug-in system to our
> application. I have built a bundle using Apache Axis to connect to a
> webservice. The bundle registers with the main application (which of course
> has started up Felix) and upon request from the main app calls the
> webservice and returns the results to the main app. (Basically.) The
> manifest of the bundle looks like this:
>
>
>
> Bundle-Name: A name
>
> Bundle-Description: A description
>
> Bundle-Vendor: 2c8
>
> Bundle-Version: 1.0.0
>
> Bundle-Activator: se.xxx.model.DocumentServiceImpl
>
> Import-Package: org.w3c.dom, javax.naming, javax.xml.parsers, org.xml.sax,
> se.conciliate.extensions.documentservice, org.osgi.framework
>
> Bundle-Classpath: ., jaxrpc.jar, axis.jar, commons-logging-1.0.4.jar,
> commons-discovery-0.2.jar
>
>
>
> Now, when the call from the main app tracks its way down to
> DocumentServiceImpl .someMethod(), an exception is thrown from Axis:
>
>
>
> java.lang.ExceptionInInitializerError
>
>        at org.apache.axis.client.Service.getAxisClient(Service.java:104)
>
>        at org.apache.axis.client.Service.<init>(Service.java:113)
>
> a couple of "at se.ourclasses." followed by
>
>
>
> Caused by: org.apache.commons.logging.LogConfigurationException:
> org.apache.commons.logging.LogConfigurationException:
> org.apache.commons.logging.LogConfigurationException: Invalid class loader
> hierarchy.  You have more than one version of
> 'org.apache.commons.logging.Log' visible, which is not allowed. (Caused by
> <same exception again*2>)
>
>
>
> This is the interesting parts of the stack trace (I think?). Apparently
> commons-logging does not like to have more than one instance of
> org.apache.commons.logging.Log visible on the class path. Problem is, I'm
> not using it - Axis is. I've read about PaxLogging but I'm not sure how to
> make Axis use another logging facility. If anyone could help me to set up my
> (relatively small) bundle so that it can make the webservice calls it needs
> to, I'd be very grateful! Or rather, if anyone could guide me through how to
> set up a bundle, that uses libraries, that need commons-logging.
>
>
>
> I should maybe mention also, that we use Axis for other purposes in our main
> app. This must be where the other instance of org.apache.commons.logging.Log
> is made visible?? (I don't export this from the system bundle however so I
> don't get how this can interfere. Isn't the osgi framework supposed to
> guarantee that a bundle only get exposed to one instance of each class, no
> matter how badly I as a developer screw things up?)
>
>
>
> Since commons-logging is used by many other Apache distributions this must
> be a somewhat frequent problem. I have not managed to find a solution though
> so I hope that this isn't already answered in a thousand other places. All
> I've managed to find is that commons-logging is not suited to "bundleize".
>
>
>
> Please be kind if I've misunderstood something badly. I'm new to both Felix
> and Axis (and don't know much about logging either). ;-)
>
>
>
> Regards,
>
> Per-Erik Svensson
>
>



-- 
Karl Pauls
[EMAIL PROTECTED]

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to