Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.
SOLVED

Loader constraint violation while invoking webservice from AEM 6.1

Avatar

Level 4

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?

1 Accepted Solution

Avatar

Correct answer by
Level 10

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

View solution in original post

1 Reply

Avatar

Correct answer by
Level 10

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