Hi all,
I am struggling with an issue regarding one EventListener I implemented, basically every time I need to get a session instance I get this:
org.apache.sling.api.resource.LoginException: Cannot derive user name for bundle com.mycompany.core [472] and sub service writeService
I found some information about what can be causing this issue:
http://stackoverflow.com/questions/31350548/resourceresolverfactory-getserviceresourceresolver-throw...
Also some more information about how AEM 6.1 works with ResourceResolverFactory to allow access to the repository:
http://www.aemcq5tutorials.com/tutorials/create-system-user-in-aem/
So I went ahead and changed some of my code:
1 - The implementation of the EventListener interface
http://paste.ofcode.org/GFN6QgDsfT76nAGKiRvJms
2 - I created a System User following the above indications called "sysuser" and I granted permissions to write, read, replicate, etc. below the path "/content/mywebsite"
3 - I added a config file under my /config folder: org.apache.sling.serviceusermapping.impl.ServiceUserMapperImpl.xml
with the following content:
<?xml version="1.0" encoding="UTF-8"?>
<jcr:root xmlns:jcr="http://www.jcp.org/jcr/1.0"
jcr:primaryType="sling:OsgiConfig"
user.mapping="[com.mywebsite.core:writeService=sysuser]"
user.default="admin"/>
Can someone spot if I am missing or doing something wrong? I still cannot get it to work.
I use AEM 6.1 with Service Pack 1.