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

Error Creating Bean, getting an UnsatisfiedDependencyException

mahalakshmi balasubramanian August 6, 2013

My report plugin Displays project level information. The java code is almost same as single level group by, but the .vm file outputs a bunch of columns like project ID, name, lead dev, release, etc.. I have a Something.java class within the same package that simply returns a string but somehow When I try running my report plugin, I get the following error message :

org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'com.atlassian.plugins.tutorial.jira.report.reports.QaActiveQueue': Unsatisfied dependency expressed through constructor argument with index 11 of type [com.atlassian.plugins.tutorial.jira.report.reports.Something]: : No unique bean of type [com.atlassian.plugins.tutorial.jira.report.reports.Something] is defined

Kindly help me resolve this problem.


My java code is :
QaActiveQueue.java :

package com.atlassian.plugins.tutorial.jira.report.reports;

//and a few other imports

public class QaActiveQueue extends AbstractReport {

private static Log log = LogFactory.getLog(QaActiveQueue.class);

private final SearchRequestService searchRequestService;

private final CustomFieldManager customFieldManager;

private final ProjectManager projectManager;

private final Something something;

// and a few more dec...

public QaActiveQueue(final SearchProvider searchProvider,

final IssueFactory issueFactory,

final Something something, .... )

{

this.searchProvider = searchProvider;

this.searchRequestService = searchRequestService;

this.something = something;

.............

}


public StatsGroup getOptions(SearchRequest sr, User user,

StatisticsMapper mapper) throws PermissionException {


try {

return searchMapIssueKeys(sr, user, mapper);

} catch (SearchException e) {

log.error("Exception rendering " + this.getClass().getName()

+ ". Exception " + e.getMessage(), e);

return null;

}

}


public StatsGroup searchMapIssueKeys(SearchRequest request, User searcher,

StatisticsMapper mapper) throws SearchException {

try {

UtilTimerStack.push("Search Count Map");

StatsGroup statsGroup = new StatsGroup(mapper);

Collector hitCollector = new OneDimensionalDocIssueHitCollector(

mapper.getDocumentConstant(), statsGroup, issueIndexManager

.getIssueSearcher().getIndexReader(), issueFactory,

fieldVisibilityManager, readerCache);

searchProvider.searchAndSort((request != null) ? request.getQuery()

: null, searcher, hitCollector, PagerFilter

.getUnlimitedFilter());

return statsGroup;

}

finally {

UtilTimerStack.pop("Search Count Map");

}

}


@SuppressWarnings("deprecation")

public String generateReportHtml(ProjectActionSupport action, Map params)

throws Exception {

String filterId = (String) params.get("filterid");

if (filterId == null) {

log.error("Single Level Group By Report run without a project selected (JRA-5042): params="

+ params);

return "<span class='errMsg'>No search filter has been selected. Please "

+ "<a href=\"IssueNavigator.jspa?reset=Update&amp;pid="

+ TextUtils.htmlEncode((String) params

.get("selectedProjectId"))

+ "\">create one</a>, and re-run this report. See also "

+ "<a href=\"http://jira.atlassian.com/browse/JRA-5042\">JRA-5042</a></span>";

}

String mapperName = (String) params.get("mapper");

final StatisticsMapper mapper = new FilterStatisticsValuesGenerator()

.getStatsMapper(mapperName);

final JiraServiceContext ctx = new JiraServiceContextImpl(

action.getLoggedInUser());

final SearchRequest request = searchRequestService.getFilter(ctx,

new Long(filterId));

final Map startingParams;

try {

startingParams = EasyMap.build("action", action,

"statsGroup", getOptions(request, action.getLoggedInUser(), mapper),

"searchRequest", request,

"mapperType", mapperName,

"customFieldManager", customFieldManager,

"projectManager",projectManager,

"fieldVisibility", new FieldVisibilityBean(),

"searchService", searchService,

"portlet", this,

"something",something

);


startingParams.put("outlookDate",

outlookDateManager.getOutlookDate(action.getLocale()));

return descriptor.getHtml("view", startingParams);

} catch (PermissionException e) {

log.error(e, e);

return null;

}

}

public void validate(ProjectActionSupport action, Map params) {

super.validate(action, params);

if (StringUtils.isEmpty((String) params.get("filterid"))) {

action.addError("filterid", action

.getText("report.QaActiveQueue.filter.is.required"));

}

}

}

3 answers

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

0 votes
Answer accepted
Ignat
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
August 6, 2013

Hi,

From the provided stacktrace it looks like you don't have all the dependencies for QaActiveQueue.

Do you have all your constructor dependencies described in the plugin descriptor (atlassian-plugin.xml)?

I.e.

final SearchProvider searchProvider,

final IssueFactory issueFactory,

final Something something

If you are using some from JIRA you may need to use component-import:

https://developer.atlassian.com/display/JIRADEV/Component+Import+Plugin+Module

--

Cheers,

Ignat.

mahalakshmi balasubramanian August 6, 2013

Hi Ignat, adding the component description actually worked. Thank you so much! I I am not sure if a component description has to be given for every new class created by the user that is added to the plugin though.

THIS WAS THE FIX i had to make in my atlassian-plugin.xml file :

<component key="something" class="com.atlassian.plugins.tutorial.jira.report.reports.Something" public="true"><interface>java.io.Serializable</interface></component>

0 votes
mahalakshmi balasubramanian August 6, 2013

2. Something.java :

package com.atlassian.plugins.tutorial.jira.report.reports;

//import java.io.Serializable;

public class Something

{

public Something()

{

}

public String returnMyStupidString()

{

return "String";

}

}

0 votes
mahalakshmi balasubramanian August 6, 2013
This is my .vm file snippet that tries to output the value of the string from Something :
....
.....
.....
#if ($issues.size() &gt; 0 )
            #foreach ($issue in $issues)
                &lt;tr&gt;
                &lt;td nowrap&gt;
                    	     #set($TargetDate = $something.returnMyStupidString())
                             #if($TargetDate)
                             $TargetDate.value
                             #else
                             $i18n.getText('common.concepts.unassigned')
                             #end&lt;/td&gt;
                    		                        
                        
                         &lt;td nowrap&gt;
                         #set($customField = $customFieldManager.getCustomFieldObjectByName("Release"))
                         #set($csfval = $issue.getCustomFieldValue($customField))
                         #if($csfval)
                         $csfval.name
                         #else
                         $i18n.getText('common.concepts.unassigned')
                         #end&lt;/td&gt; 
                            
                &lt;/tr&gt;
            #end
        #else
            &lt;tr&gt;
                &lt;td&gt;&amp;nbsp;&lt;/td&gt;
                &lt;td colspan="8"&gt;
                    &lt;span class="subText"&gt;$action.getText("common.concepts.noissues").&lt;/span&gt;
                &lt;/td&gt;
            &lt;/tr&gt;
        #end
    #end
    #end
&lt;/table&gt;

TAGS
AUG Leaders

Atlassian Community Events