Re-index fail due to timestamp conversion issue
Platform Notice: Data Center - This article applies to Atlassian products on the Data Center platform.
Note that this knowledge base article was created for the Data Center version of the product. Data Center knowledge base articles 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
JIRA is using MySQL as database and while attempting to execute the re-index, this error is shown on the screen:
Also, the following appears in the atlassian-jira.log
:
2013-02-24 19:07:32,477 indexerPool-1-thread-5 WARN [index.indexers.impl.DefaultCustomFieldIndexer] An exception thrown getting the custom field value for indexing. Value for 'customfield_10173' (Server Type) not indexed.
com.atlassian.jira.exception.DataAccessException: org.ofbiz.core.entity.GenericEntityException: Error creating GenericValue (SQL Exception while getting value: (Cannot convert value '0000-00-00 00:00:00' from column 15 to TIMESTAMP.))
...
Cause
MySQL uses "zero dates" as special placeholder, but JDBC can not handle them by default.
Resolution
- Shutdown JIRA;
Add the 'zeroDateTimeBehavior=convertToNull' property to the JDBC url, either in datasource URL if using JNDI location or as an additional parameter to the JDBC url at the dbconfig.xml. The JDBC url will then look like this example:
jdbc:mysql://localhost:3306/jira?useUnicode=true&characterEncoding=UTF8&sessionVariables=storage_engine=InnoDB?zeroDateTimeBehavior=convertToNull
Restart JIRA;
- Manually trigger a re-index.