Loader constraint violation while invoking webservice from AEM 6.1 | Community
Skip to main content
Level 3
October 23, 2017
Solved

Loader constraint violation while invoking webservice from AEM 6.1

  • October 23, 2017
  • 1 reply
  • 1928 views

Hi All,

We are getting below exception while invoking webservice from AEM.

org.apache.sling.api.scripting.ScriptEvaluationException: javax.servlet.ServletException: java.lang.LinkageError: loader constraint violation: when resolving overridden method "org.apache.cxf.jaxb.attachment.JAXBAttachmentMarshaller.addMtomAttachment(Ljavax/activation/DataHandler;Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;" the class loader (instance of org/apache/felix/framework/BundleWiringImpl$BundleClassLoaderJava5) 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

and we  were able to fix the issue  by setting below given property in sling.properties file as suggested in one of the adobe forum queries. (https://forums.adobe.com/thread/2336233 )

org.osgi.framework.system.packages.extra=javax.activation;version\="1.1.1”

But this fix is throwing an error in existing email sending functionality in our project. Exception is as follows,

“Error occurred while sending email: com.day.cq.mailer.MailingException: org.apache.commons.mail.EmailException: Sending the email to the following server failed"

so we have to revert our fix for class loader constraint viloation exception.

We have raised a daycare ticket for this and what they have mentioned was "The fix (modifying sling.properties) you have referred to is also from the forum is also from an older version of CQ and shouldn't be applied on top of AEM."

Could you please suggest an alternate solution for class loader constraint issue?

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by smacdonald2008

We have many examples of successfully invoking 3rd party web services (which expose a WSDL) from AEM.

We used CFX to create Java proxy classes and then bundle them into the OSGi bundle. See this article:

Creating an Experience Manager HTL Component that displays data from a SOAP Web Service

1 reply

smacdonald2008
smacdonald2008Accepted solution
Level 10
October 23, 2017

We have many examples of successfully invoking 3rd party web services (which expose a WSDL) from AEM.

We used CFX to create Java proxy classes and then bundle them into the OSGi bundle. See this article:

Creating an Experience Manager HTL Component that displays data from a SOAP Web Service