Search code examples
javajirajelly

Java Code to Run JIRA Jelly Script


This is my Jelly Script to perform IssueLinking in Jira 4.2...This works fine when trying to ru directly in Jira4.2.

    <JiraJelly xmlns:jira="jelly:com.atlassian.jira.jelly.JiraTagLib">
    <jira:Login username="jiraloginname" password="jirapwd">
    <jira:LinkIssue key="issuekey1" linkKey="issuekey2" linkDesc="duplicates"/>
    </jira:Login>
    </JiraJelly>

This is my Java Code to call the JellyScript and Execute. But this throws some exception.

    JellyContext context = new JellyContext();
    Writer objWriter = new StringWriter();
    XMLWriter xmlWriter = new XMLWriter(objWriter);
    XMLOutput objOut = XMLOutput.createXMLOutput(objWriter);
    context.runScript("IssueLinking-Jelly.jelly", objOut);

When this code is executed, the following exceptions are caught.

org.apache.commons.jelly.JellyTagException: <jira:Login> com.atlassian.jira.jelly.tag.login.Login doesn't have any satisfiable constructors. Unsatisfiable dependencies: [[interface com.atlassian.jira.security.JiraAuthenticationContext]]
Caused by: org.picocontainer.defaults.UnsatisfiableDependenciesException: com.atlassian.jira.jelly.tag.login.Login doesn't have any satisfiable constructors. Unsatisfiable dependencies: [[interface com.atlassian.jira.security.JiraAuthenticationContext]]

Solution

  • The same issue linking functionality was fixed using Http Post method to the LinkExistingIssue page in JIRA.

    Thanks.