Expand my Community achievements bar.

SOLVED

SAML Linkage error.

Avatar

Level 3

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

1 Accepted Solution

Avatar

Correct answer by
Level 3

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.

View solution in original post

5 Replies

Avatar

Level 3

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 

Avatar

Level 10

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

Avatar

Employee

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.

Avatar

Level 3

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.

Avatar

Correct answer by
Level 3

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.