Active Object service fails to load when a component is marked public="true"

Sunny Sharma October 6, 2011

Hi,

I am developing a plugin for JIRA. I am using Active Objects to store some data. I have to do some house keeping tasks on start up and uninstallation, so I have created a component to do so which implements com.atlassian.sal.api.lifecycle.LifecycleAware and should be marked as: public="true" in order to work, as mentioned in documentation: http://docs.atlassian.com/sal-api/2.0.16-SNAPSHOT/com/atlassian/sal/api/lifecycle/LifecycleAware.html

.
.
.
<component key="schedulerComponent" class="com.test.ao.plugin.scheduler.TheSchedulerImpl" system="true" public="false">
	       <interface>com.atlassian.sal.api.lifecycle.LifecycleAware</interface>
</component>

<ao key="ao-module">
<description>The module configuring the Active Objects service used by this plug-in.</description>
<entity>
.
.
</ao>
.
.
.

But when I mark the component as public="true", the plugin fails to read the Active Objects service somehow and give following error on installation:
2011-10-07 12:42:29,600 Spring executor 36 ERROR admin 641x19x1 wlhf8i 0:0:0:0:0
:0:0:1 /rest/plugins/1.0/ [atlassian.activeobjects.osgi.ActiveObjectsServiceFact
ory] Could not find any active objects configurations for bundle com.test.ao.re
port.plugin.TestReport.
Did you define an 'ao' module descriptor in your plugin?
Try adding this in your atlassian-plugin.xml file: <ao key='some-key' />
com.atlassian.plugin.PluginException: com.atlassian.activeobjects.osgi.NoService
sFoundException: Was expecting at least one service reference for interface <com
.atlassian.activeobjects.config.ActiveObjectsConfiguration> and filter <(com.atl
assian.plugin.key=com.test.ao.report.plugin.TestReport)>. Got null !
        at com.atlassian.activeobjects.osgi.ActiveObjectsServiceFactory.getConfi
guration(ActiveObjectsServiceFactory.java:93)
        at com.atlassian.activeobjects.osgi.ActiveObjectsServiceFactory.access$0
00(ActiveObjectsServiceFactory.java:35)
        at com.atlassian.activeobjects.osgi.ActiveObjectsServiceFactory$LazyActi
veObjectConfiguration.getDelegate(ActiveObjectsServiceFactory.java:163)
        at com.atlassian.activeobjects.osgi.ActiveObjectsServiceFactory$LazyActi
veObjectConfiguration.hashCode(ActiveObjectsServiceFactory.java:150)
        at java.util.HashMap.get(HashMap.java:300)
        at com.atlassian.activeobjects.internal.WeakReferencedActiveObjectsRegis
try.get(WeakReferencedActiveObjectsRegistry.java:19)
        at com.atlassian.activeobjects.internal.RegistryBasedActiveObjectsProvid
er.get(RegistryBasedActiveObjectsProvider.java:25)
        at com.atlassian.activeobjects.osgi.DelegatingActiveObjects.getDelegate(
DelegatingActiveObjects.java:126)
        at com.atlassian.activeobjects.osgi.DelegatingActiveObjects.find(Delegat
ingActiveObjects.java:71)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflecti
on(AopUtils.java:307)
        at org.springframework.osgi.service.importer.support.internal.aop.Servic
eInvoker.doInvoke(ServiceInvoker.java:58)
        at org.springframework.osgi.service.importer.support.internal.aop.Servic
eInvoker.invoke(ServiceInvoker.java:62)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(
ReflectiveMethodInvocation.java:171)
        at org.springframework.aop.support.DelegatingIntroductionInterceptor.doP
roceed(DelegatingIntroductionInterceptor.java:131)
        at org.springframework.aop.support.DelegatingIntroductionInterceptor.inv
oke(DelegatingIntroductionInterceptor.java:119)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(
ReflectiveMethodInvocation.java:171)
        at org.springframework.osgi.service.util.internal.aop.ServiceTCCLInterce
