In my CQ5.5 installation I have a component which sends html-mails and another component which uses CXF to import data from an external data provider (SOAP interface) and to render that data on a web page. Therefore, both components (which are packaged in different bundles) use javax.activation. The javax.activation package is provided by two different bundles, either by org.apache.felix.framework or by com.day.commons.osgi.wrapper.mail.
I’ve noticed that there’s some mutual exclusiveness. If I manage to obtain javax.activation from com.day.commons.osgi.wrapper.mail, I’m able to send html mails, but get an error (loader constraint violation, see [1]) when trying to get the data using CXF.
On the other side, if I manage to obtain javax.activation from org.apache.felix.framework, I’m able to get and render the data using CXF but fail when trying to send html formatted mails.
How can I solve this problem?
Note: I’m wrapping the calls to the JaxWs classes generated by CXF in an OSGI-aware classloader (by setting the classloader to the CXF bundle).
[1] Caused by: java.lang.LinkageError: loader constraint violation:
when resolving overridden method
"org.apache.cxf.jaxb.attachment.JAXBAttachmentMarshaller.addMtomAttach ment(Ljavax/activation/DataHandler;Ljava/lang/String;Ljava/lang/String ;)Ljava/lang/String;"
the class loader (instance of org/apache/felix/framework/ModuleImpl$ModuleClassLoaderJava5) of the current class,
org/apache/cxf/jaxb/attachment/JAXBAttachmentMarshaller, and its superclass loader (instance of <bootloader>),
have different Class objects for the type javax/activation/DataHandler used in the signature
Seems like third part jar also have javax.activation included causing classloaders for java.mail and javax.activation not be same raising LinkageError. See making javax.activation as part of the system packages helps. In order to do that add [1] at <cq_home>/crx-quickstart/conf/sling.properties, restart the server & verify.
[1] org.osgi.framework.system.packages.extra=javax.activation
Thanks for your reply.
Unfortunately, adding org.osgi.framework.system.packages.extra=javax.activation to sling.properties doesn't change the situation.
I'm only able to send html mails whereas trying to access the data using the CXF classes results in exactely the same loader constraint violation error as before.
Using the dependency finder in the Felix console to look up the packages using javax.activation, I now get the following result:
javax.activationcom.day.commons.osgi.wrapper.mail (78) and 1 others.
Any other ideas to solve this problem?
Adding com.day.commons.osgi.wrapper.mail.system.packages.extra=javax.activati on to sling.properties did not improve the situation.
Do you mean "dependecy finder"? I didn't find a dependency filter possibility in the Felix web console, therefore, I post my results of the dependecy finder lookups for javax.activation:
===
with "org.osgi.framework.system.packages.extra=javax.activation"
Packages
Here are the packages you entered and by which bundle they are exported.
javax.activation com.day.commons.osgi.wrapper.mail (78) and 1 others.
Maven Dependencies
Here are the bundles listed above as Maven dependencies
<dependency>
<groupId>com.day.commons.osgi.wrapper</groupId>
<artifactId>com.day.commons.osgi.wrapper.mail</artifactId>
<version>1.4.0-0001</version>
<scope>provided</scope>
</dependency>
===
with "com.day.commons.osgi.wrapper.mail.system.packages.extra=javax.activa tion"
Packages
Here are the packages you entered and by which bundle they are exported.
javax.activation com.day.commons.osgi.wrapper.mail (78)
Maven Dependencies
Here are the bundles listed above as Maven dependencies
<dependency>
<groupId>com.day.commons.osgi.wrapper</groupId>
<artifactId>com.day.commons.osgi.wrapper.mail</artifactId>
<version>1.4.0-0001</version>
<scope>provided</scope>
</dependency>
===
with both settings
Packages
Here are the packages you entered and by which bundle they are exported.
javax.activation com.day.commons.osgi.wrapper.mail (78) and 1 others.
Maven Dependencies
Here are the bundles listed above as Maven dependencies
<dependency>
<groupId>com.day.commons.osgi.wrapper</groupId>
<artifactId>com.day.commons.osgi.wrapper.mail</artifactId>
<version>1.4.0-0001</version>
<scope>provided</scope>
</dependency>
===
I see only a small variation. With org.osgi.framework.system.packages.extra=javax.activation, the dependency finder reported one additional package exporting javax.activation.
I'm still stuck with this javax.activation problem.
I have the same problem as http://dev.day.com/discussion-groups/content/lists/cq-google/2011-01/2 011-01-19__day_communique_Error_javax_activation_UnsupportedDataTypeEx ception_no_object_DCH_for_MIME_type___N.html.
Unfortunately, the approach provided in that post doesn't work for me. I tried the thread context class loading trick only to find out that it didn't change anything in my case.
Are there any other approaches to overcome this problem?
North America
Europe, Middle East and Africa
Asia Pacific