cq5 - JCR session created using ResourceResolver returns null -


i trying implement example

https://helpx.adobe.com/experience-manager/using/querying-experience-manager-data-using1.html

but in following code

resourceresolver resourceresolver = resolverfactory.getadministrativeresourceresolver(null); session = resourceresolver.adaptto(session.class);

resourceresolver.adaptto returns null everytime

any appreciated.thanks in advance.

please check whether resolverfactory returning object. if not, session null. if have not made use of @reference annotation resolverfactory reference, please make use of , see if returns resolverfactory,reference follows:

@reference private resourceresolverfactory resolverfactory;

if using httpslingservlet , can session using sling request shown below. slinghttpservletrequest.getresourceresolver() method reference can follow below api.

https://sling.apache.org/apidocs/sling5/org/apache/sling/api/resource/resourceresolver.html

this might solution. if doesn't work, can please share entire code easy track exact reason why returning null value.


Comments

Popular posts from this blog

facebook - android ACTION_SEND to share with specific application only -

python - Creating a new virtualenv gives a permissions error -

javascript - cocos2d-js draw circle not instantly -