ptor.invokeUnprivileged(ServiceTCCLInterceptor.java:56)
        at org.springframework.osgi.service.util.internal.aop.ServiceTCCLInterce
ptor.invoke(ServiceTCCLInterceptor.java:39)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(
ReflectiveMethodInvocation.java:171)
        at org.springframework.osgi.service.importer.support.LocalBundleContextA
dvice.invoke(LocalBundleContextAdvice.java:59)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(
ReflectiveMethodInvocation.java:171)
        at org.springframework.aop.support.DelegatingIntroductionInterceptor.doP
roceed(DelegatingIntroductionInterceptor.java:131)
        at org.springframework.aop.support.DelegatingIntroductionInterceptor.inv
oke(DelegatingIntroductionInterceptor.java:119)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(
ReflectiveMethodInvocation.java:171)
        at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynami
cAopProxy.java:204)
        at $Proxy1052.find(Unknown Source)
        at com.test.ao.plugin.service.impl.ControlMatrixServiceImpl.all(Control
MatrixServiceImpl.java:48)
        at com.test.ao.plugin.scheduler.core.TheSchedulerImpl.onStart(TheSchedu
lerImpl.java:47)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflecti
on(AopUtils.java:307)
        at org.springframework.osgi.service.importer.support.internal.aop.Servic
eInvoker.doInvoke(ServiceInvoker.java:58)
        at org.springframework.osgi.service.importer.support.internal.aop.Servic
eInvoker.invoke(ServiceInvoker.java:62)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(
ReflectiveMethodInvocation.java:171)
        at org.springframework.aop.support.DelegatingIntroductionInterceptor.doP
roceed(DelegatingIntroductionInterceptor.java:131)
        at org.springframework.aop.support.DelegatingIntroductionInterceptor.inv
oke(DelegatingIntroductionInterceptor.java:119)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(
ReflectiveMethodInvocation.java:171)
        at org.springframework.osgi.service.util.internal.aop.ServiceTCCLInterce
ptor.invokeUnprivileged(ServiceTCCLInterceptor.java:56)
        at org.springframework.osgi.service.util.internal.aop.ServiceTCCLInterce
ptor.invoke(ServiceTCCLInterceptor.java:39)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(
ReflectiveMethodInvocation.java:171)
        at org.springframework.osgi.service.importer.support.LocalBundleContextA
dvice.invoke(LocalBundleContextAdvice.java:59)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(
ReflectiveMethodInvocation.java:171)
        at org.springframework.aop.support.DelegatingIntroductionInterceptor.doP
roceed(DelegatingIntroductionInterceptor.java:131)
        at org.springframework.aop.support.DelegatingIntroductionInterceptor.inv
oke(DelegatingIntroductionInterceptor.java:119)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(
ReflectiveMethodInvocation.java:171)
        at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynami
cAopProxy.java:204)
        at $Proxy457.onStart(Unknown Source)
        at com.atlassian.sal.core.lifecycle.DefaultLifecycleManager.notifyLifecy
cleAwareOfStart(DefaultLifecycleManager.java:99)
        at com.atlassian.sal.core.lifecycle.DefaultLifecycleManager.onBind(Defau
ltLifecycleManager.java:70)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.springframework.osgi.util.internal.ReflectionUtils.invokeMethod(R
eflectionUtils.java:108)
        at org.springframework.osgi.config.internal.adapter.CustomListenerAdapte
rUtils.invokeCustomMethods(CustomListenerAdapterUtils.java:155)
        at org.springframework.osgi.config.internal.adapter.OsgiServiceLifecycle
ListenerAdapter.bind(OsgiServiceLifecycleListenerAdapter.java:201)
        at org.springframework.osgi.service.importer.support.internal.util.OsgiS
erviceBindingUtils.callListenersBind(OsgiServiceBindingUtils.java:50)
        at org.springframework.osgi.service.importer.support.internal.collection
