2008/10/16 Per-Erik Svensson <[EMAIL PROTECTED]>

> 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?)
>

just want to address this particular point - OSGi sits on top of the JVM,
and is therefore limited in what it can completely hide away from view.

this means that it is possible to see other classes instances by using
invasive methods like reflection - several third-party libraries use these
approaches (ironically often to avoid or warn about the very modularity
problems that OSGi solves) and this may be happening here

[ just like you can change internal private member fields using reflection ]

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
>

-- 
Cheers, Stuart

Reply via email to