Hi David,

Could you put that activation bundle into the endorsed dir so that all 
activation class and java.awt.datatransfer.DataFlavor could be loaded from 
system class loader to avoid this problem? That's what Karaf do currently, you 
can see org.apache.servicemix.specs.activation-api-1.1-2.4.0.jar in 
$KARAF_HOME/lib/endorsed.

-------------
Freeman(Yue) Fang

Red Hat, Inc. 
FuseSource is now part of Red Hat



On 2015-4-21, at 下午9:23, David Bosschaert wrote:

> Hi all,
> 
> Apologies for posting to the Karaf list as this is not really a Karaf
> issue, but I this list may contain people that might have come across
> this issue as well.
> 
> I have some code that runs in OSGi that uses
> javax.activation.DataHandler. As this is javax... you should be able
> to provide your own bundle providing these classes. So I have a bundle
> that provides an alternative javax.activation.DataHandler. Now it
> turns out that this class has a dependency on
> java.awt.datatransfer.DataFlavor, a java.awt class! The DataFlavor
> code is kicked in from DataHandler, but then DataFlavor tries to load
> some classes too, in my case it tries to load DataHandler again. The
> code in DataFlavor tries to load classes from the System Classloader
> first, so it finds the javax.activation.DataHandler in the JRE and
> loads that -> boom LinkageError.
> 
> I was wondering whether there are any 'fixed' versions of
> javax.activation that don't expose this behaviour and work properly in
> a modular environment like OSGi.
> 
> Many thanks,
> 
> David

Reply via email to