SAML Linkage error. | Community
Skip to main content
Level 2
July 18, 2016
Solved

SAML Linkage error.

  • July 18, 2016
  • 5 replies
  • 3044 views

Hi,

We are trying to post a SAML request from AEM. For that we have created a AEM servlet which frame SAML request and do a post call.While building the bundle in eclipse we didnt get any error but when we install the bundle in Felix console we are having some reference errors. To resolve these reference errors we kept all required dependency jars(SAML related Jars) in one bundle and then uploaded this bundle before we upload our project bundle. This resolved all the dependency issues (our project bundle is in active state.now and servlet got registered()

 

But when we call our servlet we are getting below Linkage error in error.log file.

Error in error.log file : java.lang.LinkageError: loader constraint violation: when resolving field "DEFAULT_ELEMENT_NAME" the class loader (instance of org/apache/felix/framework/BundleWiringImpl$BundleClassLoaderJava5) of the referring class, org/opensaml/saml2/core/AuthnRequest, and the class loader (instance of org/apache/felix/framework/BundleWiringImpl$BundleClassLoaderJava5) for the field's resolved type, javax/xml/namespace/QName, have different Class objects for that type

Java code which is causing the issue in servlet: 

AuthnRequest authnRequest =  buildSamlObject(AuthnRequest.DEFAULT_ELEMENT_NAME,AuthnRequestBuilder.class);

Can any one please let me know what could be the issue here.

Thanks in advance.

Regards,

Kalyan

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 kalyanc42390873

I have updated "Imported-Packge" & "Exported-Packge" sections in the manifest file of dependency bundle (by keeping only required references).Then the above Linkage error problem was solved.

5 replies

Level 2
July 18, 2016

My dependency bundle contains below jars.

jce.jar

joda-time-1.6.jar

logback-classic-1.0.13.jar

logback-core-1.0.13.jar

opensaml-2.6.4.jar

openws-1.4.2-1.jar

qname.jar

slf4j.jar

w3c-dom.jar

xmltooling-1.4.1.jar 

smacdonald2008
Level 10
July 18, 2016

I have sent this question to some of our internal experts to see if anyone has encountered this issue. 

Adobe Employee
July 18, 2016

First off, since AEM supports SAML already, this is all unnecessary.

In this particular case, you are likely embedding classes which should not be embedded because they are available from the JRE, via the system bundle. You are also embedding log bundles which are already available inside AEM.  I'd suggest removing all those embedded jars and only embedding the ones which are strictly necessary.

Level 2
July 19, 2016

smacdonald2008 & justin_at_adobe , Thanks for the reply.

 

Initially when we installed our project bundle we didnt install the dependency jars thinking that most of the classes will be available in OSGI container itself. But after installing our project bundle it still showing SAML references issues (which its not able to find withing OOTB OSGI container classes). thats why we have packed all these jars again and uploaded as dependency bundle.

kalyanc42390873AuthorAccepted solution
Level 2
July 19, 2016

I have updated "Imported-Packge" & "Exported-Packge" sections in the manifest file of dependency bundle (by keeping only required references).Then the above Linkage error problem was solved.