Hi
With good help from the JIRA source (VersionSearcher and others) I am modifying a CustomFieldSearcher to implement CustomFieldStattable to be able to use the Custom Field in the Two Dimensional Filter Gadget. I need to inject one of my plugin classes into the Searcher but it seems to be impossible. I always end up with UnsatisfiableDependenciesException.
I found this link: https://developer.atlassian.com/display/DOCS/Plugin+and+Gadget+Gotchas and tried everything suggested there but nothing works. Injecting JIRA classes works without problems.
The class I am trying to inject is defined in atlassian-plugin.xml as a Component module. Since this component is part of the same plugin as the searcher I dont understand why this isn't working!
Does anyone have a clue!
Kind regards
Kristín
Community moderators have prevented the ability to post new answers.
That's almost certainly a bug in JIRA.
I raised it at https://jira.atlassian.com/browse/JRA-31413
Here is for your convenience the workaround I used successfuly a few times in the past:
Kristin,
I just ran into this exact same problem as you. What a pain. Don't know if you ever got this solved--but what I believe is happening is that the classloader can't find the component even though its in the same classloader (I believe this is a bug.)
I do have a work-around for you if you are still trying to solve this. Here's how I did it-- in my atlassian-plugin.xml file I have the following:
<component key="itemManager" class="org.safmt.jira.items.util.impl.ConfigurationItemManagerImpl" interface="org.safmt.jira.items.util.ItemManager"/> <customfield-type name="Multi Item Picker" i18n-name-key="multi-item-picker.name" key="multi-item-picker" class="org.safmt.jira.plugin.customfields.MultiItemPicker"> <description key="multi-item-picker.description">The Multi Item Picker Plugin</description> <resource type="velocity" name="view" location="templates/plugins/fields/view/view-multiitem.vm"/> <resource type="velocity" name="column-view" location="templates/plugins/fields/view/column-view-multiitem.vm"/> <resource type="velocity" name="edit" location="templates/plugins/fields/edit/edit-multiitem.vm"/> <resource type="velocity" name="xml" location="templates/plugins/fields/xml/xml-multiitem.vm"/> </customfield-type> <customfield-searcher name="MultiItem Free Text Searcher" key="multi-item-searcher" class="org.safmt.jira.issue.customfields.searchers.MultiItemPickerSearcher"> <description key="admin.customfield.searcher.textsearcher.desc">The MultiItem Text Searcher Plugin</description> <valid-customfield-type package="${project.groupId}.${project.artifactId}" key="multi-item-picker"/> <resource type="velocity" name="search" location="templates/plugins/fields/editsearcher/search-basictext.vm"/> <resource type="velocity" name="view" location="templates/plugins/fields/viewsearcher/view-searcher-basictext.vm"/> <resource type="velocity" name="label" location="templates/plugins/fields/viewsearcher/label-searcher-basictext.vm"/> </customfield-searcher>
The customfield-searcher can't injext the itemManager. But in my constructor of the Searcher, I did the following get access to the itemManager:
public MultiItemPickerSearcher( // final ItemManager itemManager, FieldVisibilityManager fieldVisibilityManager, JqlOperandResolver jqlOperandResolver, OperatorUsageValidator usageValidator, CustomFieldInputHelper customFieldInputHelper, CustomFieldManager customFieldManager, SearchHandlerManager searchHandlerManager, FieldConfigSchemeManager fieldConfigSchemeManager, ApplicationLinkService entityLinkService ) throws ClassNotFoundException { ComponentClassManager ccm = ComponentAccessor.getComponentClassManager(); this.itemManager = ccm.newInstance("org.safmt.jira.items.util.impl.ConfigurationItemManagerImpl"); // this.itemManager = itemManager; this.fieldVisibilityManager = fieldVisibilityManager; this.jqlOperandResolver = jqlOperandResolver; this .customFieldInputHelper = customFieldInputHelper; this.customFieldManager = customFieldManager; this.searchHandlerManager = searchHandlerManager; this.fieldConfigSchemeManager = fieldConfigSchemeManager; }
Since I found a work-around--would you mind filling out the bug report with Atlassian?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Did you make it public? Consutructor injection is supported only for public components in JIRA I believe.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Yes I tried that too with no luck. I don't think it needs to be public though, its just if you want other plugins to be able to import your component. See documentation:
https://confluence.atlassian.com/display/JIRA043/Component+Plugin+Module#
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.