Missed Team ’24? Catch up on announcements here.

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

ERROR: Unsatisfied dependency expressed through constructor argument

Nahn Yanootz
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.
April 29, 2012

Hello everybody

I'm new in Jira plugin development, so I started reading through Jobin Kuruvilla's "JIRA Development Cookbook" to get myself started. I am developing for JIRA 4.4.3.

So far so good, but when I got to the "Displaying dynamic notifications / warnings on issues" section (page 293) I began having some "issues". (not the typical JIRA issues :))

In this section, the author added a webwork entry to the "atlassian-plugin.xml", and then extended the action class "ViewIssue" with "ExtendedViewIssue" and added an extra method (which is not important right now). When I extended the "ViewIssue" class, my IDE (Eclipse) added a constructor to my "ExtendedViewIssue" class which called the superclass' constructor and automatically generated all the needed parameters.

here's the atlassian-plugin.xml webwork entry:

<webwork1 key="view-issue" name="View Issue with warning" class="java.lang.Object">
		<description>View Issue Screen with Warnings </description>
		<actions>
			<action name="com.jtricks.web.action.ExtendedViewIssue" alias="ViewIssue">
				<view name="success">/secure/views/issue/viewissue.jsp</view>
				<view name="issuenotfound">/secure/views/issuenotfound.jsp
				</view>
				<view name="permissionviolation">/secure/views/permissionviolation.jsp
				</view>
				<command name="moveIssueLink" alias="MoveIssueLink">
					<view name="error">/secure/views/issue/viewissue.jsp</view>
				</command>
			</action>
		</actions>
	</webwork1>

here's the ExtendedViewIssue class:

public class ExtendedViewIssue extends ViewIssue {
	public ExtendedViewIssue(
			ThumbnailManager thumbnailManager,
			SubTaskManager subTaskManager,
			IssueLinkManager issueLinkManager,
			PluginAccessor pluginAccessor,
			FieldManager fieldManager,
			FieldScreenRendererFactory fieldScreenRendererFactory,
			FieldLayoutManager fieldLayoutManager,
			RendererManager rendererManager,
			CommentManager commentManager,
			ProjectRoleManager projectRoleManager,
			CommentService commentService,
			AttachmentManager attachmentManager,
			AttachmentService attachmentService,
			PagerManager pagerManager,
			WebResourceManager webResourceManager,
			SimpleLinkManager simpleLinkManager,
			AttachmentZipKit attachmentZipKit,
			NonZipExpandableExtensions nonZipExpandableExtensions,
			WebInterfaceManager webInterfaceManager,
			PermissionManager permissionManager,
			ModuleWebComponent moduleWebComponent,
			AggregateTimeTrackingCalculatorFactory aggregateTimeTrackingCalculatorFactory) {
		super(thumbnailManager, subTaskManager, issueLinkManager, pluginAccessor,
				fieldManager, fieldScreenRendererFactory, fieldLayoutManager,
				rendererManager, commentManager, projectRoleManager, commentService,
				attachmentManager, attachmentService, pagerManager, webResourceManager,
				simpleLinkManager, attachmentZipKit, nonZipExpandableExtensions,
				webInterfaceManager, permissionManager, moduleWebComponent,
				aggregateTimeTrackingCalculatorFactory);
	}

	public someMethodThatWeDontCareAbout(){}
}

The problem came up after I packaged and installed the plugin and went to "view" an issue with the extended action. That's when I received the following error:

HTTP Status 404 - Could not execute action [ViewIssue]:Error creating bean with name 'com.jtricks.web.action.ExtendedViewIssue': 
Unsatisfied dependency expressed through constructor argument with index 13 of type [com.atlassian.jira.issue.pager.PagerManager]: 
: No unique bean of type [com.atlassian.jira.issue.pager.PagerManager] is defined: 
Unsatisfied dependency of type [class com.atlassian.jira.issue.pager.PagerManager]: 
expected at least 1 matching bean; 
nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: 
No unique bean of type [com.atlassian.jira.issue.pager.PagerManager] is defined: 
Unsatisfied dependency of type [class com.atlassian.jira.issue.pager.PagerManager]: 
expected at least 1 matching bean<p><small><small>

and so on.

Did anyone else have this error when extending an action? Am I doing this right?

Thanks

1 answer

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

4 votes
Answer accepted
Dieter
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.
April 29, 2012

You should first try to see if it works by adding this atlassia-plugin.xml

<component-import key="pagerManager" interface="com.atlassian.jira.issue.pager.PagerManager"/>

If hat does not help, please do not use the PagerManager in the constructor since not all classes are available in the constructor for V2 plugins. You might have to do the same for other classes as well. Just look at your error messages

public class ExtendedViewIssue extends ViewIssue {
    public ExtendedViewIssue(
            ThumbnailManager thumbnailManager,
            SubTaskManager subTaskManager,
            IssueLinkManager issueLinkManager,
            PluginAccessor pluginAccessor,
            FieldManager fieldManager,
            FieldScreenRendererFactory fieldScreenRendererFactory,
            FieldLayoutManager fieldLayoutManager,
            RendererManager rendererManager,
            CommentManager commentManager,
            ProjectRoleManager projectRoleManager,
            CommentService commentService,
            AttachmentManager attachmentManager,
            AttachmentService attachmentService,
            WebResourceManager webResourceManager,
            SimpleLinkManager simpleLinkManager,
            AttachmentZipKit attachmentZipKit,
            NonZipExpandableExtensions nonZipExpandableExtensions,
            WebInterfaceManager webInterfaceManager,
            PermissionManager permissionManager,
            ModuleWebComponent moduleWebComponent,
            AggregateTimeTrackingCalculatorFactory aggregateTimeTrackingCalculatorFactory) {
        super(thumbnailManager, subTaskManager, issueLinkManager, pluginAccessor,
                fieldManager, fieldScreenRendererFactory, fieldLayoutManager,
                rendererManager, commentManager, projectRoleManager, commentService,
                attachmentManager, attachmentService, ComponentManager.getComponentInstanceOfType(PagerManager.class), webResourceManager,
                simpleLinkManager, attachmentZipKit, nonZipExpandableExtensions,
                webInterfaceManager, permissionManager, moduleWebComponent,
                aggregateTimeTrackingCalculatorFactory);
    }
 
    public someMethodThatWeDontCareAbout(){}
}

You can read more about this error at https://developer.atlassian.com/display/DOCS/UnsatisfiedDependencyException+-+Error+creating+bean+with+name

Dieter
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.
May 1, 2012

if all this doesn't help you could also make your plugin a V1 plugin.

Nahn Yanootz
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.
May 1, 2012

Thanks a lot for your prompt answer. Your last comment solved the problem.

I went through your answer and tried each step and here's what were my results:

- I tried importing the component, but plugin cannot be enabled. (DIDN'T WORK - it's probably a version 2 issue)

- I tried removing the "pagerManager" but then it doesn't match any constructor of that class. (DIDN'T WORK)

- I changed plugin version to version 1, and voila! (WORKED)

Thanks again, man

Dieter
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.
May 1, 2012

When i wrote my original answer, i was not aware yet that the PagerManager is a class which is not available to V2 plugins. I only figured this out after i had double checked the source code in ContainerRegistrar.java

register.implementation(INTERNAL, PagerManager.class);

This line tells that the class is not available to V2 plugins

TAGS
AUG Leaders

Atlassian Community Events