Close resourceResolver from JSP | Community
Skip to main content
sandeepm744005
Level 5
March 10, 2016
Solved

Close resourceResolver from JSP

  • March 10, 2016
  • 2 replies
  • 1460 views

JSP is calling some APIs which resides inside the bundle and performing some operations with ResourceResolver object. These APIs which resides inside the bundles are getting the resourceResolver object from the SlingRequest like -  resourceResolver = SlingHttpServletRequest.getResourceResolver();    

When I am trying to close the resourceResolver object inside the APIs or in the JSP page inside the finally block after the code execution, it is throwing exception that "Resource Resolver is already closed". 

Please advice, should i close the ResouceResolver after execution of the APIs or i can let it open to make my code working.

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by Kunal_Gaba_

You are not required to close the resource resolver which is bound to the request object as it is opened/managed by the Sling internally. You should close only those resource resolvers which you open explicitly yourself in your code. 

2 replies

Kunal_Gaba_
Kunal_Gaba_Accepted solution
March 10, 2016

You are not required to close the resource resolver which is bound to the request object as it is opened/managed by the Sling internally. You should close only those resource resolvers which you open explicitly yourself in your code. 

sandeepm744005
Level 5
March 10, 2016

Thanks Kunal, very much appreciated.