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

Issue when creating custom field type in Jira 7

Daniel Aguilar November 12, 2015

Hello, 

I'm trying to follow the custom field type tutorial: https://developer.atlassian.com/jiradev/jira-platform/guides/fields/tutorial-creating-a-custom-field-type

I have found that there are some discrepancies between the process detailde in the tutorial and the actual process, one of them being the reference to a com.atlassian.jira.plugin.customfield.example package, whereas the sdk creates com.atlassian.jira.plugin.customfield.example.api and com.atlassian.jira.plugin.customfield.example.impl packages.

Anyway, I'm sticking to the steps described in the tutorial, but when I cannot see my custom field type anywhere on my local JIRA instance. 

The command line window keeps throwing these errors:

 

[INFO] [talledLocalContainer] com.atlassian.util.concurrent.LazyReference$InitializationException: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'com.atlassian.jira.plugin.customfield.example.JiraCustomField': Unsatisfied dependency expressed through constructor argument with index 0 of type [com.atlassian.jira.issue.customfields.persistence.CustomFieldValuePersister]: : No qualifying bean of type [com.atlassian.jira.issue.customfields.persistence.CustomFieldValuePersister] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {}; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [com.atlassian.jira.issue.customfields.persistence.CustomFieldValuePersister] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {}

which I can't seem to be able to fix adding  

<component-import key="customFieldValuePersister" interface="com.atlassian.jira.issue.customfields.persistence.CustomFieldValuePersister"/>

to my atlassian-plugin.xml, as descriibed here: https://developer.atlassian.com/docs/faq/troubleshooting/unsatisfieddependencyexception-error-creating-bean-with-name

I'd appreciate any help on the subject.

 

Regards,

9 answers

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

16 votes
Answer accepted
Ahmed_A_ March 30, 2016

There's something strange - to me - going on with spring scanner 1.2.6 with the JIRA 7.X series. From spring scanner's documentation, I see that they are upgrading to version 2.0 to use with JIRA 7.2.

At any rate, here is what to do: do not rely on constructor based injection. I don't know why. Instead, use property injection. So for example, adapt the custom field tutorial to be as follows (updated code to remove deprecation warnings):

import com.atlassian.plugin.spring.scanner.annotation.component.Scanned;
import com.atlassian.plugin.spring.scanner.annotation.imports.ComponentImport;


@Scanned
public class IntegerCFType extends GenericTextCFType
{
	private static final Logger log = LoggerFactory.getLogger(IntegerCFType.class);

    @ComponentImport private final CustomFieldValuePersister customFieldValuePersister;
    @ComponentImport private final GenericConfigManager genericConfigManager;
    @ComponentImport private final TextFieldCharacterLengthValidator textFieldCharacterLengthValidator;
    @ComponentImport private final JiraAuthenticationContext jiraAuthenticationContext;


	public IntegerCFType(CustomFieldValuePersister customFieldValuePersister, GenericConfigManager genericConfigManager,
		TextFieldCharacterLengthValidator textFieldCharacterLengthValidator, JiraAuthenticationContext jiraAuthenticationContext)
	{
		super(customFieldValuePersister, genericConfigManager, textFieldCharacterLengthValidator, jiraAuthenticationContext);
		this.customFieldValuePersister = customFieldValuePersister;
		this.genericConfigManager = genericConfigManager;
		this.textFieldCharacterLengthValidator = textFieldCharacterLengthValidator;
		this.jiraAuthenticationContext = jiraAuthenticationContext;
	}

You should not need to add anything to atlassian-plugin.xml with this approach; we are using annotations instead.

Ma Hao June 11, 2016

The declaration should not be removed from atlassian-plugin.xml. 

Otherwise JIRA will not recognize your custom field type.

chaitanya prabhu July 6, 2016

This worked. Thank you so much. And, we still need the customfield-type entry in atlassian-plugin.xml as well

Todd DeCosta August 31, 2016

Figured it out using your snippet. Works! Thanks. 

Yanduganov Andrey August 1, 2017

Great! I tried to resolve this trouble for many days and I've read many answers, but only this solution helps me. Thanks!

Oleksii Skachkov August 7, 2019

That helped. thank

1 vote
Stefan Glase September 18, 2018

Please refer to this document that explains necessary changes coming with version 2.0.0 of atlassian-spring-scanner:

 

https://bitbucket.org/atlassian/atlassian-spring-scanner

0 votes
chaitanya prabhu July 6, 2016

I am still facing the same issue and none of the workarounds mentioned in Atlassian documentation seem to work. Any proper solution to this or will it be fixed going ahead?

0 votes
DonC83 December 29, 2015

Anyone find any solution to this? Have the same issue, it can't find a implementation class to create the bean.

0 votes
Miguel Angel Hernández December 2, 2015

Try to remove spring-scanner dependencies from your pom.xml.

It worked for me....

Ahmed_A_ March 30, 2016

Did not work for me.

0 votes
Angela Beteta November 30, 2015

Hi, I'm having the same issue. CustomFieldValuePersisted is imported as a component-import in the atlassian-plugin.xml. It doesn't work for me with sdk v5.0.13 neither with 6.1.0. Any advise?

0 votes
Ritchie Gu November 29, 2015

Hi there, i'm having the same issue, not sure how can I fix it. Any idea?

0 votes
Daniel Boulger November 25, 2015

I ended up just using a previous version of the SDK (5.0.13) and it worked. https://marketplace.atlassian.com/plugins/atlassian-plugin-sdk-windows/versions

0 votes
Doug Poplin November 25, 2015

I'm running into the same situation. Were you able to resolve this? -Thanks,

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

TAGS
AUG Leaders

Atlassian Community Events