Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

java.lang.TypeNotPresentException: Type com.atlassian.jira.issue.Issue not present

Adil Fulara September 22, 2011

Hi,

I am attempting to create a rest service within my jira environment to return a list of all issues assigned to current user and with status RESOLVED. Since the legacy portlet for exact same thing does not work in our current JIRA 4.1.1, i am attempting to create a gadget which will use the above rest service.

I performed the environment setup
1. Installed SDK https://developer.atlassian.com/display/DOCS/Installing+the+Atlassian+Plugin+SDK
2. The sample REST Tutorial worked fine. https://developer.atlassian.com/display/DOCS/Plugin+Tutorial+-+Writing+REST+Services
3. I made modifications to the java source to query jira for issue using import com.atlassian.jira.bc.issue.search.SearchService, import com.atlassian.jira.ComponentManager; and import com.atlassian.jira.jql.builder.JqlQueryBuilder;

following snippet is the only addition.

public List<Issue> getIssues() 
{
  JqlQueryBuilder builder = JqlQueryBuilder.newBuilder();
  builder.where().status(IssueFieldConstants.RESOLVED_STATUS).and().assigneeIsCurrentUser();
  try 
  { 
       issues = searchService.search( ComponentManager.getInstance().getJiraAuthenticationContext() .getLoggedInUser(), builder.buildQuery(), PagerFilter.getUnlimitedFilter()).getIssues(); 
  } 
  catch (SearchException e) 
  { // TODO Auto-generated catch block e.printStackTrace(); }
  return issues;
}

The following error is observed.

Cause:
java.lang.TypeNotPresentException: Type com.atlassian.jira.issue.Issue not present

1 answer

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

0 votes
Wojciech Seliga
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 25, 2011

If the sample REST plugin compiled and run by you worked fine, then I guess the problem is with returning objects of Issue class in your REST service method.

Normally if you return not standard types, but objects of your own classes, you should annotate such classes with various JAXB annotations (@XmlRootElement, @XmlElement, @XmlAttribute, etc.). Thanks to that the framework knows how to marshal your Java objects (your return values) into JSON representation.

Take a look at https://developer.atlassian.com/display/DOCS/Plugin+Tutorial+-+Writing+REST+Services#PluginTutorial-WritingRESTServices-TheMessage or any *Bean class from jira-rest-plugin bundled with JIRA (the source code is available for all commercial license holders, which includes Starter license).

Anyway full stack trace would be more helpful here - as I am only guessing here.

Adil Fulara September 25, 2011

Wojciech,

In the sample rest tutorial, no atlassian classes were used. So i dont think they related types were even loaded in memory. The error points to the first line of code when i try to query for jira for issues. My classes have been annotated with JAXB.

I couldnt find a way to attach .log file to this question? Do you know how i can if that helps?

Thank you,

Adil.

Wojciech Seliga
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 26, 2011

I think that you could either include it here using blockquote or code section (removing unnecessary entries - like tons of servlet filters). Alternatively you can publish it to some web drive (like dropbox.com) and share the link to it.

Ideally if you share the entire project (ideally cut to the smallest piece which still exposes this unexpected behaviour) then it would be easier for us to reproduce it locally and analyse.

Adil Fulara September 26, 2011

Helo Wojciech,

I exported the java project from eclipse ide ( source files ) and placed it in my public dropbox folder.

http://dl.dropbox.com/u/22830/jira-rest-plugin/jira-rest-plugin.zip

It it the same rest plugin from JIRA tutorial with the Message class added with an extra function to return a list of resolved issues.

Appreciate your help.

Adil.

TAGS
AUG Leaders

Atlassian Community Events