.OsgiServiceCollection$Listener.serviceChanged(OsgiServiceCollection.java:107)
        at org.apache.felix.framework.util.EventDispatcher.invokeServiceListener
Callback(EventDispatcher.java:864)
        at org.apache.felix.framework.util.EventDispatcher.fireEventImmediately(
EventDispatcher.java:732)
        at org.apache.felix.framework.util.EventDispatcher.fireServiceEvent(Even
tDispatcher.java:662)
        at org.apache.felix.framework.Felix.fireServiceEvent(Felix.java:3726)
        at org.apache.felix.framework.Felix.access$000(Felix.java:80)
        at org.apache.felix.framework.Felix$2.serviceChanged(Felix.java:717)
        at org.apache.felix.framework.ServiceRegistry.registerService(ServiceReg
istry.java:107)
        at org.apache.felix.framework.Felix.registerService(Felix.java:2847)
        at org.apache.felix.framework.BundleContextImpl.registerService(BundleCo
ntextImpl.java:251)
        at org.springframework.osgi.service.exporter.support.OsgiServiceFactoryB
ean.registerService(OsgiServiceFactoryBean.java:310)
        at org.springframework.osgi.service.exporter.support.OsgiServiceFactoryB
ean.registerService(OsgiServiceFactoryBean.java:279)
        at org.springframework.osgi.service.exporter.support.OsgiServiceFactoryB
ean$Executor.registerService(OsgiServiceFactoryBean.java:95)
        at org.springframework.osgi.service.exporter.support.internal.controller
.ExporterController.registerService(ExporterController.java:40)
        at org.springframework.osgi.service.dependency.internal.DefaultMandatory
DependencyManager.startExporter(DefaultMandatoryDependencyManager.java:320)
        at org.springframework.osgi.service.dependency.internal.DefaultMandatory
DependencyManager.checkIfExporterShouldStart(DefaultMandatoryDependencyManager.j
ava:261)
        at org.springframework.osgi.service.dependency.internal.DefaultMandatory
DependencyManager.discoverDependentImporterFor(DefaultMandatoryDependencyManager
.java:254)
        at org.springframework.osgi.service.dependency.internal.DefaultMandatory
DependencyManager.addServiceExporter(DefaultMandatoryDependencyManager.java:187)

        at org.springframework.osgi.service.dependency.internal.MandatoryDepende
ncyBeanPostProcessor.postProcessAfterInitialization(MandatoryDependencyBeanPostP
rocessor.java:46)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBean
Factory.applyBeanPostProcessorsAfterInitialization(AbstractAutowireCapableBeanFa
ctory.java:361)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBean
Factory.initializeBean(AbstractAutowireCapableBeanFactory.java:1344)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBean
Factory.doCreateBean(AbstractAutowireCapableBeanFactory.java:473)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBean
Factory$1.run(AbstractAutowireCapableBeanFactory.java:409)
        at java.security.AccessController.doPrivileged(Native Method)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBean
Factory.createBean(AbstractAutowireCapableBeanFactory.java:380)
        at org.springframework.beans.factory.support.AbstractBeanFactory$1.getOb
ject(AbstractBeanFactory.java:264)
        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistr
y.getSingleton(DefaultSingletonBeanRegistry.java:222)
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBe
an(AbstractBeanFactory.java:261)
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean
(AbstractBeanFactory.java:185)
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean
(AbstractBeanFactory.java:164)
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.
preInstantiateSingletons(DefaultListableBeanFactory.java:423)
        at org.springframework.context.support.AbstractApplicationContext.finish
BeanFactoryInitialization(AbstractApplicationContext.java:728)
        at org.springframework.osgi.context.support.AbstractDelegatedExecutionAp
plicationContext.access$1600(AbstractDelegatedExecutionApplicationContext.java:6
9)
        at org.springframework.osgi.context.support.AbstractDelegatedExecutionAp
