Expand my Community achievements bar.

Guidelines for the Responsible Use of Generative AI in the Experience Cloud Community.

JCR Session.logout giving Repository Exception

Avatar

Level 3

Hi ,

Greetings !

In my code I opened a jcr session by adapting the resolver(resolver from service user).

Please see the code below :

try{

ResourceResolver resolver=getResourceResolver();

           Session session=resolver.adaptTo(Session.class);

//some logic

}

catch (RepositoryException e)

{

//LOGS

}

finally

          {

              if (session != null && session.isLive())

              {

                  session.logout();

              }

          }

After logging out the session ,it is giving me exception and my page is breaking.Please find the exception below :

21.09.2017 14:47:37.295 *ERROR* [10.128.38.54 [1505998057061] GET /content/B2B_HC/en_IN/article.html HTTP/1.1] com.philips.webcms.foundation.base.tags.ActionTag Exception occured when including component

java.lang.IllegalArgumentException: javax.jcr.RepositoryException: This session has been closed.

I also tried to close the resolver object instead of closing session object following the below article ,still no luck !
Jcr Session is Closed

Please advice.

Thanks,

Pallavi

0 Replies