Jira Plugin doesnt start

Francisco Gomez Balastegui October 28, 2019

Hi, i'm making a plugin, i make the next class:

package com.inlogiq.plugins.permissions;

import javax.inject.Named;
import com.atlassian.plugin.spring.scanner.annotation.export.ExportAsService;

import com.atlassian.jira.component.ComponentAccessor;
import com.atlassian.jira.security.roles.ProjectRoleManager;
import com.atlassian.jira.security.roles.ProjectRole;
import com.atlassian.jira.security.roles.ProjectRoleImpl;
import javax.inject.Inject;
import com.atlassian.jira.user.ApplicationUser;
import com.atlassian.jira.project.Project;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;


@ExportAsService({ManagerPermissions.class})
@Named("ManagerPermissions")
public class ManagerPermissions {
private static final Logger log = LoggerFactory.getLogger(ManagerPermissions.class);

//ProjectRole pluginRole;

@Inject
public ManagerPermissions(){
ProjectRoleManager roleManager = ComponentAccessor.getComponent(ProjectRoleManager.class);
ProjectRole foundedRole = roleManager.getProjectRole("MyBolsa");
log.warn("Rol encontrado: " + foundedRole);
if (foundedRole == null) {
ProjectRole myRole = new ProjectRoleImpl("MyBolsa", "My Own Role");
roleManager.createRole(myRole);
}
}

When i make and atlas-mvn package works correctly, create a new role called MyBolsa, the problem comes when i stop Jira and and atlas-run then jira can't start 

2 answers

0 votes
Francisco Gomez Balastegui October 30, 2019

Hi @Tuncay Senturk  i see this:

 

2019-10-30 09:52:52,926 Spring DM Context Creation Timer WARN [o.e.g.b.e.i.dependencies.startup.DependencyWaiterApplicationContextExecutor] Timeout occurred before finding service dependencies for [NonValidatingOsgiBundleXmlApplicationContext(bundle=com.atlassian.jira.plugins.jira-importers-redmine-plugin, config=osgibundle:/META-INF/spring/*.xml)]
2019-10-30 09:52:52,927 Spring DM Context Creation Timer ERROR [c.a.p.osgi.factory.OsgiPlugin] Plugin 'com.atlassian.jira.plugins.jira-importers-redmine-plugin' never resolved service '&usageTrackingService' with filter '(&(objectClass=com.atlassian.jira.plugins.importer.tracking.UsageTrackingService)(objectClass=com.atlassian.jira.plugins.importer.tracking.UsageTrackingService))'
2019-10-30 09:52:52,927 Spring DM Context Creation Timer ERROR [c.a.p.osgi.factory.OsgiPlugin] Plugin 'com.atlassian.jira.plugins.jira-importers-redmine-plugin' never resolved service '&configFileHandler' with filter '(&(objectClass=com.atlassian.jira.plugins.importer.web.ConfigFileHandler)(objectClass=com.atlassian.jira.plugins.importer.web.ConfigFileHandler))'
2019-10-30 09:52:52,927 Spring DM Context Creation Timer ERROR [c.a.p.osgi.factory.OsgiPlugin] Plugin 'com.atlassian.jira.plugins.jira-importers-redmine-plugin' never resolved service '&jiraDataImporter' with filter '(&(objectClass=com.atlassian.jira.plugins.importer.imports.importer.JiraDataImporter)(objectClass=com.atlassian.jira.plugins.importer.imports.importer.JiraDataImporter))'
2019-10-30 09:52:52,927 Spring DM Context Creation Timer ERROR [c.a.p.osgi.factory.OsgiPlugin] Unable to start the plugin container for plugin 'com.atlassian.jira.plugins.jira-importers-redmine-plugin'
org.springframework.context.ApplicationContextException: Application context initialization for 'com.atlassian.jira.plugins.jira-importers-redmine-plugin' has timed out waiting for (|(&(objectClass=com.atlassian.jira.plugins.importer.imports.importer.JiraDataImporter)(objectClass=com.atlassian.jira.plugins.importer.imports.importer.JiraDataImporter))(&(objectClass=com.atlassian.jira.plugins.importer.tracking.UsageTrackingService)(objectClass=com.atlassian.jira.plugins.importer.tracking.UsageTrackingService))(&(objectClass=com.atlassian.jira.plugins.importer.web.ConfigFileHandler)(objectClass=com.atlassian.jira.plugins.importer.web.ConfigFileHandler)))
at org.eclipse.gemini.blueprint.extender.internal.dependencies.startup.DependencyWaiterApplicationContextExecutor.timeout(DependencyWaiterApplicationContextExecutor.java:489)
at org.eclipse.gemini.blueprint.extender.internal.dependencies.startup.DependencyWaiterApplicationContextExecutor.access$000(DependencyWaiterApplicationContextExecutor.java:54)
at org.eclipse.gemini.blueprint.extender.internal.dependencies.startup.DependencyWaiterApplicationContextExecutor$WatchDogTask.run(DependencyWaiterApplicationContextExecutor.java:109)
at java.util.TimerThread.mainLoop(Timer.java:555)
at java.util.TimerThread.run(Timer.java:505)

0 votes
Tuncay Senturk
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
October 28, 2019

Hi @Francisco Gomez Balastegui 

What error(s) are you getting in the console or in atlassian-jira.log file?

Francisco Gomez Balastegui October 30, 2019

Hi @Tuncay Senturk 

 

I get this error:image.pngAlso on the console i see this:

image.png

This is my pom:

 

<?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.inlogiq.plugins</groupId>
<artifactId>MyPlugin</artifactId>
<version>1.0.0-SNAPSHOT</version>
<organization>
<name>Example Company</name>
<url>http://www.example.com/</url>
</organization>
<name>myPlugin</name>
<description>This is the com.inlogiq.plugins:MyPlugin 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>
-->
<!-- https://mvnrepository.com/artifact/com.atlassian.jira/jira-core -->
<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.plugin</groupId>
<artifactId>atlassian-spring-scanner-annotation</artifactId>
<version>${atlassian.spring.scanner.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.atlassian.plugin</groupId>
<artifactId>atlassian-spring-scanner-runtime</artifactId>
<version>${atlassian.spring.scanner.version}</version>
<scope>runtime</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.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>
<!-- Active objects dependency -->
<dependency>
<groupId>com.atlassian.activeobjects</groupId>
<artifactId>activeobjects-plugin</artifactId>
<version>3.1.7</version>
<scope>provided</scope>
</dependency>
<!-- Google Collections, useful utilities for manipulating collections -->
<dependency>
<groupId>com.google.collections</groupId>
<artifactId>google-collections</artifactId>
<version>1.0</version>
<scope>provided</scope>
</dependency>
<!-- Dependencia con Sal-->
<dependency>
<groupId>com.atlassian.sal</groupId>
<artifactId>sal-api</artifactId>
<version>3.0.7</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>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.6.6</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-all</artifactId>
<version>1.8.5</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.4</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>com.atlassian.templaterenderer</groupId>
<artifactId>atlassian-template-renderer-api</artifactId>
<version>2.1.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-api</artifactId>
<version>7.0</version>
<scope>provided</scope>
<type>jar</type>
</dependency>
<dependency>
<groupId>org.wildfly.core</groupId>
<artifactId>wildfly-server</artifactId>
<version>2.2.0.Final</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>org.apache.wink</groupId>
<artifactId>wink-client</artifactId>
<version>1.4</version>
<scope>test</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/org.json/json Dependencia para gestionar la creación de JSON -->
<dependency>
<groupId>org.json</groupId>
<artifactId>json</artifactId>
<version>20190722</version>
</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>
<enableFastdev>false</enableFastdev>
<!-- 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.inlogiq.plugins.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>
<plugin>
<groupId>com.atlassian.plugin</groupId>
<artifactId>atlassian-spring-scanner-maven-plugin</artifactId>
<version>${atlassian.spring.scanner.version}</version>
<executions>
<execution>
<goals>
<goal>atlassian-spring-scanner</goal>
</goals>
<phase>process-classes</phase>
</execution>
</executions>
<configuration>
<scannedDependencies>
<dependency>
<groupId>com.atlassian.plugin</groupId>
<artifactId>atlassian-spring-scanner-external-jar</artifactId>
</dependency>
</scannedDependencies>
<verbose>false</verbose>
</configuration>
</plugin>
</plugins>
</build>
<properties>
<jira.version>8.3.0</jira.version>
<amps.version>8.0.2</amps.version>
<plugin.testrunner.version>2.0.1</plugin.testrunner.version>
<atlassian.spring.scanner.version>2.1.12</atlassian.spring.scanner.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>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>
</project>
Tuncay Senturk
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
October 30, 2019

Devil is in the details,

Please find atlassian-jira.log file and try to find the very first exception stack trace while Jira was trying to run. There should be many stack traces since almost all apps fail while starting.

Suggest an answer

Log in or Sign up to answer