Expand my Community achievements bar.

SOLVED

What is the best way to get the ResourceResolver in AEM6.1

Avatar

Level 7

Hi Team,

What is the best way to get the ResourceResolver and Resource in AEM6.1? I followed this http://www.accunitysoft.com/resourceresolver-object-in-aem6-16-0-sling-services/ but I'm getting resource as null. I used "admin" instead of "testUser" user.

Thanks,

AryA.

1 Accepted Solution

Avatar

Correct answer by
Level 10

IN AEM 6.1 -- you need an AEM system user -- see this community article: 

https://helpx.adobe.com/experience-manager/using/jqom.html

It shows you how to setup the system user and properly run this code:

Map<String, Object> param = new HashMap<String, Object>();
        param.put(ResourceResolverFactory.SUBSERVICE, "jqom");
        ResourceResolver resolver = null;
          
        try {
                     
            //Invoke the getServiceResourceResolver method to create a Session instance
            resolver = resolverFactory.getServiceResourceResolver(param);

View solution in original post

1 Reply

Avatar

Correct answer by
Level 10

IN AEM 6.1 -- you need an AEM system user -- see this community article: 

https://helpx.adobe.com/experience-manager/using/jqom.html

It shows you how to setup the system user and properly run this code:

Map<String, Object> param = new HashMap<String, Object>();
        param.put(ResourceResolverFactory.SUBSERVICE, "jqom");
        ResourceResolver resolver = null;
          
        try {
                     
            //Invoke the getServiceResourceResolver method to create a Session instance
            resolver = resolverFactory.getServiceResourceResolver(param);