Expand my Community achievements bar.

AEM 6.2/Getting 'Null' as ResourceResolver object in publisher instance

Avatar

Level 9

Hi All,

I am getting 'null' reference of resource resolver object using below code

resourceResolverFactory = sling.getService(ResourceResolverFactory.class);
adminRR = resourceResolverFactory.getServiceResourceResolver(null);

The same code is working fine is author but not in the publisher.

I have updated similar configuration(service user and updated configuration in 'Apache Sling Service User Mapper Service) in publisher as well.

If anyone has any idea please help me.

Thanks,

Kishore

4 Replies

Avatar

Level 7

Hi Kishore@CQ,

Is it a Service class, Servlet or a sightly helper class?

Thanks

Tuhin

Avatar

Level 10

Does your application has the login ??

Basically, in Author instance you would have logged in as Admin and hence getServiceResourceResolver(null) would work but ideally we should not be doing that way.

Create the sub service which has the user/group mapped to it and then use that subservice

getServiceResourceResolver(authInfo);

Avatar

Administrator

Hi, 

Please have a look at this old forum thread:- 

Link:- http://help-forums.adobe.com/content/adobeforums/en/experience-manager-forum/adobe-experience-manage...

//

NOTE: In AEM 6.1, service users must be system users, which effectively means that their node in the JCR is of type rep:SystemUser. These users cannot be used to log in normally, only by background processes. The admin user is not a system user, so you cannot use the admin user in a service user mapping like this. You have to create a new system user and assign them the appropriate permissions.If you would like to read more of the background on this change, take a look at https://issues.apache.org/jira/browse/SLING-3854.

 

Please have a look at this Adobe Helpx Article :- http://helpx.adobe.com/experience-manager/using/querying-experience-manager-sling.html [This article covers Querying Adobe Experience Manager 6 data using the Sling getServiceResourceResolver method].

I hope this will help you.

Thanks and Regards

Kautuk Sahni



Kautuk Sahni