Error while dispatching observation events | Community
Skip to main content
Level 3
April 22, 2024
Solved

Error while dispatching observation events

  • April 22, 2024
  • 2 replies
  • 1189 views

I am on AEM 6.5 non-cloud and I am seeing this error very frequently, I checked each and every place where I am creating resource resolver, I am closing it too and I am not closing any resource resolver that I am not creating for example one through request or session, this isnt causing any functional issues but i dont want to suppress this either.

 

 

 

 

4/22/24
4:45:09.901 PM
 
22.04.2024 16:45:09.901 *WARN* [sling-oak-observation-5] org.apache.jackrabbit.oak.jcr.observation.ChangeProcessor Error while dispatching observation events for //*[11111b]@org.apache.sling.jcr.resource.internal.JcrResourceListener java.lang.IllegalStateException: Resource resolver is already closed. at org.apache.sling.resourceresolver.impl.ResourceResolverImpl.checkClosed(ResourceResolverImpl.java:196) [org.apache.sling.resourceresolver:1.7.10] at org.apache.sling.resourceresolver.impl.ResourceResolverImpl.getResource(ResourceResolverImpl.java:447) [org.apache.sling.resourceresolver:1.7.10] at org.apache.sling.resourceresolver.impl.mapping.MapEntries.addResource(MapEntries.java:258) [org.apache.sling.resourceresolver:1.7.10] at org.apache.sling.resourceresolver.impl.mapping.MapEntries.onChange(MapEntries.java:736) [org.apache.sling.resourceresolver:1.7.10] at org.apache.sling.resourceresolver.impl.observation.BasicObservationReporter.reportChanges(BasicObservationReporter.java:211) [org.apache.sling.resourceresolver:1.7.10] at org.apache.sling.jcr.resource.internal.JcrResourceListener.onEvent(JcrResourceListener.java:155) [org.apache.sling.jcr.resource:3.0.18] at org.apache.jackrabbit.commons.observation.ListenerTracker$1.onEvent(ListenerTracker.java:190) [org.apache.jackrabbit.jackrabbit-jcr-commons:2.20.4] at org.apache.jackrabbit.oak.jcr.observation.ChangeProcessor.contentChanged(ChangeProcessor.java:513) [org.apache.jackrabbit.oak-jcr:1.22.13] at org.apache.jackrabbit.oak.plugins.observation.FilteringDispatcher.contentChanged(FilteringDispatcher.java:52) [org.apache.jackrabbit.oak-core:1.22.13] at org.apache.jackrabbit.oak.spi.commit.BackgroundObserver$1$1.call(BackgroundObserver.java:127) [org.apache.jackrabbit.oak-store-spi:1.22.13] at org.apache.jackrabbit.oak.spi.commit.BackgroundObserver$1$1.call(BackgroundObserver.java:121) [org.apache.jackrabbit.oak-store-spi:1.22.13] at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at java.lang.Thread.run(Thread.java:750)
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 joerghoh

If you register an observation listener using a JCR session, you must not close that session until the listener is unregistered.

 

This is the only exception where a long-running JCR session is even required. And you don't need to worry about refreshs and such, as in that case the JCR does all the magic behind the scenes. So opening a JCR session and registering an observation listener in the activate() and closing the session in deactivaite() is perfectly good.

2 replies

EstebanBustamante
Community Advisor and Adobe Champion
Community Advisor and Adobe Champion
April 25, 2024

Hi, 

You can ignore this message; it's not an error but a warning. Since it's a warning, it means that the application expected this behavior to occur. You can check this thread to see how to stop printing this message if needed: https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/error-while-dispatching-observation-events-for-11111b-org-apache/m-p/419656 

 

Hope this helps

Esteban Bustamante
joerghoh
Adobe Employee
joerghohAdobe EmployeeAccepted solution
Adobe Employee
April 26, 2024

If you register an observation listener using a JCR session, you must not close that session until the listener is unregistered.

 

This is the only exception where a long-running JCR session is even required. And you don't need to worry about refreshs and such, as in that case the JCR does all the magic behind the scenes. So opening a JCR session and registering an observation listener in the activate() and closing the session in deactivaite() is perfectly good.