Solved
LoginService
session = repository.loginService("SystemUserMysite", repository.getDefaultWorkspace());
This line throwing an exception as Can neither derive user name nor principal names for bundle
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.
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.