java.lang.IllegalStateException

There are no available Samebug tips for this exception. Do you have an idea how to solve this issue? A short tip would help users who saw this issue last week.

  • 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.
    via by Christoph Läubrich,
  • Problems with "spell check" example
    via by John Arthorne,
  • DisposableBean issues when testing
    via by hal.hil...@gmail.com,
  • ContextLoaderBundleActivator question
    via by Martin Lippert,
    • 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)

    Users with the same issue

    Unknown visitor1 times, last one,
    Unknown visitor1 times, last one,
    Unknown visitor1 times, last one,
    Unknown visitor1 times, last one,