ACS Commons - Error Handling ResourceResolver Closed

classic Classic list List threaded Threaded
10 messages Options
Reply | Threaded
Open this post in threaded view
|

ACS Commons - Error Handling ResourceResolver Closed

kharris@siteworx.com
This is a similar issue to the one described in http://slice-users.2340343.n4.nabble.com/Error-Handling-404-500-td48.html.

I'm still having issues when using https://adobe-consulting-services.github.io/acs-aem-commons/features/errorpagehandler.html after upgrading to v4.3.1 to get around the SlingHttpServletRequest error described in the other issue.

I am now getting errors trying to Inject the ResourceResolver or even trying to get the ResourceResolver from the request object. I'm getting errors saying the resource resolver is already closed.

@CurrentPage is also failing with the same error. Is there a fix on your end for this by chance?

Thanks much
Reply | Threaded
Open this post in threaded view
|

Re: ACS Commons - Error Handling ResourceResolver Closed

maciej.majchrzak
Administrator
Hi there,

Would you be able to provide more info on this? Especially where exactly are you having the issue, how the model was created, etc.

Cheers
Maciej
Reply | Threaded
Open this post in threaded view
|

Re: ACS Commons - Error Handling ResourceResolver Closed

kharris@siteworx.com
Sure thing Maciej, we have several models like this, but this is the main one for our page. In this scenario when using the ACS Commons Error Handler there is an error getting CurrentPage:

@SliceResource
public class PageModel implements InitializableModel {

    @JcrProperty
    private String pageTitle;
    
    @JcrProperty("jcr:title")
    private String jcrTitle;

    @Inject
    public PageModel(@CurrentPage Page page, SlingHttpServletRequest request, ResourceResolver resourceResolver) {
        ...
    }

    @Override
    public final void afterCreated() { 
        ...
    }
}

Error in custom provider, java.lang.IllegalStateException: Resource resolver is already closed.
  at com.cognifide.slice.cq.module.CQModule.getPageManager(CQModule.java:47)
  at com.cognifide.slice.cq.module.CQModule.getPageManager(CQModule.java:47)
  while locating com.day.cq.wcm.api.PageManager
  at com.cognifide.slice.cq.module.CurrentPageModule.getCurrentPage(CurrentPageModule.java:44)
  while locating com.day.cq.wcm.api.Page annotated with @com.cognifide.slice.cq.qualifier.CurrentPage()
    for parameter 0 at com.aem.models.page.PageModel.<init>(PageModel.java:52)
  while locating com.aem.models.page.PageModel



If I remove the necessity for Injecting CurrentPage and ResourceResolver and just try to get the resource resolver from the request (request.getResourceResolver()) it is always already closed. This effectively makes all of our existing models not work later on the page as well.

Hopefully this helps, let me know if you need anything else.

- Kevin
Reply | Threaded
Open this post in threaded view
|

Re: ACS Commons - Error Handling ResourceResolver Closed

maciej.majchrzak
Administrator
Cool, thanks. We'll take a look at this once again as there apparently must be some issue ;) We'll get back to you on this.

Cheers
Maciej
Reply | Threaded
Open this post in threaded view
|

Re: ACS Commons - Error Handling ResourceResolver Closed

kharris@siteworx.com
Great, thanks Maciej.

Any chance you have a rough ETA on when you'd have a fix or even a workaround? We're coming up on the end of a project that this is required for.

Appreciate it
Reply | Threaded
Open this post in threaded view
|

Re: ACS Commons - Error Handling ResourceResolver Closed

maciej.majchrzak
Administrator
Hello,

apologies for delayed answer (I was on longer holidays). I've checked this yesterday, and looks like it can be fixed. However, I still need to make sure that the fix doesn't cause a wider regression... if it's working well, you'll get a new version of Slice with included fix by the end of next week. If it's not, then I will at least provide you with some support on how to make the ACS error handler working with Slice.

Regards
Maciej
Reply | Threaded
Open this post in threaded view
|

Re: ACS Commons - Error Handling ResourceResolver Closed

kharris@siteworx.com
Thanks Maciej, very much appreciated. Will look forward to hearing from you.
Reply | Threaded
Open this post in threaded view
|

Re: ACS Commons - Error Handling ResourceResolver Closed

maciej.majchrzak
Administrator
I've just merged fixed to master branch. I'll release on Monday. If you're curious you can try cloning the repo and installing SNAPSHOT so you can verify if this works for you. I was able to use your model with ACS Error handler. Here is also the JIRA ticket: https://cognifide.atlassian.net/browse/SLICE-143
Reply | Threaded
Open this post in threaded view
|

Re: ACS Commons - Error Handling ResourceResolver Closed

maciej.majchrzak
Administrator
In reply to this post by kharris@siteworx.com
I've released Slice 4.3.2 which contains the fix. If you have any problems, please let me know.

Cheers
Maciej
Reply | Threaded
Open this post in threaded view
|

Re: ACS Commons - Error Handling ResourceResolver Closed

kharris@siteworx.com
Fantastic, thank you, sorry I didn't get a chance to test it prior to the release. I just implemented 4.3.2 and everything works as expected.

Thanks again for the support on this.

Cheers