plicationContext$4.run(AbstractDelegatedExecutionApplicationContext.java:355)
        at org.springframework.osgi.util.internal.PrivilegedUtils.executeWithCus
tomTCCL(PrivilegedUtils.java:85)
        at org.springframework.osgi.context.support.AbstractDelegatedExecutionAp
plicationContext.completeRefresh(AbstractDelegatedExecutionApplicationContext.ja
va:320)
        at org.springframework.osgi.extender.internal.dependencies.startup.Depen
dencyWaiterApplicationContextExecutor$CompleteRefreshTask.run(DependencyWaiterAp
plicationContextExecutor.java:132)
        at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExec
utor.java:886)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor
.java:908)
        at java.lang.Thread.run(Thread.java:619)
Caused by: com.atlassian.activeobjects.osgi.NoServicesFoundException: Was expect
ing at least one service reference for interface <com.atlassian.activeobjects.co
nfig.ActiveObjectsConfiguration> and filter <(com.atlassian.plugin.key=com.test
.ao.report.plugin.TestReport)>. Got null !
        at com.atlassian.activeobjects.osgi.OsgiServiceUtilsImpl.getServiceRefer
ence(OsgiServiceUtilsImpl.java:50)
        at com.atlassian.activeobjects.osgi.OsgiServiceUtilsImpl.getService(Osgi
ServiceUtilsImpl.java:41)
        at com.atlassian.activeobjects.osgi.ActiveObjectsServiceFactory.getConfi
guration(ActiveObjectsServiceFactory.java:81)
        ... 102 more
2011-10-07 12:42:29,857 pool-2-thread-1 WARN admin 641x19x1 wlhf8i 0:0:0:0:0:0:0
:1 /rest/plugins/1.0/ [atlassian.jira.plugin.JiraPluginManager] Disable Plugin W
ithout Persisting after Plugin System Started
java.lang.RuntimeException
        at com.atlassian.jira.plugin.JiraPluginManager.disablePluginWithoutPersi
sting(JiraPluginManager.java:107)
        at com.atlassian.plugin.manager.PluginEnabler.enable(PluginEnabler.java:
170)
        at com.atlassian.plugin.manager.DefaultPluginManager.addPlugins(DefaultP
luginManager.java:694)
        at com.atlassian.plugin.manager.DefaultPluginManager.scanForNewPlugins(D
efaultPluginManager.java:428)
        at com.atlassian.plugin.manager.DefaultPluginManager.installPlugins(Defa
ultPluginManager.java:331)
        at sun.reflect.GeneratedMethodAccessor249.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at com.atlassian.plugin.osgi.hostcomponents.impl.DefaultComponentRegistr
ar$ContextClassLoaderSettingInvocationHandler.invoke(DefaultComponentRegistrar.j
ava:129)
        at $Proxy447.installPlugins(Unknown Source)
        at sun.reflect.GeneratedMethodAccessor249.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflecti
on(AopUtils.java:307)
        at org.springframework.osgi.service.importer.support.internal.aop.Servic
eInvoker.doInvoke(ServiceInvoker.java:58)
        at org.springframework.osgi.service.importer.support.internal.aop.Servic
eInvoker.invoke(ServiceInvoker.java:62)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(
ReflectiveMethodInvocation.java:171)
        at org.springframework.aop.support.DelegatingIntroductionInterceptor.doP
roceed(DelegatingIntroductionInterceptor.java:131)
        at org.springframework.aop.support.DelegatingIntroductionInterceptor.inv
oke(DelegatingIntroductionInterceptor.java:119)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(
ReflectiveMethodInvocation.java:171)
        at org.springframework.osgi.service.util.internal.aop.ServiceTCCLInterce
ptor.invokeUnprivileged(ServiceTCCLInterceptor.java:56)
        at org.springframework.osgi.service.util.internal.aop.ServiceTCCLInterce
