Unable to register Jira service with Active Objects dependency

Pawel Owsnicki
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
March 20, 2024

I am using Jira Data Center 9.4.15. I want to create a service that uses Active Objects but I get the following error when trying to add the service:

  • Error adding service: org.picocontainer.injectors.AbstractInjector$UnsatisfiableDependenciesException: com.mot.jira.approvals.service.ReminderNotificationService has unsatisfied dependency 'interface com.atlassian.activeobjects.external.ActiveObjects' for constructor 'public com.mot.jira.approvals.service.ReminderNotificationService(com.atlassian.activeobjects.external.ActiveObjects)' from org.picocontainer.DefaultPicoContainer@76175521:1<[Immutable]:com.atlassian.jira.component.pico.CachingMutablePicoContainer@62cad7fe.

Using dependency injection with other beans works just fine. I get this error only with Active Objects.

My service class looks like this:

@Component
public class ReminderNotificationService extends AbstractService {
private final ActiveObjects activeObjects;


@Autowired
public ReminderNotificationService(ActiveObjects activeObjects) {
this.activeObjects = activeObjects;
}

@Override
public void run() { }

@Override
public ObjectConfiguration getObjectConfiguration() {
Map<String, ObjectConfigurationProperty> configProperties = new HashMap<>();
StringObjectDescription objectDescription = new StringObjectDescription("");

return new ObjectConfigurationImpl(configProperties, objectDescription);
}
}

 

atlassian-plugin.xml:

...

<component-import
key="activeObjects" interface="com.atlassian.activeobjects.external.ActiveObjects"/>


<ao key="ActiveObjectModule">
<description>The module configuring the Active Objects service used by this plugin</description>
[Entity declarations]
</ao>

...

 

pom.xml:

<dependencies>
<dependency>
<groupId>com.atlassian.jira</groupId>
<artifactId>jira-api</artifactId>
<version>${jira.version}</version>
<scope>provided</scope>
</dependency>

<dependency>
<groupId>com.atlassian.jira</groupId>
<artifactId>jira-core</artifactId>
<version>${jira.version}</version>
<scope>provided</scope>
</dependency>

<dependency>
<groupId>com.atlassian.activeobjects</groupId>
<artifactId>activeobjects-plugin</artifactId>
<version>3.0.0</version>
<scope>provided</scope>
</dependency>

<dependency>
<groupId>com.atlassian.sal</groupId>
<artifactId>sal-api</artifactId>
<version>4.0.0</version>
<scope>provided</scope>
</dependency>

<dependency>
<groupId>javax.inject</groupId>
<artifactId>javax.inject</artifactId>
<version>1</version>
<scope>provided</scope>
</dependency>

<!-- WIRED TEST RUNNER DEPENDENCIES -->
<dependency>
<groupId>com.atlassian.plugin</groupId>
<artifactId>atlassian-spring-scanner-annotation</artifactId>
<version>${atlassian.spring.scanner.version}</version>
<scope>provided</scope>
</dependency>

<dependency>
<groupId>com.atlassian.plugins</groupId>
<artifactId>atlassian-plugins-osgi-testrunner</artifactId>
<version>${plugin.testrunner.version}</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>javax.ws.rs</groupId>
<artifactId>jsr311-api</artifactId>
<version>1.1.1</version>
<scope>provided</scope>
</dependency>

<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.2.2-atlassian-1</version>
</dependency>
</dependencies>

...

<properties>
<jira.version>9.4.15</jira.version>
<amps.version>8.2.2</amps.version>
<plugin.testrunner.version>2.0.2</plugin.testrunner.version>
<atlassian.spring.scanner.version>2.1.7</atlassian.spring.scanner.version>
<atlassian.plugin.key>${project.groupId}.${project.artifactId}</atlassian.plugin.key>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
</properties>

ComponentAccessor.getOSGiComponentInstanceOfType(ActiveObjects.class) also doesn't work, it returns null.

0 answers

Suggest an answer

Log in or Sign up to answer