Issue

When trying to adapt the resource resolver to a CommerceService object, for example in the code below, then it returns null or "undefined":

var commerceService = resource. getResourceResolver(). adaptTo( com. adobe. cq. commerce. api.CommerceService); 

In this case, the class com.adobe.cq.commerce.api.CommerceService is available in the OSGi Class Loader. To confirm this, refer to the OSGi console using the http://aem-host:port/system/console/depfinder tool. 

 

Cause

This issue is by design.

Resolution

Implement your own versions of the services provided in the cq-geometrixx-commons-core bundle provided under /apps/geometrixx-commons, when implementing an application using the AEM Commerce APls.

The Geometrixx ones are just samples, and it is not recommended to install Geometrixx in production, for security reasons. If you do not implement your own version of the CommerceServiceFactory, then you would run into the issue described above if Geometrixx is not installed. 

See the sample source code that ships with AEM under these paths: 

/apps/geometrixx-
commons/src/core/src/main/java/info/geometrixx/commons/impl/GeoCommerceServicelmpl.java 
/apps/geometrixx-
commons/src/core/src/main/java/info/geometrixx/commons/impl/GeoCommerceServiceFactory.java 
/apps/geometrixx-
commons/src/core/src/main/java/info/geometrixx/commons/impl/GeoCommerceSessionlmpl.java 
/apps/geometrixx-commons/src/core/src/main/java/info/geometrixx/commons/impl/productrelationships 

이 작업에는 Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License의 라이센스가 부여되었습니다.  Twitter™ 및 Facebook 게시물은 Creative Commons 약관을 적용받지 않습니다.

법적 고지 사항   |   온라인 개인 정보 보호 정책