How to fix my addon not running on remote agent, because waiting for com.atlassian.sal.api.ApplicationProperties?

Markus Schulte November 13, 2016

I am developing the addon View Checkstyle/CodeSniffer. Which does not run on remote agents.

The most recent version 1.3.0. had more than one problem on remote agents, which of I have solved some, but now I am stuck (so you won't able to reproduce my described problem using v1.3.0 from marketplace, I am on 1.3.1-SNAPSHOT).

When connecting a remote agent to my development Bamboo, my addon will not be enabled on this remote agent:

Plugin '...' never resolved service '&applicationProperties' with filter
'(&(objectClass=com.atlassian.sal.api.ApplicationProperties)(objectClass=com.atlassian.sal.api.ApplicationProperties))'
INFO   | jvm 1    | 2016/11/13 13:54:14 | 2016-11-13 13:54:14,486 INFO [ThreadPoolAsyncTaskExecutor::Thread 7] [DependencyServiceManager] Adding OSGi service dependency for importer [&applicationProperties] matching OSGi filter [(&(objectClass=com.atlassian.sal.api.ApplicationProperties)(objectClass=com.atlassian.sal.api.ApplicationProperties))]
INFO   | jvm 1    | 2016/11/13 13:54:14 | 2016-11-13 13:54:14,486 INFO [ThreadPoolAsyncTaskExecutor::Thread 7] [DependencyServiceManager] NonValidatingOsgiBundleXmlApplicationContext(bundle=eu.markusschulte.atlassian.bamboo.plugin.report-checkstyle, config=osgibundle:/META-INF/spring/*.xml) is waiting for unsatisfied dependencies [[&applicationProperties]]
INFO   | jvm 1    | 2016/11/13 13:55:14 | 2016-11-13 13:55:14,481 ERROR [AgentRunnerThread] [OsgiPlugin] Plugin 'eu.markusschulte.atlassian.bamboo.plugin.report-checkstyle' never resolved service '&applicationProperties' with filter '(&(objectClass=com.atlassian.sal.api.ApplicationProperties)(objectClass=com.atlassian.sal.api.ApplicationProperties))'
INFO   | jvm 1    | 2016/11/13 13:55:14 | 2016-11-13 13:55:14,564 ERROR [AgentRunnerThread] [PluginEnabler] Unable to start the following plugins due to timeout while waiting for plugin to enable: eu.markusschulte.atlassian.bamboo.plugin.report-checkstyle

The addon works fine on local agents, so I do not know in the first place, why this happens at all.

I tried Bamboo 5.12.5 and Bamboo 5.13.2, with fitting SAL versions.

 

Anyhow, I tried a few things, none solved my problem.

  • Adding com.atlassian.sal.api.ApplicationProperties to atlassian-plugin.xml

    <component-import key="applicationProperties"
                      name="Atlassian Bamboo ApplicationProperties"
                      interface="com.atlassian.sal.api.ApplicationProperties"/>
  • Adding SAL to dependencies, and OSGi

    <dependency>
      <groupId>com.atlassian.sal</groupId>
      <artifactId>sal-api</artifactId>
      <version>3.0.5</version>
      <scope>provided</scope>
    </dependency>
    ...
    
    <plugin>
      <groupId>com.atlassian.maven.plugins</groupId>
      <artifactId>maven-bamboo-plugin</artifactId>
      ...
      <configuration>
        <Import-Package>
        com.atlassian.sal.api.*;resolution:="optional",

Any suggestions, who to fix this issue?

1 answer

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

5 votes
Answer accepted
Henrik Opel _Utoolity_ November 13, 2016

You are encountering a case of a class simply not being available on remote agents, see @Steffen Opel [Utoolity]'s answer to Bamboo plugin not found on agents (especially the first comment on that answer, confirming that com.atlassian.sal.api.ApplicationProperties is among those classes).

In case you do not actually need that class, the easiest fix is to remove the respective dependency from your code (as was the case in context of that question).

If you actually need functionality from such a class, our standard workaround for these types of problems is trying to find a way to pipe the information needed from the missing class from the server to the agent on task execution by means of a com.atlassian.bamboo.task.RuntimeTaskDataProvider implementation (i.e. making sure that the class is only ever used on the server by that interface implementation, which then passes the resulting data to the task execution class on the remote agent).

Markus Schulte November 13, 2016

Great, reasonable answer. I will give your suggestions a try, thank you for the clarification!

TAGS
AUG Leaders

Atlassian Community Events