can anyone tell me how I solve the problem?loader constraint violation: when resolving interface method "NavigationService.getNav()Lorg/json/JSONObject;" the class loader (instance of org/apache/sling/commons/fsclassloader/impl/FSDynamicClassLoader) of the current class, org/apache/jsp/apps/global/components/skizz_005f1_005f4_005f0/molecules/navigations/nav_jsp, and the class loader (instance of org/apache/felix/framework/BundleWiringImpl$BundleClassLoaderJava5) for the method's defining class, NavigationService, have different Class objects for the type org/json/JSONObject used in the signature
Solved! Go to Solution.
Views
Replies
Total Likes
Looks like you did not bundle the JSON Java JAR into an OSGi bundle.
When referencing a Java lib (a JAR) in your AEM service - you need to:
1 - reference it into your POM (which you did)
2 - place into an OSGi bundle and place in active state
See this community article that shows how to bundle JSON Java JAR into a bundle fragment and deploy:
https://helpx.adobe.com/experience-manager/using/custom-sling-servlets.html
Views
Replies
Total Likes
Please provide more details - looks like you are trying to build an OSGi bundle via Maven - what APIs are you working with and have included in your POM file's dependencies section?
Views
Replies
Total Likes
Yes i have make a Java Class(Service) That return a json object.
-----
<dependency>
<groupId>org.json</groupId>
<artifactId>json</artifactId>
<version>20140107</version>
</dependency>
import org.json.JSONObject;
public JSONObject getNav() {
JSONObject objNav = new JSONObject().put("nav", nav);
return objNav;
}
------
I have Deploy it in OSGI Console.
Nkow the Probleme ist i want to use it in my JSP File
<%@ page import="com.day.cq.wcm.api.WCMMode,
org.json.JSONObject" %>
<% yy.etat.xx.NavigationService NavigationService = sling.getService(yy.etat.xx.NavigationService.class); %>
/// THE ERROR CAME FORM HIER
NavigationService.getNav();
iT RETURN A JSON oBJECT
Views
Replies
Total Likes
Looks like you did not bundle the JSON Java JAR into an OSGi bundle.
When referencing a Java lib (a JAR) in your AEM service - you need to:
1 - reference it into your POM (which you did)
2 - place into an OSGi bundle and place in active state
See this community article that shows how to bundle JSON Java JAR into a bundle fragment and deploy:
https://helpx.adobe.com/experience-manager/using/custom-sling-servlets.html
Views
Replies
Total Likes
I to facing the similar issue , The error i am facing is .
Caused by: java.lang.LinkageError:
loader constraint violation: when resolving interface method
"com.day.cq.wcm.api.Page.listChildren(Lcom/day/cq/commons/Filter;)Ljava/util/Iterator;" the class loader (instance of org/apache/felix/framework/BundleWiringImpl$BundleClassLoaderJava5) of the current class,
com/thermo/wcm/tags/Functions, and the class loader (instance of org/apache/felix/framework/BundleWiringImpl$BundleClassLoaderJava5) for the method's defining class,
com/day/cq/wcm/api/Page, have different Class objects for the type com/day/cq/commons/Filter used in the signature
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies
Views
Likes
Replies
Views
Likes
Replies