JIRA Upgrade Fails with Invalid Column Name Error
When upgrading JIRA to 5.x or greater using an in-place database upgrade, the upgrade process fails when it attempts to auto-export and the following appears in the web interface:
com.atlassian.core.AtlassianCoreException: Error exporting data: org.ofbiz.core.entity.GenericDataSourceException: SQL Exception while executing the following:SELECT ID, NAME, DESCRIPTION, mailfrom, PREFIX, smtp_port, protocol, server_type, SERVERNAME, JNDILOCATION, mailusername, mailpassword, ISTLSREQUIRED, TIMEOUT, socks_port, socks_host FROM mailserver (Invalid column name 'socks_port'.)
The following is found within the
2012-08-13 14:27:50,366 main ERROR [atlassian.jira.upgrade.UpgradeManagerImpl] Exception thrown during upgrade: org.ofbiz.core.entity.GenericDataSourceException: SQL Exception while executing the following:SELECT pkey, PROJECT, REPORTER, ASSIGNEE, issuetype, SUMMARY, DESCRIPTION, ENVIRONMENT, PRIORITY, RESOLUTION, issuestatus, CREATED, UPDATED, DUEDATE, RESOLUTIONDATE, VOTES, WATCHES, TIMEORIGINALESTIMATE, TIMEESTIMATE, TIMESPENT, WORKFLOW_ID, SECURITY, FIXFOR, COMPONENT FROM jiraissue WHERE ID=? (Unknown column 'WATCHES' in 'field list')
This currently has three known causes:
- The auto-export has failed as the export functionality is expecting new columns to exist in the DB that do not exist yet. This is a known bug tracked under - JRA-28526Getting issue details... STATUS and has been fixed in 5.1.7.
- As in our KB, JIRA User Does Not Have Permission to Access the Database. If certain permissions are not provided, the upgrade tasks will fail and the above symptoms will be present.
- The upgrade was attempted to be performed with an incorrectly configured
dbconfig.xml, for example MySQL has a schema when it should not as per our JIRA throws table already exist error due to incorrect MySQL Schema KB article.
- Stop JIRA.
- Backup JIRA using the native DB tools.
- Check that the
$JIRA_HOME/dbconfig.xmlhas the correct schema, as in Connecting JIRA to a Database. If it does not, enter it as detailed in the documentation for the database that JIRA instance is using.
- Check if the database user has the necessary permission on the JIRA database, specifically the
alterpermissions as in the Connecting JIRA to a Database documentation.
- Disable auto-export as in our Disabling Auto-Export documentation.
- Start JIRA and verify the instance is able to complete the upgrade tasks successfully.
- Follow the resolution in our JIRA User Does Not Have Permission to Access the Database KB.
- Follow the resolution as per our JIRA throws table already exist error due to incorrect MySQL Schema KB.