Expand my Community achievements bar.

Resource resolver issue in aem 6.2 publishers only

Avatar

Level 2

Hi ,

we recently upgraded from 5.6.1 to AEM 6.2.

we have a following logic in one of OSGI services.

we are getting the below exception only in publisher while the same logic is working fine in author.

we have given currently the root permissions for the user- xml service and used it in user mapper service along with amendment configurations.

please help in resolving the below issue.

LOGIC:

Map<String, Object> param = new HashMap<String, Object>();

param.put(ResourceResolverFactory.SUBSERVICE, "XmlService");

try {

   //return factory.getAdministrativeResourceResolver(null);
   return factory.getServiceResourceResolver(param);

} catch (Exception e) {

   LOG.info("exception for resource resolver is:" , e);

   throw new RepositoryAccessException("Unable to get administrative resource resolver", e);

}

Resource resource = resolver.getResource("/etc/leads/templates/" + file + ".xml");

LOG.info("the resource is :"+resource.getPath());

InputStream is = resource.adaptTo(InputStream.class);

EXCEPTION:

/content/drive/en_gb/cars/new/corporates/request-a-demo/_jcr_content/formsPar/form.submit.html HTTP/1.1] com.lux.drive.sales.countrySpecific.en.service.formatter.XmlService total exception inside format lead main method is :

java.lang.IllegalStateException: Resource resolver is already closed.

        at org.apache.sling.resourceresolver.impl.ResourceResolverImpl.checkClosed(ResourceResolverImpl.java:202)

        at org.apache.sling.resourceresolver.impl.ResourceResolverImpl.getResource(ResourceResolverImpl.java:641)

        at

2 Replies

Avatar

Community Advisor

Hi Krish

    I believe the link shared by abhishek should have answer to your question. But a little digging around the web landed me in this JIRA ticket [SLING-7019] MapEntries class causes IllegalStateException: Resource resolver is already closed - AS... Are you seeing the issue in MapEntries ? If not then there should be some other class which is closing your sessions

     What version of AEM are you using ?

Thanks

Veena