Re-Index results in ClassCastException
症状
While running the re-index process, it stop abruptly with a stacktrace.
The following appears in your web browser:
java.util.concurrent.ExecutionException: java.lang.ClassCastException: java.sql.Timestamp cannot be cast to java.lang.String
Task completed in 3 seconds with unexpected error.
Started Today 15:47.
Finished Today 15:47.
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)
at $Proxy158.reIndexAll(Unknown Source)
at com.atlassian.jira.util.index.CompositeIndexLifecycleManager.reIndexAll(CompositeIndexLifecycleManager.java:49)
at com.atlassian.jira.web.action.admin.index.ReIndexAsyncIndexerCommand.doReindex(ReIndexAsyncIndexerCommand.java:27)
at com.atlassian.jira.web.action.admin.index.AbstractAsyncIndexerCommand.call(AbstractAsyncIndexerCommand.java:54)
at com.atlassian.jira.web.action.admin.index.AbstractAsyncIndexerCommand.call(AbstractAsyncIndexerCommand.java:23)
at com.atlassian.jira.task.TaskManagerImpl$TaskCallableDecorator.call(TaskManagerImpl.java:359)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at com.atlassian.multitenant.impl.DefaultMultiTenantManager.runForTenant(DefaultMultiTenantManager.java:61)
at com.atlassian.multitenant.juc.MultiTenantExecutors$WrappedRunnable.run(MultiTenantExecutors.java:160)
at com.atlassian.jira.task.ForkedThreadExecutor$ForkedRunnableDecorator.run(ForkedThreadExecutor.java:249)
at java.lang.Thread.run(Thread.java:662)
Caused by: java.util.concurrent.ExecutionException: java.lang.ClassCastException: java.sql.Timestamp cannot be cast to java.lang.String
at java.util.concurrent.FutureTask$Sync.innerGet(FutureTask.java:222)
at java.util.concurrent.FutureTask.get(FutureTask.java:83)
at com.atlassian.jira.index.FutureResult.await(FutureResult.java:31)
... 23 more
Caused by: java.lang.ClassCastException: java.sql.Timestamp cannot be cast to java.lang.String
at com.atlassian.jira.issue.index.indexers.impl.SortableTextCustomFieldIndexer.addDocumentFields(SortableTextCustomFieldIndexer.java:44)
at com.atlassian.jira.issue.index.indexers.impl.SortableTextCustomFieldIndexer.addDocumentFieldsSearchable(SortableTextCustomFieldIndexer.java:31)
at com.atlassian.jira.issue.index.indexers.impl.AbstractCustomFieldIndexer.addIndex(AbstractCustomFieldIndexer.java:46)
at com.atlassian.jira.issue.index.IssueDocument.getDocument(IssueDocument.java:40)
at com.atlassian.jira.issue.index.DefaultIssueDocumentFactory.get(DefaultIssueDocumentFactory.java:15)
at com.atlassian.jira.issue.index.DefaultIssueDocumentFactory.get(DefaultIssueDocumentFactory.java:11)
at com.atlassian.jira.issue.index.DefaultIssueIndexer$IssueLockDocumentCreationStrategy$2.get(DefaultIssueIndexer.java:519)
at com.atlassian.jira.issue.index.DefaultIssueIndexer$IssueLockDocumentCreationStrategy$2.get(DefaultIssueIndexer.java:516)
at com.atlassian.util.concurrent.ManagedLocks$ManagedLockImpl.withLock(ManagedLocks.java:315)
at com.atlassian.jira.issue.index.DefaultIssueIndexer$IssueLockDocumentCreationStrategy.get(DefaultIssueIndexer.java:515)
at com.atlassian.jira.issue.index.DefaultIssueIndexer$IssueLockDocumentCreationStrategy.get(DefaultIssueIndexer.java:503)
at com.atlassian.jira.issue.index.DefaultIssueIndexer$IndexIssuesOperation.perform(DefaultIssueIndexer.java:374)
at com.atlassian.jira.issue.index.DefaultIssueIndexer$4$1.get(DefaultIssueIndexer.java:258)
at com.atlassian.jira.issue.index.DefaultIssueIndexer$4$1.get(DefaultIssueIndexer.java:254)
at com.atlassian.jira.index.SimpleIndexingStrategy.get(SimpleIndexingStrategy.java:9)
at com.atlassian.jira.index.SimpleIndexingStrategy.get(SimpleIndexingStrategy.java:5)
at com.atlassian.jira.index.MultiThreadedIndexingStrategy$1.call(MultiThreadedIndexingStrategy.java:39)
at com.atlassian.jira.index.MultiThreadedIndexingStrategy$1.call(MultiThreadedIndexingStrategy.java:36)
at com.atlassian.jira.util.concurrent.BoundedExecutor$2.call(BoundedExecutor.java:70)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at com.atlassian.multitenant.impl.DefaultMultiTenantManager.runForTenant(DefaultMultiTenantManager.java:61)
at com.atlassian.multitenant.juc.MultiTenantExecutors$WrappedRunnable.run(MultiTenantExecutors.java:160)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
... 1 more
診断
Your instance may have been recently upgraded or have installed a third-party plugin
原因
Java is expecting a custom field value that is a string type, but instead got a date timestamp.
ソリューション
Remove the values with the wrong data type
- Locate the problematic values:
Run this SQL query:
select * from customfieldvalue where datevalue is not null and customfield in (select id from customfield where customfieldsearcherkey not like '%date%'); id | issue | customfield | parentkey | stringvalue | numbervalue | textvalue | datevalue | valuetype -------+-------+-------------+-----------+-------------+-------------+-----------+------------------------+----------- 12303 | 11935 | 11403 | | | | | 2013-02-23 12:57:00-08 | 12320 | 12639 | 11403 | | | | | 2013-03-04 21:48:00-08 | 12380 | 13640 | 11403 | | | | | 2013-03-04 23:36:00-08 | (3 rows)
- This returns custom field values that are stored as date timestamp, but the associated custom fields are not date fields.
To confirm that the custom field is not a date type:
select id,customfieldsearcherkey from customfield where id = 11403; id | customfieldsearcherkey -------+------------------------------------------------------------------------------------------- 11403 | com.atlassian.jira.plugin.system.customfieldtypes:textsearcher
Delete the invalid entries fromt he customfieldvalue table
Backup your database before attempting to make any changes
最終更新日 2018 年 11 月 12 日
Powered by Confluence and Scroll Viewport.