Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.
SOLVED

LoginService

Avatar

Level 2
 session = repository.loginService("SystemUserMysite", repository.getDefaultWorkspace());
 
This line throwing an exception as Can neither derive user name nor principal names for bundle 
           
1 Accepted Solution

Avatar

Correct answer by
Level 2

Thank you all now it's working. There was a mistake in the symbolic name i have given.

View solution in original post

10 Replies

Avatar

Community Advisor

Hello @Keerthi987 

 

I guess you are missing the config for 

org.apache.sling.serviceusermapping.impl.ServiceUserMapperImpl. Please follow the link to configure Service User. You would also need to update the API

 

 

https://medium.com/@toimrank/aem-service-user-mapping-and-resourceresolver-bd4a15d8cff2


Aanchal Sikka

Avatar

Level 2

no I mapped service user. does default workspace points to 4502?

Avatar

Community Advisor

@Keerthi987 : 

 

I have been using getServiceResourceResolver for a long time. 

 

The loginService() is creating issue after upgrade everywhere? Or in a specific case only?


Aanchal Sikka

Avatar

Community Advisor

Have you correctly written the config file for SysytemUserMysite?

In your org.apache.sling.serviceusermapping.impl.ServiceUserMapperImpl.amended-my-project.config file 

# Configuration created by Apache Sling JCR Installer
service.ranking=I"100"
user.mapping=["com.my-project:SystemUserMysite\=your-service-user-name"]

See this documentation: https://aemhints.com/2020/11/08/service-users-mapper-aem/ 

Avatar

Community Advisor

Hello @Keerthi987 ,

Please make sure you correctly referenced this.

user.mapping=["SymbolicNameFromBundle:SystemUserMysite\=your-service-user-name"]

 Go to the http://localhost:4502/system/console/bundles

Search for your bundle and get the Symbolic Name

Sady_Rifat_0-1686219489625.png

 

Otherwise, there should not be any issue if you correctly create the service user.

 

Avatar

Correct answer by
Level 2

Thank you all now it's working. There was a mistake in the symbolic name i have given.

Avatar

Community Advisor

@Keerthi987  - 

 

Do you have the System User available in the given environment/AEM Local wherever you are executing this?