LoginService | Community
Skip to main content
Level 2
Jun 7, 2023 11:24 AM UTC
Solved

LoginService

 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.
Keerthi987Accepted solution
Level 2
Jun 8, 2023 11:05 AM UTC

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.

10 replies

Tanika02
Level 7
Jun 7, 2023 12:05 PM UTC

@keerthi987  - 

 

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

Translate
Level 2
Jun 8, 2023 11:04 AM UTC

yes it is.

Translate
Sady_Rifat
New Participant
Jun 7, 2023 11:37 AM UTC

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/ 

Translate
Level 2
Jun 7, 2023 11:39 AM UTC

yes

Translate
Sady_Rifat
New Participant
Jun 7, 2023 11:43 AM UTC

Then please share the exception message

Translate
aanchal-sikka
New Participant
Jun 7, 2023 11:33 AM UTC

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

Translate
Aanchal Sikka
Level 2
Jun 7, 2023 11:34 AM UTC

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

Translate
aanchal-sikka
New Participant
Jun 7, 2023 11:42 AM UTC

@keerthi987 : 

 

I have been using getServiceResourceResolver for a long time. 

 

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

Translate
Aanchal Sikka