Error while reading DAM | Community
Skip to main content
New Participant
Aug 25, 2020 8:40 AM UTC
Solved

Error while reading DAM

When I try reading JSON file from DAM using resolver factory I am getting null pointer.

 

Tried many ways. I am using servlet call.

 

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Nikhil-Kumar
Nikhil-KumarAccepted solution
New Participant
Aug 25, 2020 8:45 AM UTC

@lk08 

Try reading it using service user. 
You can create a systme user by going to /crx/exlporer and then later assign the read/write permissions in /useradmin

 


Once you are done creating the user, try the resolverFactory code to get the resource resolver and then resource out of it.

Map<String, Object> param = new HashMap<>();
param.put(ResourceResolverFactory.SUBSERVICE, "serviceUser");
ResourceResolver resourceResolver = resolverFactory.getServiceResourceResolver(param);

Happy Coding!!


Thanks,
Nikhil


4 replies

Nikhil-Kumar
Nikhil-KumarAccepted solution
New Participant
Aug 25, 2020 8:45 AM UTC

@lk08 

Try reading it using service user. 
You can create a systme user by going to /crx/exlporer and then later assign the read/write permissions in /useradmin

 


Once you are done creating the user, try the resolverFactory code to get the resource resolver and then resource out of it.

Map<String, Object> param = new HashMap<>();
param.put(ResourceResolverFactory.SUBSERVICE, "serviceUser");
ResourceResolver resourceResolver = resolverFactory.getServiceResourceResolver(param);

Happy Coding!!


Thanks,
Nikhil


Translate
lk08Author
New Participant
Aug 25, 2020 8:50 AM UTC
was trying out with getAdministrativeResourceResolver(null),
Translate