Dependency Injection in Jira Plugin is Failing

Hi Atlassian Team,

Good Afternoon.

I have developed a custom Rest API plugin using Atlassian SDK. I was able to execute Hellow World Rest Plugin. But I am getting 404 error if I inject the following JIRA API Classes to my Rest Class.

a) com.seic.ims.jira.plugins.components.IssueServiceImpl

b) com.atlassian.jira.bc.issue.search.SearchService

c) com.atlassian.sal.api.user.UserManager


HTTP Error Response:

HTTP Status 404 - NoOpServlet received an unexpected request. More information is available in the log file.



Please find my current JIRA properties in POM xml below.

<properties>
<platform.version>3.0.0</platform.version>
<refapp.version>4.0.0</refapp.version>
<jira.version>6.3.7</jira.version>
<amps.version>6.2.1</amps.version>
<plugin.testrunner.version>1.2.3</plugin.testrunner.version>
<atlassian.spring.scanner.version>1.2.6</atlassian.spring.scanner.version>
<!-- This key is used to keep the consistency between the key in atlassian-plugin.xml and the key to generate bundle. -->
<atlassian.plugin.key>${project.groupId}.${project.artifactId}</atlassian.plugin.key>
</properties>

I have configured these dependencies as like below.

atlassian-plugin.xml

----------------------------

<component-import key="projectService" interface="com.atlassian.jira.bc.project.ProjectService" filter=""/>
<component-import key="issueService" interface="com.atlassian.jira.bc.issue.IssueService" filter=""/>
<component-import key="searchService" interface="com.atlassian.jira.bc.issue.search.SearchService" filter=""/>
<component-import key="userManager" interface="com.atlassian.sal.api.user.UserManager" filter=""/>

 

My Rest Resource Class:

@Path("/message")
public class JiraIssueRest {
private static Logger logger = LoggerFactory.getLogger(JiraIssueRest.class);

@ComponentImport
private IssueService issueService;
@ComponentImport
private ProjectService projectService;
@ComponentImport
private SearchService searchService;
@ComponentImport
private UserManager userManager;

public JiraIssueRest() {

}

@Inject
public JiraIssueRest(IssueService issueService,ProjectService projectService,SearchService searchService,UserManager userManager){
this.issueService = issueService;
this.projectService = projectService;
this.searchService = searchService;
this.userManager = userManager;
}

@GET
@AnonymousAllowed
@Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
public Response getMessage()
{
logger.debug("Entering getMessage()");
return Response.ok(new JiraIssueRestModel(("Muzeeb, Is this is your first plugin ? "))).build();
}

}


Thank you In Advance.


Regards

Muzeeb Mohammed

 

4 answers

What's in the atlassian-jira.log file?

I am running this plugin in JIRA Standalone mode. I am executing command "atlas-run" from command line. I don't see 'atlassian-jira.log' file in TARGET directory. 

I only see the following logger messages at path 'jiraissuecrud\target\container\tomcat8x\cargo-refapp-home\logs\localhost_access_log..2016-06-21.txt'

 

127.0.0.1 - - [21/Jun/2016:15:01:47 -0400] "GET /cargocpc/index.html HTTP/1.1" 200 124
0:0:0:0:0:0:0:1 - - [21/Jun/2016:15:01:58 -0400] "GET /refapp/rest/jiraissuerest/1.0/message HTTP/1.1" 404 1170
0:0:0:0:0:0:0:1 - - [21/Jun/2016:15:02:08 -0400] "GET /refapp/rest/jiraissuerest/1.0/message HTTP/1.1" 404 1170

The atlassian-jira.log file is located in target/jira/home/log - check if for errors, especially when you start JIRA.

This issue is resolved. I developed this plugin using command atlas-create-refapp-plugin-module  and I executed my plugin using command atlas-run, it is running inside refapp web application. It didn't download local JIRA instance.

That said, I have packed my plugin using command atlas-mvn install and explicitly deployed plugin(jar) file to my local JIra Instance. Now I am able to invoke my custom Rest Resource.

 

Thanks for your help.

Suggest an answer

Log in or Sign up to answer
Atlassian Community Anniversary

Happy Anniversary, Atlassian Community!

This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.

Read more
Community showcase
Julia Dillon
Posted Apr 17, 2018 in Jira

Tell us how your team runs on Jira!

Hey Atlassian Community! Today we are launching a bunch of customer stories about the amazing work teams, like Dropbox and Twilio, are doing with Jira. You can check out the stories here. The thi...

819 views 2 19
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you