Expand my Community achievements bar.

Radically easy to access on brand approved content for distribution and omnichannel performant delivery. AEM Assets Content Hub and Dynamic Media with OpenAPI capabilities is now GA.

Error Login Exception, with the following message: LoginException. org.apache.sling.api.resource.LoginException: Cannot derive user name for bundle

Avatar

Level 4

I am using AEM 6.1 and trying to create session object. I have followed below steps -

1. Created a system user using crx explorer  - demoUser

2. In OSGI configuration updated user mapper service for the bundle id service details

<bundle-id>:writeService=demoUser

where bundle id is the actual id of bundle.

 

3. Try to get session using slingrepository.login("writeService",null) in my slingservlet. i am getting error Login Exception, with the following message:  LoginException. org.apache.sling.api.resource.LoginException: Cannot derive user name for bundle

Has anyone faced similar issue? All inputs are much appreciated. 

1 Reply

Avatar

Level 10

Hi,

Yes, I do also get the same error by using the slingrepository.login("writeService",null)

As kautuk said, follow the article that contains how to create a system user: https://helpx.adobe.com/experience-manager/using/querying-experience-manager-sling.html.  It worked for me. This is very easy way of creating system users.

// Map<String, Object> param = new HashMap<String, Object>();
param.put(ResourceResolverFactory.SUBSERVICE, "datawrite");

Hope this helps!!

Thanks,
Ratna Kumar.