ptor.invoke(ServiceTCCLInterceptor.java:39)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(
ReflectiveMethodInvocation.java:171)
        at org.springframework.osgi.service.importer.support.LocalBundleContextA
dvice.invoke(LocalBundleContextAdvice.java:59)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(
ReflectiveMethodInvocation.java:171)
        at org.springframework.aop.support.DelegatingIntroductionInterceptor.doP
roceed(DelegatingIntroductionInterceptor.java:131)
        at org.springframework.aop.support.DelegatingIntroductionInterceptor.inv
oke(DelegatingIntroductionInterceptor.java:119)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(
ReflectiveMethodInvocation.java:171)
        at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynami
cAopProxy.java:204)
        at $Proxy667.installPlugins(Unknown Source)
        at com.atlassian.upm.PluginAccessorAndControllerImpl$1.doInTransaction(P
luginAccessorAndControllerImpl.java:84)
        at com.atlassian.sal.core.transaction.HostContextTransactionTemplate$1.d
oInTransaction(HostContextTransactionTemplate.java:25)
        at com.atlassian.jira.DefaultHostContextAccessor.doInTransaction(Default
HostContextAccessor.java:34)
        at sun.reflect.GeneratedMethodAccessor194.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at com.atlassian.multitenant.impl.MultiTenantComponentFactoryImpl$Abstra
ctMultiTenantAwareInvocationHandler.invokeInternal(MultiTenantComponentFactoryIm
pl.java:181)
        at com.atlassian.multitenant.impl.MultiTenantComponentFactoryImpl$MultiT
enantAwareInvocationHandler.invoke(MultiTenantComponentFactoryImpl.java:211)
        at $Proxy380.doInTransaction(Unknown Source)
        at sun.reflect.GeneratedMethodAccessor194.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at com.atlassian.plugin.osgi.hostcomponents.impl.DefaultComponentRegistr
ar$ContextClassLoaderSettingInvocationHandler.invoke(DefaultComponentRegistrar.j
ava:129)
        at $Proxy380.doInTransaction(Unknown Source)
        at sun.reflect.GeneratedMethodAccessor194.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at com.atlassian.plugin.osgi.bridge.external.HostComponentFactoryBean$Dy
namicServiceInvocationHandler.invoke(HostComponentFactoryBean.java:154)
        at $Proxy380.doInTransaction(Unknown Source)
        at com.atlassian.sal.core.transaction.HostContextTransactionTemplate.exe
cute(HostContextTransactionTemplate.java:21)
        at sun.reflect.GeneratedMethodAccessor223.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflecti
on(AopUtils.java:307)
        at org.springframework.osgi.service.importer.support.internal.aop.Servic
eInvoker.doInvoke(ServiceInvoker.java:58)
        at org.springframework.osgi.service.importer.support.internal.aop.Servic
eInvoker.invoke(ServiceInvoker.java:62)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(
ReflectiveMethodInvocation.java:171)
        at org.springframework.aop.support.DelegatingIntroductionInterceptor.doP
roceed(DelegatingIntroductionInterceptor.java:131)
        at org.springframework.aop.support.DelegatingIntroductionInterceptor.inv
oke(DelegatingIntroductionInterceptor.java:119)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(
ReflectiveMethodInvocation.java:171)
        at org.springframework.osgi.service.util.internal.aop.ServiceTCCLInterce
ptor.invokeUnprivileged(ServiceTCCLInterceptor.java:56)
        at org.springframework.osgi.service.util.internal.aop.ServiceTCCLInterce
ptor.invoke(ServiceTCCLInterceptor.java:39)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(
ReflectiveMethodInvocation.java:171)
        at org.springframework.osgi.service.importer.support.LocalBundleContextA
dvice.invoke(LocalBundleContextAdvice.java:59)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(
ReflectiveMethodInvocation.java:171)
        at org.springframework.aop.support.DelegatingIntroductionInterceptor.doP
roceed(DelegatingIntroductionInterceptor.java:131)
        at org.springframework.aop.support.DelegatingIntroductionInterceptor.inv
