AEM6.1 Service User Issue | Community
Skip to main content
Level 2
October 16, 2015
Solved

AEM6.1 Service User Issue

  • October 16, 2015
  • 10 replies
  • 5651 views

Hello,

 
We have been working with AEM 6.0SP2 and are now moving into AEM 6.1.
During our upgrade from CQ 5.6.1 to AEM 6.0SP2 we converted over all our uses of admin sessions (via resourceResolver.loginAdministrative()) to use service users instead.
 
Here's a snippet of how we get a service user:

 

try { Map<String, Object> param = new HashMap<String, Object>(); param.put(ResourceResolverFactory.SUBSERVICE, "contentReadService"); this.serviceResourceResolver = this.resourceResolverFactory.getServiceResourceResolver(param); if (this.serviceResourceResolver != null) { LOG.debug("New resource resolver found"); } } catch (LoginException e) { LOG.error("error getting resource resolver"); LOG.error(e.getMessage()); }

 

By the above code we should be looking for the "contentReadService" subservice from the current bundle (we'll call the bundle XXX).
 
In the "Apache Sling Service User Mapping Service" we have the following configuration:
XXX:contentReadService=service_content_read
So my understanding is that the "contentReadService" in the bundle "XXX" should be assigned the user "service_content_read". This user does exist.
 
This worked great in AEM 6.0SP2, but as of AEM 6.1 i see the following error in the log:
02.06.2015 10:28:51.802 *ERROR* [qtp1426607298-4062] error getting resource resolver
02.06.2015 10:28:51.802 *ERROR* [qtp1426607298-4062] Cannot derive user name for bundle XXX [449] and sub service contentReadService
We can see from the code that the "error getting resource resolver" is something i'm putting in, so the following error is the error message of the LoginException in that final catch block.
 
Has anyone experienced a similar issue?
 
Thanks,
Kyle 
This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by Alex Collignon

Yes, this is a requirement. The user node needs to have the following properties

  • jcr:primaryType="rep:SystemUser"
  • jcr:uuid="<some value>"
  • rep:principalName="<some value>"
  • rep:authorizableId="<some value>"

Note also that the user *must not have* a password.

I'm creating a sling doc patch at the minute, I'll let you know once it is published.

10 replies

kgioAuthor
Level 2
October 16, 2015

Also, 

 

I have noticed the "Apache Sling Service User Mapper Service Amendment" factory, which is a much better way of managing these service users. 

Tried that, same results.

 

Thanks,

kyle

Level 4
October 16, 2015

Same issue here...

 

Was able to solve it by creating a "rep:SystemUser". Looks like it MUST be such a user.

Adobe Employee
October 16, 2015

Kyle Giovannetti wrote...

Also, 

 

I have noticed the "Apache Sling Service User Mapper Service Amendment" factory, which is a much better way of managing these service users.

The User Mapper Service Amendment factory is indeed the right choice. I'm currently gathering information and hoping to publish something by end of the week.

Keep you posted,

Alex

October 16, 2015

maggod wrote...

Same issue here...

 

Was able to solve it by creating a "rep:SystemUser". Looks like it MUST be such a user.

 

 

Can you elaborate or post example on how you were using "Apache Sling Service User Mapper Service Amendment" factory. I'm using AEM 6.1 and "resourceResolverFactory.getServiceResourceResolver" is failing with Login Exception.

Alex CollignonAdobe EmployeeAccepted solution
Adobe Employee
October 16, 2015

Yes, this is a requirement. The user node needs to have the following properties

  • jcr:primaryType="rep:SystemUser"
  • jcr:uuid="<some value>"
  • rep:principalName="<some value>"
  • rep:authorizableId="<some value>"

Note also that the user *must not have* a password.

I'm creating a sling doc patch at the minute, I'll let you know once it is published.

kgioAuthor
Level 2
October 16, 2015

That was exactly the issue.

I had to create the service user through CRX Explorer.

 

 

Thanks,

Kyle

October 16, 2015

Alexandre COLLIGNON wrote...

Yes, this is a requirement. The user node needs to have the following properties

  • jcr:primaryType="rep:SystemUser"
  • jcr:uuid="<some value>"
  • rep:principalName="<some value>"
  • rep:authorizableId="<some value>"

Note also that the user *must not have* a password.

I'm creating a sling doc patch at the minute, I'll let you know once it is published.

 

I had the same problem but now you solved it with your answer.Thanks!

chao_wang
October 16, 2015

Is it possible to create system user without using admin account? What priviledge is needed?

I am using AEM 6.1.

October 16, 2015
October 16, 2015

I may have to take back.. works only with a "system user" and not with a regular user as i mentioned earlier.

Updated my post here as well:

http://stackoverflow.com/questions/31350548/resourceresolverfactory-getserviceresourceresolver-throws-exception-in-aem-6-1