java.lang.IllegalStateException: BundleContext is no longer valid

Apache's JIRA Issue Tracker | Christoph Läubrich | 4 years ago
tip
Click on the to mark the solution that helps you, Samebug will learn from it.
As a community member, you’ll be rewarded for you help.
  1. 0

    From time to time the following Exception is thrown in the logs saiing that a component can't be activated: !STACK 0 java.lang.IllegalStateException: BundleContext is no longer valid at org.eclipse.osgi.framework.internal.core.BundleContextImpl.checkValid(BundleContextImpl.java:931) at org.eclipse.osgi.framework.internal.core.BundleContextImpl.createFilter(BundleContextImpl.java:917) at org.apache.felix.scr.impl.manager.DependencyManager.setTargetFilter(DependencyManager.java:1265) at org.apache.felix.scr.impl.manager.DependencyManager.<init>(DependencyManager.java:106) at org.apache.felix.scr.impl.manager.AbstractComponentManager.loadDependencyManagers(AbstractComponentManager.java:586) at org.apache.felix.scr.impl.manager.AbstractComponentManager.<init>(AbstractComponentManager.java:86) at org.apache.felix.scr.impl.manager.ImmediateComponentManager.<init>(ImmediateComponentManager.java:86) at org.apache.felix.scr.impl.config.AbstractComponentHolder.createComponentManager(AbstractComponentHolder.java:54) at org.apache.felix.scr.impl.config.ConfiguredComponentHolder.<init>(ConfiguredComponentHolder.java:99) at org.apache.felix.scr.impl.config.ConfigurationComponentRegistry.createComponentHolder(ConfigurationComponentRegistry.java:115) at org.apache.felix.scr.impl.BundleComponentActivator.loadDescriptor(BundleComponentActivator.java:244) at org.apache.felix.scr.impl.BundleComponentActivator.initialize(BundleComponentActivator.java:147) at org.apache.felix.scr.impl.BundleComponentActivator.<init>(BundleComponentActivator.java:111) at org.apache.felix.scr.impl.Activator.loadComponents(Activator.java:285) at org.apache.felix.scr.impl.Activator.bundleChanged(Activator.java:203) at org.eclipse.osgi.framework.internal.core.BundleContextImpl.dispatchEvent(BundleContextImpl.java:847) at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230) at org.eclipse.osgi.framework.eventmgr.ListenerQueue.dispatchEventSynchronous(ListenerQueue.java:148) at org.eclipse.osgi.framework.internal.core.Framework.publishBundleEventPrivileged(Framework.java:1523) at org.eclipse.osgi.framework.internal.core.Framework.publishBundleEvent(Framework.java:1459) at org.eclipse.osgi.framework.internal.core.Framework.publishBundleEvent(Framework.java:1454) at org.eclipse.osgi.framework.internal.core.BundleHost.startWorker(BundleHost.java:391) at org.eclipse.osgi.framework.internal.core.AbstractBundle.resume(AbstractBundle.java:389) at org.eclipse.osgi.framework.internal.core.Framework.resumeBundle(Framework.java:1131) at org.eclipse.osgi.framework.internal.core.StartLevelManager.resumeBundles(StartLevelManager.java:559) at org.eclipse.osgi.framework.internal.core.StartLevelManager.resumeBundles(StartLevelManager.java:544) at org.eclipse.osgi.framework.internal.core.StartLevelManager.incFWSL(StartLevelManager.java:457) at org.eclipse.osgi.framework.internal.core.StartLevelManager.doSetStartLevel(StartLevelManager.java:243) at org.eclipse.osgi.framework.internal.core.StartLevelManager.dispatchEvent(StartLevelManager.java:438) at org.eclipse.osgi.framework.internal.core.StartLevelManager.dispatchEvent(StartLevelManager.java:1) at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230) at org.eclipse.osgi.framework.eventmgr.EventManager$EventThread.run(EventManager.java:340) The problem seems, that SCR tries to create Filter for a component, but was deactivated/refreshed in the process of doing so. The API (http://www.osgi.org/javadoc/r4v43/core/org/osgi/framework/BundleContext.html#createFilter%28java.lang.String%29) says: java.lang.IllegalStateException - If this BundleContext is no longer valid. so it seems valid for me that SCR catch and silently ignore this instead of reporting this as an error of the component beeing activated.

    Apache's JIRA Issue Tracker | 4 years ago | Christoph Läubrich
    java.lang.IllegalStateException: BundleContext is no longer valid
  2. 0

    Eclipse Plugins: Cannot start an unneeded plugin?

    Stack Overflow | 2 years ago | pphilbey
    java.lang.IllegalStateException: BundleContext is no longer valid
  3. 0

    Development discussion for the Apache FELIX OSGi R4 service platform

    gmane.org | 1 year ago
    java.lang.IllegalStateException: BundleContext is no longer valid
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. java.lang.IllegalStateException

      BundleContext is no longer valid

      at org.eclipse.osgi.framework.internal.core.BundleContextImpl.checkValid()
    2. Eclipse OSGi
      BundleContextImpl.createFilter
      1. org.eclipse.osgi.framework.internal.core.BundleContextImpl.checkValid(BundleContextImpl.java:931)
      2. org.eclipse.osgi.framework.internal.core.BundleContextImpl.createFilter(BundleContextImpl.java:917)
      2 frames
    3. Apache Felix Declarative Services
      Activator.bundleChanged
      1. org.apache.felix.scr.impl.manager.DependencyManager.setTargetFilter(DependencyManager.java:1265)
      2. org.apache.felix.scr.impl.manager.DependencyManager.<init>(DependencyManager.java:106)
      3. org.apache.felix.scr.impl.manager.AbstractComponentManager.loadDependencyManagers(AbstractComponentManager.java:586)
      4. org.apache.felix.scr.impl.manager.AbstractComponentManager.<init>(AbstractComponentManager.java:86)
      5. org.apache.felix.scr.impl.manager.ImmediateComponentManager.<init>(ImmediateComponentManager.java:86)
      6. org.apache.felix.scr.impl.config.AbstractComponentHolder.createComponentManager(AbstractComponentHolder.java:54)
      7. org.apache.felix.scr.impl.config.ConfiguredComponentHolder.<init>(ConfiguredComponentHolder.java:99)
      8. org.apache.felix.scr.impl.config.ConfigurationComponentRegistry.createComponentHolder(ConfigurationComponentRegistry.java:115)
      9. org.apache.felix.scr.impl.BundleComponentActivator.loadDescriptor(BundleComponentActivator.java:244)
      10. org.apache.felix.scr.impl.BundleComponentActivator.initialize(BundleComponentActivator.java:147)
      11. org.apache.felix.scr.impl.BundleComponentActivator.<init>(BundleComponentActivator.java:111)
      12. org.apache.felix.scr.impl.Activator.loadComponents(Activator.java:285)
      13. org.apache.felix.scr.impl.Activator.bundleChanged(Activator.java:203)
      13 frames
    4. Eclipse OSGi
      BundleContextImpl.dispatchEvent
      1. org.eclipse.osgi.framework.internal.core.BundleContextImpl.dispatchEvent(BundleContextImpl.java:847)
      1 frame
    5. Eclipse OSGi
      ListenerQueue.dispatchEventSynchronous
      1. org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230)
      2. org.eclipse.osgi.framework.eventmgr.ListenerQueue.dispatchEventSynchronous(ListenerQueue.java:148)
      2 frames
    6. Eclipse OSGi
      StartLevelManager.dispatchEvent
      1. org.eclipse.osgi.framework.internal.core.Framework.publishBundleEventPrivileged(Framework.java:1523)
      2. org.eclipse.osgi.framework.internal.core.Framework.publishBundleEvent(Framework.java:1459)
      3. org.eclipse.osgi.framework.internal.core.Framework.publishBundleEvent(Framework.java:1454)
      4. org.eclipse.osgi.framework.internal.core.BundleHost.startWorker(BundleHost.java:391)
      5. org.eclipse.osgi.framework.internal.core.AbstractBundle.resume(AbstractBundle.java:389)
      6. org.eclipse.osgi.framework.internal.core.Framework.resumeBundle(Framework.java:1131)
      7. org.eclipse.osgi.framework.internal.core.StartLevelManager.resumeBundles(StartLevelManager.java:559)
      8. org.eclipse.osgi.framework.internal.core.StartLevelManager.resumeBundles(StartLevelManager.java:544)
      9. org.eclipse.osgi.framework.internal.core.StartLevelManager.incFWSL(StartLevelManager.java:457)
      10. org.eclipse.osgi.framework.internal.core.StartLevelManager.doSetStartLevel(StartLevelManager.java:243)
      11. org.eclipse.osgi.framework.internal.core.StartLevelManager.dispatchEvent(StartLevelManager.java:438)
      12. org.eclipse.osgi.framework.internal.core.StartLevelManager.dispatchEvent(StartLevelManager.java:1)
      12 frames
    7. Eclipse OSGi
      EventManager$EventThread.run
      1. org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230)
      2. org.eclipse.osgi.framework.eventmgr.EventManager$EventThread.run(EventManager.java:340)
      2 frames