oke(DelegatingIntroductionInterceptor.java:119)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(
ReflectiveMethodInvocation.java:171)
        at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynami
cAopProxy.java:204)
        at $Proxy670.execute(Unknown Source)
        at com.atlassian.upm.PluginAccessorAndControllerImpl.installPlugin(Plugi
nAccessorAndControllerImpl.java:65)
        at com.atlassian.upm.impl.PluginArtifactInstallHandler.installPlugin(Plu
ginArtifactInstallHandler.java:30)
        at com.atlassian.upm.PluginInstaller.execute(PluginInstaller.java:125)
        at com.atlassian.upm.PluginInstaller.install(PluginInstaller.java:82)
        at com.atlassian.upm.rest.resources.install.InstallFromFileTask.executeT
ask(InstallFromFileTask.java:32)
        at com.atlassian.upm.rest.resources.install.InstallTask.call(InstallTask
.java:30)
        at com.atlassian.upm.rest.resources.install.InstallTask.call(InstallTask
.java:15)
        at com.atlassian.upm.rest.async.AsynchronousTaskManager$1.call(Asynchron
ousTaskManager.java:72)
        at com.atlassian.upm.rest.async.AsynchronousTaskManager$1.call(Asynchron
ousTaskManager.java:65)
        at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
        at java.util.concurrent.FutureTask.run(FutureTask.java:138)
        at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExec
utor.java:886)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor
.java:908)
        at java.lang.Thread.run(Thread.java:619)
It works fine if the component is marked as public="false". In this case, on debugging, control never goes to com.atlassian.activeobjects.osgi.ActiveObjectsServiceFactory#getConfiguration()
Thanks.

3 answers

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

2 votes
Answer accepted
Samuel Le Berrigaud
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
October 6, 2011

The issue here is not linked to making the component public but to implementing InitialisingBean and calling the Active Object component too early.

The Active Objects component will only be truly available once the whole context is properly setup. Before that what gets injected by Spring is a proxy of the component since it is actually an OSGi service.

So to avoid this situation to not use Active Object inside when initialising an InitialisingBean. A good alternative is usually to do things lazily, i.e. if you need to prepare some AO data, do it on first call to the AO component.

Sunny Sharma October 9, 2011

Hi SaM,

The problem re-appeared when I am trying to access the Active Object component, in the overriden onStart() method of a class which implements com.atlassian.sal.api.lifecycle.LifecycleAware and which is called when the plugin is loaded. Thing is that I want to do some initialization stuff from Active Objects, when the plugin is loaded, so I have to access the Active Object components.

The work around I followed is by using a java.util.Timer. I am delaying the execution of intialization stuff by 15 seconds. I am not sure if this is a good approach, but it works for me :)

Thanks.

Samuel Le Berrigaud
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
October 10, 2011

Yes. The same issue exists with LifeCycleAware, unfortunately. This is something we're discussing internally to find a good solution for plugin to know they have been started and can now perform necessary initialisation operations.

One thing I can suggest that might be better that using the Timer would be to do your initialisation laziiy. One strategy would be to inject your ActiveObjects instance into some kind of supplier (à la Guava) where initialisation would be run on the first get and not subsequently.

I hope we'll come up with something simpler soon.

2 votes
Leonardo Onieva October 9, 2012

I had the same NoServicesFoundException, but in my case the problem was caused by the interface name was too long (well, excactly 3 fettered names: "ProjectCreatorConfig"), yes unbelievable ... one day lost for this, I hope this helps someone.

Regards

icaromagnago May 15, 2013

Thanks Leonardo Onieva your answer was helpful!

0 votes
Sunny Sharma October 6, 2011

This seems to be working now. I re-did the whole thing (plugin) from the scratch (especially the AO components) and it works now without any problem.

I can not figure out exactly, what was the problem earlier and don't have time to look into it again :)

TAGS
AUG Leaders

Atlassian Community Events