Plugin Failed to load - missing requirement [180.0] osgi.wiring.package; (osgi.wiring.package=bsh)

vaibhav sharma November 25, 2020

HI , I am new to Jira Plugin Development. I have created a small plugin but m facing problems with loading of a plugin that i created.

Below are the logs.

[INFO] [talledLocalContainer] ___ FAILED PLUGIN REPORT _____________________
[INFO] [talledLocalContainer]
[INFO] [talledLocalContainer] 1 plugin failed to load during JIRA startup.
[INFO] [talledLocalContainer]
[INFO] [talledLocalContainer] 'dev.workflow-extensions' - 'workflow-extensions' failed to load.
[INFO] [talledLocalContainer] Cannot start plugin: dev.workflow-extensions
[INFO] [talledLocalContainer] Unresolved constraint in bundle dev.workflow-extensions [180]: Unable to resolve 180.0: missing requirement [180.0] osgi.wiring.package; (osgi.wiring.package=bsh)
[INFO] [talledLocalContainer]
[INFO] [talledLocalContainer] It was loaded from /home/ubuntu/post-function-plugin/workflow-extensions/target/jira/home/plugins/installed-plugins/work
flow-extensions-1.0.0-SNAPSHOT.jar
[INFO] [talledLocalContainer]

 

MY POM FILE- 

<?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>dev</groupId>
<artifactId>workflow-extensions</artifactId>
<version>1.0.0-SNAPSHOT</version>
<organization>
<name>Example Company</name>
<url>http://www.example.com/</url>
</organization>
<name>workflow-extensions</name>
<description>This is the dev:workflow-extensions 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.plugin</groupId>
<artifactId>atlassian-spring-scanner-annotation</artifactId>
<version>${atlassian.spring.scanner.version}</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.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>
<!-- 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>opensymphony</groupId>
<artifactId>osworkflow</artifactId>
<version>2.7.0</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>
<!-- 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>dev.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>
<verbose>false</verbose>
</configuration>
</plugin>
</plugins>
</build>
<properties>
<jira.version>7.13.0</jira.version>
<amps.version>8.1.0</amps.version>
<plugin.testrunner.version>2.0.1</plugin.testrunner.version>
<atlassian.spring.scanner.version>2.1.7</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>

 

MY JAVA FUNCTION

package dev.jira.workflow;

import java.util.Map;
import java.util.List;

import com.atlassian.jira.issue.MutableIssue;
import com.atlassian.jira.workflow.function.issue.AbstractJiraFunctionProvider;
import com.opensymphony.module.propertyset.PropertySet;
import com.opensymphony.workflow.WorkflowException;
import com.atlassian.jira.web.session.currentusers.JiraUserSession;
import com.atlassian.jira.web.session.currentusers.JiraUserSessionTracker;
import com.atlassian.plugin.spring.scanner.annotation.imports.JiraImport;
import com.atlassian.jira.security.JiraAuthenticationContext;
import com.atlassian.jira.bc.issue.IssueService;
import com.atlassian.jira.component.ComponentAccessor;
import com.atlassian.jira.issue.Issue;
import com.atlassian.jira.issue.IssueInputParameters;
import com.atlassian.jira.user.ApplicationUser;
import com.atlassian.jira.issue.IssueInputParameters;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
* This is the post-function class that gets executed at the end of the transition.
* Any parameters that were saved in your factory class will be available in the transientVars Map.
*/
public class ReportersIPPostFunction extends AbstractJiraFunctionProvider
{
private static final Logger log = LoggerFactory.getLogger(ReportersIPPostFunction.class);
public static final String FIELD_MESSAGE = "messageField";

private final JiraUserSessionTracker jiraUserSessionTracker = JiraUserSessionTracker.getInstance();

@JiraImport
private final JiraAuthenticationContext authenticationContext;

public ReportersIPPostFunction(JiraAuthenticationContext authenticationContext) {
this.authenticationContext = authenticationContext;
}

public void execute(Map transientVars, Map args, PropertySet ps) throws WorkflowException
{
MutableIssue issue = getIssue(transientVars);
String message = (String)transientVars.get(FIELD_MESSAGE);

ApplicationUser user = authenticationContext.getLoggedInUser();
IssueService issueService = ComponentAccessor.getIssueService();

String IP="";
IP = getIPAddress(user.getName());

IssueInputParameters parameters = issueService.newIssueInputParameters(transientVars);
parameters.addCustomFieldValue((long)10000,IP);
// log.error(">>>>>>>>>>>> PARAMETRERS" + String(parameters));
parameters.setRetainExistingValuesWhenParameterNotProvided(true);
IssueService.UpdateValidationResult result = issueService.validateUpdate(user, issue.getId(), parameters);
issueService.update(user, result);
// log.error(">>>>>>>>>>>>>> RESULT" + String(result));

// if (null == message) {
// message = "";
// }
//
// issue.setDescription(issue.getDescription() + message);
}

public String getIPAddress(String userName) {
String ip="";
List<JiraUserSession> snapshot = jiraUserSessionTracker.getSnapshot();
// int l=snapshot.size();
for (JiraUserSession jiraUserSession:snapshot)
{
if(jiraUserSession.getUserName()==userName)
ip= jiraUserSession.getIpAddress();
}
log.error(">>>>>>>>>>>>>>>> REPORTER'S IP : " + ip);
return ip;
}
}

Can anyone please suggest , what I am doing wrong. 

0 answers

Suggest an answer

Log in or Sign up to answer