Editing a Custom Field throws "cannot be cast to java.lang.String"

お困りですか?

アトラシアン コミュニティをご利用ください。

コミュニティに質問

症状

After ordering a search in the issue navigator by a custom field, or trying to edit the custom field configuration, JIRA throws the following error:

The following appears in the atlassian-jira.log:

java.lang.ClassCastException: com.atlassian.jira.issue.customfields.option.LazyLoadedOption cannot be cast to java.lang.String
	at com.atlassian.jira.issue.customfields.impl.SelectCFType.compare(SelectCFType.java:68)
	at com.atlassian.jira.issue.fields.CustomFieldImpl.compare(CustomFieldImpl.java:2015)
	at com.atlassian.jira.issue.fields.CustomFieldImpl$CustomFieldIssueSortComparator.compare(CustomFieldImpl.java:2103)
	at com.atlassian.jira.issue.search.parameters.lucene.sort.DefaultIssueSortComparator.compare(DefaultIssueSortComparator.java:37)
	at com.atlassian.jira.issue.search.parameters.lucene.sort.DocumentSortComparatorSource$InternalFieldComparator.compare(DocumentSortComparatorSource.java:72)
	at org.apache.lucene.search.FieldValueHitQueue$MultiComparatorsFieldValueHitQueue.lessThan(FieldValueHitQueue.java:125)
	at org.apache.lucene.search.FieldValueHitQueue$MultiComparatorsFieldValueHitQueue.lessThan(FieldValueHitQueue.java:100)
	at org.apache.lucene.util.PriorityQueue.upHeap(PriorityQueue.java:223)
	at org.apache.lucene.util.PriorityQueue.add(PriorityQueue.java:132)

原因

The "CUSTOMFIELDSEARCHERKEY" database column doesn't contain any values for this custom field.

ソリューション

  1. Create a new custom field in JIRA of the same custom field type
  2. Jira をシャットダウンします。
  3. Delete the content of <<JIRA_INSTALL>>/work
    (info) Run a backup from your database so we can restore it in case anything goes wrong!
  4. データベースで次のクエリを実行します。

    SELECT * FROM customfield WHERE cfname = 'cf';

    (info) Where 'cf' is the custom field name of the test custom field you've created. Copy the value from the "CUSTOMFIELDSEARCHERKEY" column (i.e: "com.atlassian.jira.plugin.system.customfieldtypes:multiselectsearcher".

  5. Identify the problematic custom field:

    SELECT * FROM customfield WHERE cfname = 'cfname';

    (info) Where 'cfname' is the custom field name of the custom field you are having problems with.

  6. Run the following query to update the problematic custom field;

    UPDATE customfield set customfieldsearcherkey = 'the_value' where id=xx;

    (info) Where 'the_value' is the CUSTOMFIELDSEARCHERKEY value you saved from the first query and 'xx' is the ID from the custom field retrieved in the previous query.

  7. Jira を起動します。
  8. Reindex JIRA

最終更新日: 2016 年 10 月 5 日

この内容はお役に立ちましたか?

はい
いいえ
この記事についてのフィードバックを送信する
Powered by Confluence and Scroll Viewport.