LoginService | Community
Skip to main content
Level 2
June 7, 2023
Solved

LoginService

  • June 7, 2023
  • 3 replies
  • 1979 views
 session = repository.loginService("SystemUserMysite", repository.getDefaultWorkspace());
 
This line throwing an exception as Can neither derive user name nor principal names for bundle 
           
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 Keerthi987

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

 

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

 


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

3 replies

aanchal-sikka
Community Advisor
Community Advisor
June 7, 2023

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
Level 2
June 7, 2023

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

aanchal-sikka
Community Advisor
Community Advisor
June 7, 2023

@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
Sady_Rifat
Community Advisor
Community Advisor
June 7, 2023

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/ 

Level 2
June 7, 2023

yes

Sady_Rifat
Community Advisor
Community Advisor
June 7, 2023

Then please share the exception message

Tanika02
Level 7
June 7, 2023

@keerthi987  - 

 

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

Level 2
June 8, 2023

yes it is.