[ https://issues.apache.org/jira/browse/FELIX-971?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12678949#action_12678949 ]
Richard S. Hall commented on FELIX-971: --------------------------------------- It looks like ServiceTracker.close() was not called. When we stop a bundle, we unregister all services, release any used services, and unregister any events listeners for the bundle. This is the order that the spec says they should be done. However, it appears like it might be the case that since the listeners are removed last, that the unclosed ServiceTracker sees events after its context is invalid. Can you verify if the ServiceTracker is closed and if not, try to close it and see if it goes away? > Exception thrown in ServiceTracker at shutdown > ----------------------------------------------- > > Key: FELIX-971 > URL: https://issues.apache.org/jira/browse/FELIX-971 > Project: Felix > Issue Type: Bug > Components: Framework > Reporter: Guillaume Nodet > Priority: Minor > > ERROR: EventDispatcher: Error during dispatch. > (java.lang.IllegalStateException: Invalid BundleContext.) > java.lang.IllegalStateException: Invalid BundleContext. > at > org.apache.felix.framework.BundleContextImpl.checkValidity(BundleContextImpl.java:393) > at > org.apache.felix.framework.BundleContextImpl.ungetService(BundleContextImpl.java:362) > at > org.osgi.util.tracker.ServiceTracker.removedService(ServiceTracker.java:429) > at > org.osgi.util.tracker.ServiceTracker$Tracked.untrack(ServiceTracker.java:1126) > at > org.osgi.util.tracker.ServiceTracker$Tracked.serviceChanged(ServiceTracker.java:957) > at > org.apache.felix.framework.util.EventDispatcher$4.run(EventDispatcher.java:812) > at java.security.AccessController.doPrivileged(Native Method) > at > org.apache.felix.framework.util.EventDispatcher.invokeServiceListenerCallback(EventDispatcher.java:809) > at > org.apache.felix.framework.util.EventDispatcher.fireEventImmediately(EventDispatcher.java:678) > at > org.apache.felix.framework.util.EventDispatcher.fireServiceEvent(EventDispatcher.java:609) > at org.apache.felix.framework.Felix.fireServiceEvent(Felix.java:3379) > at org.apache.felix.framework.Felix.access$000(Felix.java:39) > at org.apache.felix.framework.Felix$1.serviceChanged(Felix.java:620) > at > org.apache.felix.framework.ServiceRegistry.fireServiceChanged(ServiceRegistry.java:571) > at > org.apache.felix.framework.ServiceRegistry.unregisterService(ServiceRegistry.java:105) > at > org.apache.felix.framework.ServiceRegistrationImpl.unregister(ServiceRegistrationImpl.java:120) > at > org.apache.felix.framework.ServiceRegistry.unregisterServices(ServiceRegistry.java:146) > at org.apache.felix.framework.Felix.stopBundle(Felix.java:1815) > at org.apache.felix.framework.Felix.setActiveStartLevel(Felix.java:999) > at > org.apache.felix.framework.StartLevelImpl.run(StartLevelImpl.java:263) > at java.lang.Thread.run(Thread.java:613) -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.