java.lang.IllegalStateException: The bundle is uninstalled

One of our clients is unable to install our plugin, it gives the following error

/rest/plugins/1.0/installed-marketplace [c.a.p.osgi.factory.OsgiPlugin] Unable to start the plugin container for plugin ‘something’
org.springframework.beans.factory.BeanDefinitionStoreException: Unexpected exception parsing XML document from URL [bundle://272.0:0/META-INF/spring/atlassian-plugins-component-imports.xml]; nested exception is java.lang.IllegalStateException: The bundle is uninstalled.

They are using Jira Server 7.7.0. I searched a lot about that error, but the only thing I could find is that is it caused by the plugin not being compatible, which is doubtful since I tested it on my 7.7.0 instance and it works fine. Is there a way to solve this?

1 Like

I’m getting the same error.

In my case I have an Arquillian integration test addon that tests another addon. It seems like the Arquillian integration test fired a new thread running a class of the target addon and then the IT addon finished. The target addon cannot load any new class due to this error:

[INFO] [talledLocalContainer] 2018-03-18 21:56:12,496 pool-25-thread-3 ERROR anonymous 1312x2092x1 - 127.0.0.1 /ArquillianServletRunner []
[INFO] [talledLocalContainer] java.lang.IllegalStateException: The bundle is uninstalled.
[INFO] [talledLocalContainer] at org.apache.felix.framework.Felix.getBundleResource(Felix.java:1585)
[INFO] [talledLocalContainer] at org.apache.felix.framework.BundleImpl.getResource(BundleImpl.java:639)
[INFO] [talledLocalContainer] at org.eclipse.gemini.blueprint.util.BundleDelegatingClassLoader.findResource(BundleDelegatingClassLoader.java:160)
[INFO] [talledLocalContainer] at org.eclipse.gemini.blueprint.util.BundleDelegatingClassLoader.getResource(BundleDelegatingClassLoader.java:201)
[INFO] [talledLocalContainer] at java.lang.ClassLoader.getResourceAsStream(ClassLoader.java:1307)
[INFO] [talledLocalContainer] at org.apache.xerces.parsers.SecuritySupport$6.run(Unknown Source)
[INFO] [talledLocalContainer] at java.security.AccessController.doPrivileged(Native Method)
[INFO] [talledLocalContainer] at org.apache.xerces.parsers.SecuritySupport.getResourceAsStream(Unknown Source)
[INFO] [talledLocalContainer] at org.apache.xerces.parsers.ObjectFactory.findJarServiceProvider(Unknown Source)
[INFO] [talledLocalContainer] at org.apache.xerces.parsers.ObjectFactory.createObject(Unknown Source)
[INFO] [talledLocalContainer] at org.apache.xerces.parsers.ObjectFactory.createObject(Unknown Source)
[INFO] [talledLocalContainer] at org.apache.xerces.parsers.SAXParser.(Unknown Source)
[INFO] [talledLocalContainer] at org.apache.xerces.parsers.SAXParser.(Unknown Source)
[INFO] [talledLocalContainer] at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.(Unknown Source)
[INFO] [talledLocalContainer] at org.apache.xerces.jaxp.SAXParserImpl.(Unknown Source)
[INFO] [talledLocalContainer] at org.apache.xerces.jaxp.SAXParserFactoryImpl.newSAXParser(Unknown Source)
[INFO] [talledLocalContainer] at org.apache.batik.dom.util.SAXDocumentFactory.createDocument(SAXDocumentFactory.java:428)

I’m not sure If I should start changing the classloader from the threads.

Any ideas?

After some digging, I believe I found the problem.

It is related to [SAL-258] - Ecosystem Jira

The thread that runs the main addon code is created by the Integration Test Addon (or any dependent addon). When the test addon is removed, the thread ends up with a broken class loader.

The strategy is to use a thread factory that sets the main addon’s class loader in the newly created threads. Similar to com.atlassian.activeobjects.spi.ContextClassLoaderThreadFactory

If you think this is incorrect, please let me know!

This might happen due to multiple reason. we encountered same problem few days ago. After trying out multiple solutions from various resources and debugging. I figured out that our problem was due to cache corruption of bitbucket. This cache cannot be deleted directly because it is created during boot up of bitbucket. we need to bring down bitbucket server and delete following folders:
$BITBUCKET_HOME/plugins/.bundled-plugins/
$BITBUCKET_HOME/plugins/.osgi-cache/
once, cache is cleared then restart bitbucket server. Try to deploy your plugin and you wont see problem. Hope it helps!!