Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.
SOLVED

Getting NonExistingResource exception while using resourceresolver resolve method + Adobe 5.4

Avatar

Level 3

All,

Its a very confusing problem which i am facing. I have following path in cq dam:/content/dam/example/test/language. Inside this path i have json and zip files. In my code i am using resourceresolver.resolve and passing above path along with json file name. When i print the output of above method i get "NonExistingResource", but when i copy the same path on browser i am getting correct json file. Also using DAM i can navigate to that path without any issues. Also, i have few json files in parent folder i.e. in "test" folder which i am able to retreive successfully using resourceResolver.resolve method.

Does anyone faced this issue before? What can be probable cause for this? How do i resolve it?

Adobe CQ version 5.4

Regards,

Mayank

1 Accepted Solution

Avatar

Correct answer by
Level 10

Why are you trying to adopt json into asset?  It should be something like [1]

[1]   resourceResolver.resolve("/content/dam/geometrixx/documents/GeoCube_Datasheet.pdf").adaptTo(Asset.class)

View solution in original post

4 Replies

Avatar

Level 10

Can you please post your code so we can see exactly what you are trying to do. 

Avatar

Level 3

Sure,

Below is the code:

resourceResolver.resolve("/content/dam/example/test/language/en.json").adaptTo(Asset.class).

Another interesting thing which i noticed when i do

resourceResolver.resolve("/content/dam/example/test/language").adaptTo(Asset.class), i still get NonExistingResource 

Regards,

Mayank

Avatar

Correct answer by
Level 10

Why are you trying to adopt json into asset?  It should be something like [1]

[1]   resourceResolver.resolve("/content/dam/geometrixx/documents/GeoCube_Datasheet.pdf").adaptTo(Asset.class)

Avatar

Level 3

Sham,

 

I need to update json with modified content hence i am adapting to Asset. Anyways i found out root cause, it was due to session getting close in one scenario which was causing this issue. Thanks Sham and macdonald for looking into my problem.

 

Regards,

Mayank