How to access JSD from post-function

Hi all,

I’m trying to access JSD from a workflow post function I’m currently implementing. Goal is to modify the issue’s SLA info based on data that has been provided in the WF transition.

My problem is that i do not know how to get an “entry” to the JSD classes…

In my post-function class I have a
@ComponentImport ServiceDeskManager sdManager;
which I would like to use for a
serviceDesk = sdManager.getServiceDeskForProject (issue.getProjectObject());

The code compiles fine. However when the post function is getting called, myserviceDeskManager variable turns out to be null!

What am I missing? Anyone can tell me how to create a valid JSD manager class?

Thanks in advance!

https://developer.atlassian.com/jiradev/jira-applications/jira-service-desk/jira-service-desk-development-guide#JIRAServiceDeskdevelopmentguide-jsdversion

If you want to use the JIRA Service Desk API in your plugin project, add a dependency to your plugin POM as follows:

  1. Go to the Java API documentation for the version of JIRA Service Desk that you are using: JIRA Service Desk API 3.3.0-REL-0036 API (for example).
  2. Add a provided dependency on jira-servicedesk-api to your plugin POM, using the version shown in the documentation (3.3.1 → 3.3.0-REL-0036).

Did you annotate the class with the appropriate annotation? Something like @Scanned? Then on the constructor you’ll need the @Inject annotation as well.

Hi Daniel,

Thanks for that hint! Of course i already had annotated the class with @Scanned, however i did not specify a constructor! My class is extending AbstractJiraFunctionProvider, just implementing the execute(…) method and I was using the super constructor. After adding my own constructor with @ComponentImport parameter, I finally have my ServiceDeskManager class available!

However when now trying to call
Either<AnError,ServiceDesk> serviceDesk = sdManager.getServiceDeskForProject (issue.getProjectObject());
and even when using
Object = sdManager.getServiceDeskForProject (issue.getProjectObject());
i get the following exception:

[INFO] [talledLocalContainer] java.lang.LinkageError: loader constraint violation: loader (instance of org/apache/felix/framework/BundleWiringImpl$BundleClassLoaderJava5) previously initiated loading for a different type with name "com/atlassian/fugue/Either" [INFO] [talledLocalContainer] at java.lang.ClassLoader.defineClass1(Native Method) [INFO] [talledLocalContainer] at java.lang.ClassLoader.defineClass(ClassLoader.java:763) [INFO] [talledLocalContainer] at org.apache.felix.framework.BundleWiringImpl$BundleClassLoader.findClass(BundleWiringImpl.java:2279) ...

Any idea??

It looks like you have an OSGI classloader issue

Have you marked the com.atlassian.fugue dependency as compile in your plugin? It should be provided and OSGI imported (Import-Package), so that JIRA can give it to you.