Hi community,
We are encountering the following exception when using EntityManager
, JiraAuthenticationContext
, and ComponentAccessor
in REST classes of a Jira plugin developed with Jira version 9.12.2 and Atlassian Plugin SDK version 9.1.1:
Bundle com.atlassian.plugins.rest.atlassian-rest-module [163] ServiceRegistrationImpl: Error ungetting service. (java.lang.IllegalStateException: Invalid BundleContext
To resolve this, we added the following jvm argument to the <jvmArgs>
section in the pom.xml
file:
-Datlassian.plugins.enable.wait=10000
However, the same exception persists, and the REST endpoints fail to work, returning a 401 Unauthorized response.
Are there any missing dependency packages that should be included?
The pom.xml file for this project is attached for reference.
* <?xml version="1.0" encoding="UTF-8"?>
* <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
* <modelVersion>4.0.0</modelVersion>
* <groupId>com.planner</groupId>
* <artifactId>planner</artifactId>
* <version>1.0.0-SNAPSHOT</version>
* <organization>
* <name>Example Company</name>
* <url>http://www.example.com/</url>
* </organization>
* <name>planner</name>
* <description>This is the com.planner:planner plugin for Atlassian JIRA.</description>
* <packaging>atlassian-plugin</packaging>
* <dependencies>
* <dependency>
* <groupId>com.atlassian.jira</groupId>
* <artifactId>jira-api</artifactId>
* <version>${jira.version}</version>
* <scope>provided</scope>
* </dependency>
* <!-- Add dependency on jira-core if you want access to JIRA implementation classes as well as the sanctioned API. -->
* <!-- This is not normally recommended, but may be required eg when migrating a plugin originally developed against JIRA 4.x -->
* <!--
* <dependency>
* <groupId>com.atlassian.jira</groupId>
* <artifactId>jira-core</artifactId>
* <version>${jira.version}</version>
* <scope>provided</scope>
* </dependency>
* -->
* <dependency>
* <groupId>junit</groupId>
* <artifactId>junit</artifactId>
* <version>4.10</version>
* <scope>test</scope>
* </dependency>
* <dependency>
* <groupId>com.atlassian.plugins</groupId>
* <artifactId>atlassian-plugins-osgi-javaconfig</artifactId>
* <version>${osgi.javaconfig.version}</version>
* </dependency>
* <!-- OSGi Java Config dependencies -->
* <dependency>
* <groupId>org.apache.felix</groupId>
* <artifactId>org.apache.felix.framework</artifactId>
* <version>4.0.0</version>
* <scope>provided</scope>
* </dependency>
* <dependency>
* <groupId>org.springframework</groupId>
* <artifactId>spring-beans</artifactId>
* <version>${spring.version}</version>
* <scope>provided</scope>
* </dependency>
* <dependency>
* <groupId>org.springframework</groupId>
* <artifactId>spring-context</artifactId>
* <version>${spring.version}</version>
* <scope>provided</scope>
* </dependency>
* <!-- WIRED TEST RUNNER DEPENDENCIES -->
* <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>
* <!-- Uncomment to use TestKit in your project. Details at https://bitbucket.org/atlassian/jira-testkit -->
* <!-- You can read more about TestKit at https://developer.atlassian.com/display/JIRADEV/Plugin+Tutorial+-+Smarter+integration+testing+with+TestKit -->
* <!--
* <dependency>
* <groupId>com.atlassian.jira.tests</groupId>
* <artifactId>jira-testkit-client</artifactId>
* <version>${testkit.version}</version>
* <scope>test</scope>
* </dependency>
* -->
* <dependency>
* <groupId>javax.servlet</groupId>
* <artifactId>servlet-api</artifactId>
* <version>2.4</version>
* <scope>provided</scope>
* </dependency>
* <dependency>
* <groupId>javax.xml.bind</groupId>
* <artifactId>jaxb-api</artifactId>
* <version>2.3.1</version>
* <scope>provided</scope>
* </dependency>
* <dependency>
* <groupId>com.atlassian.plugins.rest</groupId>
* <artifactId>atlassian-rest-common</artifactId>
* <version>1.0.2</version>
* <scope>provided</scope>
* </dependency>
* <dependency>
* <groupId>com.atlassian.sal</groupId>
* <artifactId>sal-api</artifactId>
* <version>2.6.0</version>
* <scope>provided</scope>
* </dependency>
* <dependency>
* <groupId>org.apache.wink</groupId>
* <artifactId>wink-client</artifactId>
* <version>1.4</version>
* <scope>test</scope>
* </dependency>
* <dependency>
* <groupId>org.mockito</groupId>
* <artifactId>mockito-all</artifactId>
* <version>1.8.5</version>
* <scope>test</scope>
* </dependency>
* <dependency>
* <groupId>org.slf4j</groupId>
* <artifactId>slf4j-api</artifactId>
* <version>1.6.6</version>
* <scope>provided</scope>
* </dependency>
* <dependency>
* <groupId>org.apache.httpcomponents</groupId>
* <artifactId>httpclient</artifactId>
* <version>4.1.1</version>
* <scope>test</scope>
* </dependency>
* <dependency>
* <groupId>net.java.dev.activeobjects</groupId>
* <artifactId>activeobjects</artifactId>
* <version>6.1.1</version>
* <scope>provided</scope>
* </dependency>
* <dependency>
* <groupId>com.atlassian.plugin</groupId>
* <artifactId>atlassian-spring-scanner-annotation</artifactId>
* <version>${atlassian.spring.scanner.version}</version>
* <scope>provided</scope>
* </dependency>
* <!-- https://mvnrepository.com/artifact/com.atlassian.plugins/atlassian-plugins-api -->
* <dependency>
* <groupId>com.atlassian.plugins</groupId>
* <artifactId>atlassian-plugins-api</artifactId>
* <version>8.0.15</version>
* <scope>provided</scope>
* </dependency>
* <dependency>
* <groupId>org.slf4j</groupId>
* <artifactId>slf4j-api</artifactId>
* <version>1.6.6</version>
* <scope>provided</scope>
* </dependency>
* </dependencies>
* <build>
* <plugins>
* <plugin>
* <groupId>com.atlassian.maven.plugins</groupId>
* <artifactId>jira-maven-plugin</artifactId>
* <version>${amps.version}</version>
* <extensions>true</extensions>
* <configuration>
* <productVersion>${jira.version}</productVersion>
* <productDataVersion>${jira.version}</productDataVersion>
* <!-- Uncomment to install TestKit backdoor in JIRA. -->
* <!--
* <pluginArtifacts>
* <pluginArtifact>
* <groupId>com.atlassian.jira.tests</groupId>
* <artifactId>jira-testkit-plugin</artifactId>
* <version>${testkit.version}</version>
* </pluginArtifact>
* </pluginArtifacts>
* -->
* <enableQuickReload>true</enableQuickReload>
* <jvmArgs>-Datlassian.plugins.enable.wait=10000</jvmArgs>
* <!-- See here for an explanation of default instructions: -->
* <!-- https://developer.atlassian.com/docs/advanced-topics/configuration-of-instructions-in-atlassian-plugins -->
* <instructions>
* <Atlassian-Plugin-Key>${atlassian.plugin.key}</Atlassian-Plugin-Key>
* <!-- Add package to export here -->
* <Export-Package>com.i2c.planner.api,</Export-Package>
* <!-- Add package import here -->
* <Import-Package>org.springframework.osgi.*;resolution:="optional", org.eclipse.gemini.blueprint.*;resolution:="optional", *</Import-Package>
* <!-- Ensure plugin is spring powered -->
* <Spring-Context>*</Spring-Context>
* </instructions>
* </configuration>
* </plugin>
* </plugins>
* </build>
* <properties>
* <jira.version>9.12.2</jira.version>
* <amps.version>9.1.1</amps.version>
* <plugin.testrunner.version>2.0.9</plugin.testrunner.version>
* <atlassian.spring.scanner.version>2.2.4</atlassian.spring.scanner.version>
* <osgi.javaconfig.version>0.2.0</osgi.javaconfig.version>
* <spring.version>4.2.5.RELEASE</spring.version>
* <!-- This property ensures consistency between the key in atlassian-plugin.xml and the OSGi bundle's key. -->
* <atlassian.plugin.key>${project.groupId}.${project.artifactId}</atlassian.plugin.key>
* <!-- TestKit version 6.x for JIRA 6.x -->
* <testkit.version>6.3.11</testkit.version>
* <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
* <maven.compiler.source>17</maven.compiler.source>
* <maven.compiler.target>17</maven.compiler.target>
* </properties>
* </project>
Thanks in advance.