Re-index fails due to ClassCastException for Timestamp types

Platform Notice: Data Center Only - This article only applies to Atlassian products on the Data Center platform.

Note that this KB was created for the Data Center version of the product. Data Center KBs for non-Data-Center-specific features may also work for Server versions of the product, however they have not been tested. Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.

*Except Fisheye and Crucible

Symptoms

A JIRA administrator is unable to run a re-index due to ClassCastException. The following appears in the atlassian-jira.log:

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 java.lang.RuntimeException: java.util.concurrent.ExecutionException: java.lang.ClassCastException: java.sql.Timestamp cannot be cast to java.lang.String at com.atlassian.jira.index.FutureResult.await(FutureResult.java:35) at com.atlassian.jira.index.CompositeResultBuilder$CompositeResult.await(CompositeResultBuilder.java:82) at com.atlassian.jira.issue.index.DefaultIndexManager.reIndexAll(DefaultIndexManager.java:286) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at com.atlassian.util.profiling.object.ObjectProfiler.profiledInvoke(ObjectProfiler.java:81) at com.atlassian.jira.config.component.SwitchingInvocationHandler.invoke(SwitchingInvocationHandler.java:28) ... Caused by: java.lang.ClassCastException: java.sql.Timestamp cannot be cast to java.lang.String at com.atlassian.jira.issue.index.indexers.impl.ExactTextCustomFieldIndexer.addDocumentFields(ExactTextCustomFieldIndexer.java:45) at com.atlassian.jira.issue.index.indexers.impl.ExactTextCustomFieldIndexer.addDocumentFieldsSearchable(ExactTextCustomFieldIndexer.java:29) at com.atlassian.jira.issue.index.indexers.impl.AbstractCustomFieldIndexer.addIndex(AbstractCustomFieldIndexer.java:46) at com.atlassian.jira.issue.index.IssueDocument.getDocument(IssueDocument.java:40)

Environment

Jira Data Center on any version

Cause

The Search Template specified for custom fields using Date Time type is invalid. This could be caused by either a manual database manipulation or an improper upgrade.

Resolution

  1. Go to Administration >> Custom Fields

  2. Find the custom fields of Date Time type, edit them and select one of the available options at the Search Template drop-down.

  3. Repeat this process for each custom field using Date Time type.

Updated on April 8, 2025

Still need help?

The Atlassian Community is here for you.