Uploaded image for project: 'Bitbucket Data Center'
  1. Bitbucket Data Center
  2. BSERV-8210

EventListenerBeanRegistrar triggers "java.lang.IllegalStateException: Invalid BundleContext"

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • Medium
    • 4.7.1
    • 3.11.0, 4.0.0, 4.1.0
    • Enterprise
    • None

    Description

      On startup, EventListenerBeanRegistrar sometimes triggers errors like

      2015-12-02 10:41:18,111 WARN  [spring-startup]  c.a.s.i.p.OsgiBundledPathScanner Cannot scan directory /com/atlassian/oauth/shared/servlet/ in bundle com.atlassian.oauth.atlassian-oauth-service-provider-plugin as it does not exist
      2015-12-02 10:55:42,505 WARN  [ThreadPoolAsyncTaskExecutor::Thread 10]  o.s.b.f.s.DisposableBeanAdapter Invocation of destroy method 'destroy' failed on bean with name 'batchNotificationJob': java.lang.IllegalStateException: Invalid BundleContext.
      2015-12-02 10:55:42,517 ERROR [ThreadPoolAsyncTaskExecutor::Thread 10]  o.s.o.e.i.a.ContextLoaderListener Application context refresh failed (NonValidatingOsgiBundleXmlApplicationContext(bundle=com.atlassian.stash.notification, config=osgibundle:/META-INF/spring/*.xml))
      org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'pluginPullRequestNotificationListener' defined in URL [bundle://84.0:0/META-INF/spring/atlassian-plugin-context.xml]: Cannot resolve reference to bean 'pullRequestBatchNotificationDao' while setting constructor argument; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'pullRequestBatchNotificationDao' defined in URL [bundle://84.0:0/META-INF/spring/atlassian-plugin-context.xml]: Initialization of bean failed; nested exception is java.lang.IllegalStateException: Invalid BundleContext.
              at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:275) ~[spring-2.5.6.SEC03-atlassian-6.jar:4.1.6.RELEASE]
              at java.security.AccessController.doPrivileged(Native Method) ~[na:1.8.0_45]
              at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:728) ~[spring-context-4.1.6.RELEASE.jar:4.1.6.RELEASE]
              at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [na:1.8.0_45]
              at java.lang.Thread.run(Thread.java:745) [na:1.8.0_45]
              ... 20 frames trimmed
      Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'pullRequestBatchNotificationDao' defined in URL [bundle://84.0:0/META-INF/spring/atlassian-plugin-context.xml]: Initialization of bean failed; nested exception is java.lang.IllegalStateException: Invalid BundleContext.
              at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:480) ~[spring-2.5.6.SEC03-atlassian-6.jar:4.1.6.RELEASE]
              at java.security.AccessController.doPrivileged(Native Method) ~[na:1.8.0_45]
              ... 5 common frames omitted
      Caused by: java.lang.IllegalStateException: Invalid BundleContext.
              at org.apache.felix.framework.BundleContextImpl.checkValidity(BundleContextImpl.java:457) ~[org.apache.felix.framework-3.2.2.jar:na]
              at com.atlassian.stash.plugin.util.EventListenerBeanRegistrar.registerIfEventListener(EventListenerBeanRegistrar.java:84) ~[na:na]
              at com.atlassian.stash.plugin.util.EventListenerBeanRegistrar.postProcessBeforeInitialization(EventListenerBeanRegistrar.java:68) ~[na:na]
              ... 6 common frames omitted
      

      This appears to be because the eventListener OSGI service isn't available (yet). This can be avoided by using a ServiceTracker instead of a simple injected service.

      This would likely also solve the problem described in https://confluence.atlassian.com/display/STASHKB/SSH+Server+doesn't+start

      Attachments

        Issue Links

          Activity

            People

              mheemskerk Michael Heemskerk (Inactive)
              mheemskerk Michael Heemskerk (Inactive)
              Votes:
              2 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: