Expand my Community achievements bar.

Adobe Summit 2025: AEM Session Recordings Are Live! Missed a session or want to revisit your favorites? Watch the latest recordings now.

Mark Solution

This conversation has been locked due to inactivity. Please create a new post.

Null Pointer Exception for ModifiableValueMap.

Avatar

Level 4

Hi,

I have a resource. I am trying to set property for that resource using ModifiableValueMap. When I tried this I am getting null pointer exception even through that resource is available. What could be the reason and how to fix it. Thanks in advance.

Code Sample:

ModifiableValueMap map= resource.adaptTo(ModifiableValueMap.class);

map.put("property","property valuse");

Regards,

Vasim

3 Replies

Avatar

Level 2

ModifiableValueMap Not Found: Considerations in Using ModifiableValueMaps in an API | 6D Labs

Use your own resolver to get the resource then adopt that resource as modifiableValueMap.

Avatar

Employee

Do you have the right permissions? Can you share the stacktrace, so we can see where it is failing.

Avatar

Level 4

I have created a system user and added him to administrators group. I am using his resource resolver to set property.