com.atlassian.cache.CacheException: com.atlassian.cache.CacheException: com.atlassian.jira.exception.DataAccessException: org.ofbiz.core.entity.GenericDataSourceException: SQL Exception while executing the following:SELECT KEY, CUSTOMFIELDTYPEKEY, CUSTOMFIELDSEARCHERKEY, cfname, DESCRIPTION, defaultvalue, FIELDTYPE, PROJECT, ISSUETYPE FROM customfield WHERE ID=? (You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'KEY, CUSTOMFIELDTYPEKEY, CUSTOMFIELDSEARCHERKEY, cfname, DESCRIPTION, defaultval' at line 1)

Atlassian JIRA | Mogavenasan Muthusamy [Atlassian] | 8 months ago
  1. 0

    h3. Summary Upgrading to JIRA 7.1.5 breaks because the ALTER SQL on customfield table has an incorrect syntax. h3. Environment * JIRA 7.1.5 * MSSQL and MySQL database h3. Steps to Reproduce Upgrade JIRA 7.1.4 to JIRA 7.1.5. h3. Expected Results Upgrade suppose to finish successfully. h3. Actual Results The below exception is thrown in the atlassian-jira.log file: * For MS SQL: {noformat} 2016-04-21 21:03:13,804 JIRA-Bootstrap WARN [o.o.c.entity.jdbc.DatabaseUtil] Entity "CustomField" has 10 fields but table "dbo.customfield" has 9 columns. 2016-04-21 21:03:13,804 JIRA-Bootstrap WARN [o.o.c.entity.jdbc.DatabaseUtil] Field "key" of entity "CustomField" is missing its corresponding column "KEY" 2016-04-21 21:03:14,491 JIRA-Bootstrap ERROR [o.o.c.entity.jdbc.DatabaseUtil] Could not add column "KEY" to table "dbo.customfield" 2016-04-21 21:03:14,491 JIRA-Bootstrap ERROR [o.o.c.entity.jdbc.DatabaseUtil] SQL Exception while executing the following: ALTER TABLE dbo.customfield ADD KEY NVARCHAR(255) Error was: java.sql.SQLException: Incorrect syntax near the keyword 'KEY'. {noformat} Following by: {noformat} 2016-04-21 21:04:47,736 JIRA-Bootstrap ERROR [c.a.jira.startup.IndexRecoveryLauncher] Automatic index recovery failed com.atlassian.cache.CacheException: com.atlassian.cache.CacheException: com.atlassian.jira.exception.DataAccessException: org.ofbiz.core.entity.GenericDataSourceException: SQL Exception while executing the following:SELECT KEY, CUSTOMFIELDTYPEKEY, CUSTOMFIELDSEARCHERKEY, cfname, DESCRIPTION, defaultvalue, FIELDTYPE, PROJECT, ISSUETYPE FROM dbo.customfield WHERE ID=? (Incorrect syntax near the keyword 'KEY'.) at com.atlassian.cache.memory.DelegatingCachedReference.get(DelegatingCachedReference.java:84) at com.atlassian.jira.issue.search.managers.DefaultSearchHandlerManager.getHelper(DefaultSearchHandlerManager.java:254) at com.atlassian.jira.issue.search.managers.DefaultSearchHandlerManager.getFieldIds(DefaultSearchHandlerManager.java:197) at com.atlassian.jira.issue.search.providers.LuceneSearchProvider.getSearchSorts(LuceneSearchProvider.java:435) at com.atlassian.jira.issue.search.providers.LuceneSearchProvider.search(LuceneSearchProvider.java:279) at com.atlassian.jira.issue.search.providers.LuceneSearchProvider.searchOverrideSecurity(LuceneSearchProvider.java:95) at com.atlassian.jira.issue.search.providers.DualSearchProvider.lambda$searchOverrideSecurity$2(DualSearchProvider.java:88) at com.atlassian.jira.issue.search.providers.DualSearchProvider.performSearch(DualSearchProvider.java:140) at com.atlassian.jira.issue.search.providers.DualSearchProvider.searchOverrideSecurity(DualSearchProvider.java:88) at com.atlassian.jira.index.ha.DefaultIndexRecoveryManager.getLatestIndexDate(DefaultIndexRecoveryManager.java:261) at com.atlassian.jira.index.ha.DefaultIndexRecoveryManager.getDurationToRecover(DefaultIndexRecoveryManager.java:244) at com.atlassian.jira.startup.IndexRecoveryLauncher.start(IndexRecoveryLauncher.java:45) at com.atlassian.jira.startup.DefaultJiraLauncher.lambda$postTenantArrived$4(DefaultJiraLauncher.java:183) at com.atlassian.jira.startup.DefaultInstantUpgradeManager$StatupTask.run(DefaultInstantUpgradeManager.java:113) at com.atlassian.jira.startup.DefaultInstantUpgradeManager.runTask(DefaultInstantUpgradeManager.java:46) at com.atlassian.jira.startup.DefaultInstantUpgradeManager.doNowOrWhenInstanceBecomesActive(DefaultInstantUpgradeManager.java:35) at com.atlassian.jira.startup.DefaultJiraLauncher.postTenantArrived(DefaultJiraLauncher.java:173) at com.atlassian.jira.startup.DefaultJiraLauncher.lambda$postDBActivated$3(DefaultJiraLauncher.java:161) at com.atlassian.jira.tenancy.DefaultTenantManager.doNowOrWhenTenantArrives(DefaultTenantManager.java:55) at com.atlassian.jira.startup.DefaultJiraLauncher.postDBActivated(DefaultJiraLauncher.java:158) at com.atlassian.jira.startup.DefaultJiraLauncher.lambda$postDbLaunch$2(DefaultJiraLauncher.java:147) at com.atlassian.jira.config.database.DatabaseConfigurationManagerImpl.doNowOrEnqueue(DatabaseConfigurationManagerImpl.java:298) at com.atlassian.jira.config.database.DatabaseConfigurationManagerImpl.doNowOrWhenDatabaseActivated(DatabaseConfigurationManagerImpl.java:194) at com.atlassian.jira.startup.DefaultJiraLauncher.postDbLaunch(DefaultJiraLauncher.java:137) at com.atlassian.jira.startup.DefaultJiraLauncher.lambda$start$0(DefaultJiraLauncher.java:103) at com.atlassian.jira.util.devspeed.JiraDevSpeedTimer.run(JiraDevSpeedTimer.java:31) at com.atlassian.jira.startup.DefaultJiraLauncher.start(DefaultJiraLauncher.java:101) at com.atlassian.jira.startup.LauncherContextListener.initSlowStuff(LauncherContextListener.java:115) at java.lang.Thread.run(Unknown Source) Caused by: com.atlassian.cache.CacheException: com.atlassian.jira.exception.DataAccessException: org.ofbiz.core.entity.GenericDataSourceException: SQL Exception while executing the following:SELECT KEY, CUSTOMFIELDTYPEKEY, CUSTOMFIELDSEARCHERKEY, cfname, DESCRIPTION, defaultvalue, FIELDTYPE, PROJECT, ISSUETYPE FROM dbo.customfield WHERE ID=? (Incorrect syntax near the keyword 'KEY'.) at com.atlassian.cache.memory.DelegatingCache.get(DelegatingCache.java:207) at com.atlassian.cache.memory.DelegatingCache.get(DelegatingCache.java:158) at com.atlassian.jira.issue.managers.DefaultCustomFieldManager.getCustomFieldsFromIds(DefaultCustomFieldManager.java:412) at com.atlassian.jira.issue.managers.DefaultCustomFieldManager.getCustomFieldObjects(DefaultCustomFieldManager.java:402) at com.atlassian.jira.issue.search.managers.DefaultSearchHandlerManager.createHelper(DefaultSearchHandlerManager.java:276) at com.atlassian.jira.issue.search.managers.DefaultSearchHandlerManager$1.get(DefaultSearchHandlerManager.java:102) at com.atlassian.jira.issue.search.managers.DefaultSearchHandlerManager$1.get(DefaultSearchHandlerManager.java:99) at com.atlassian.cache.memory.MemoryCacheManager$1$1.load(MemoryCacheManager.java:93) at com.atlassian.cache.memory.MemoryCacheManager$1$1.load(MemoryCacheManager.java:69) at com.google.common.cache.LocalCache$LoadingValueReference.loadFuture(LocalCache.java:3527) at com.google.common.cache.LocalCache$Segment.loadSync(LocalCache.java:2319) at com.google.common.cache.LocalCache$Segment.lockedGetOrLoad(LocalCache.java:2282) at com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2197) at com.google.common.cache.LocalCache.get(LocalCache.java:3937) at com.google.common.cache.LocalCache.getOrLoad(LocalCache.java:3941) at com.google.common.cache.LocalCache$LocalLoadingCache.get(LocalCache.java:4824) at com.google.common.cache.LocalCache$LocalLoadingCache.getUnchecked(LocalCache.java:4830) at com.atlassian.cache.memory.DelegatingCachedReference.getUnderLock(DelegatingCachedReference.java:94) at com.atlassian.cache.memory.DelegatingCachedReference.get(DelegatingCachedReference.java:79) ... 28 more Caused by: com.atlassian.jira.exception.DataAccessException: org.ofbiz.core.entity.GenericDataSourceException: SQL Exception while executing the following:SELECT KEY, CUSTOMFIELDTYPEKEY, CUSTOMFIELDSEARCHERKEY, cfname, DESCRIPTION, defaultvalue, FIELDTYPE, PROJECT, ISSUETYPE FROM dbo.customfield WHERE ID=? (Incorrect syntax near the keyword 'KEY'.) at com.atlassian.jira.ofbiz.DefaultOfBizDelegator.findByPrimaryKey(DefaultOfBizDelegator.java:341) at com.atlassian.jira.ofbiz.DefaultOfBizDelegator.findByPrimaryKey(DefaultOfBizDelegator.java:333) at com.atlassian.jira.ofbiz.DefaultOfBizDelegator.findById(DefaultOfBizDelegator.java:325) at com.atlassian.jira.ofbiz.WrappingOfBizDelegator.findById(WrappingOfBizDelegator.java:192) at com.atlassian.jira.issue.managers.DefaultCustomFieldManager$CustomFieldByIdCacheLoader.load(DefaultCustomFieldManager.java:154) at com.atlassian.cache.memory.MemoryCacheManager$3$1.load(MemoryCacheManager.java:162) at com.atlassian.cache.memory.DelegatingCache.lambda$get$0(DelegatingCache.java:158) at com.atlassian.cache.memory.DelegatingCache.lambda$get$1(DelegatingCache.java:186) at com.google.common.cache.LocalCache$LocalManualCache$1.load(LocalCache.java:4742) at com.google.common.cache.LocalCache$LoadingValueReference.loadFuture(LocalCache.java:3527) at com.google.common.cache.LocalCache$Segment.loadSync(LocalCache.java:2319) at com.google.common.cache.LocalCache$Segment.lockedGetOrLoad(LocalCache.java:2282) at com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2197) at com.google.common.cache.LocalCache.get(LocalCache.java:3937) at com.google.common.cache.LocalCache$LocalManualCache.get(LocalCache.java:4739) at com.atlassian.cache.memory.DelegatingCache.get(DelegatingCache.java:173) ... 47 more Caused by: org.ofbiz.core.entity.GenericDataSourceException: SQL Exception while executing the following:SELECT KEY, CUSTOMFIELDTYPEKEY, CUSTOMFIELDSEARCHERKEY, cfname, DESCRIPTION, defaultvalue, FIELDTYPE, PROJECT, ISSUETYPE FROM dbo.customfield WHERE ID=? (Incorrect syntax near the keyword 'KEY'.) at org.ofbiz.core.entity.jdbc.SQLProcessor.executeQuery(SQLProcessor.java:641) at org.ofbiz.core.entity.GenericDAO.select(GenericDAO.java:623) at org.ofbiz.core.entity.GenericDAO.select(GenericDAO.java:592) at org.ofbiz.core.entity.GenericHelperDAO.findByPrimaryKey(GenericHelperDAO.java:97) at org.ofbiz.core.entity.GenericDelegator.findByPrimaryKey(GenericDelegator.java:611) at com.atlassian.jira.ofbiz.DefaultOfBizDelegator.findByPrimaryKey(DefaultOfBizDelegator.java:339) ... 63 more Caused by: java.sql.SQLException: Incorrect syntax near the keyword 'KEY'. at net.sourceforge.jtds.jdbc.SQLDiagnostic.addDiagnostic(SQLDiagnostic.java:372) at net.sourceforge.jtds.jdbc.TdsCore.tdsErrorToken(TdsCore.java:2988) at net.sourceforge.jtds.jdbc.TdsCore.nextToken(TdsCore.java:2421) at net.sourceforge.jtds.jdbc.TdsCore.getMoreResults(TdsCore.java:671) at net.sourceforge.jtds.jdbc.JtdsStatement.executeSQLQuery(JtdsStatement.java:505) at org.apache.commons.dbcp2.DelegatingPreparedStatement.executeQuery(DelegatingPreparedStatement.java:83) at org.apache.commons.dbcp2.DelegatingPreparedStatement.executeQuery(DelegatingPreparedStatement.java:83) at org.ofbiz.core.entity.jdbc.SQLProcessor.executeQuery(SQLProcessor.java:633) ... 69 more {noformat} * For MySQL: {noformat} 2016-04-21 19:30:38,959 JIRA-Bootstrap WARN [o.o.c.entity.jdbc.DatabaseUtil] Entity "CustomField" has 10 fields but table "customfield" has 9 columns. 2016-04-21 19:30:38,959 JIRA-Bootstrap WARN [o.o.c.entity.jdbc.DatabaseUtil] Field "key" of entity "CustomField" is missing its corresponding column "KEY" 2016-04-21 19:30:38,962 JIRA-Bootstrap ERROR [o.o.c.entity.jdbc.DatabaseUtil] Could not add column "KEY" to table "customfield" 2016-04-21 19:30:38,962 JIRA-Bootstrap ERROR [o.o.c.entity.jdbc.DatabaseUtil] SQL Exception while executing the following: ALTER TABLE customfield ADD KEY VARCHAR(255) Error was: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'VARCHAR(255)' at line 1 {noformat} Following by: {noformat} 2016-04-21 19:31:35,175 JIRA-Bootstrap ERROR [c.a.jira.startup.IndexRecoveryLauncher] Automatic index recovery failed com.atlassian.cache.CacheException: com.atlassian.cache.CacheException: com.atlassian.jira.exception.DataAccessException: org.ofbiz.core.entity.GenericDataSourceException: SQL Exception while executing the following:SELECT KEY, CUSTOMFIELDTYPEKEY, CUSTOMFIELDSEARCHERKEY, cfname, DESCRIPTION, defaultvalue, FIELDTYPE, PROJECT, ISSUETYPE FROM customfield WHERE ID=? (You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'KEY, CUSTOMFIELDTYPEKEY, CUSTOMFIELDSEARCHERKEY, cfname, DESCRIPTION, defaultval' at line 1) at com.atlassian.cache.memory.DelegatingCachedReference.get(DelegatingCachedReference.java:84) at com.atlassian.jira.issue.search.managers.DefaultSearchHandlerManager.getHelper(DefaultSearchHandlerManager.java:254) at com.atlassian.jira.issue.search.managers.DefaultSearchHandlerManager.getFieldIds(DefaultSearchHandlerManager.java:197) at com.atlassian.jira.issue.search.providers.LuceneSearchProvider.getSearchSorts(LuceneSearchProvider.java:435) at com.atlassian.jira.issue.search.providers.LuceneSearchProvider.search(LuceneSearchProvider.java:279) at com.atlassian.jira.issue.search.providers.LuceneSearchProvider.searchOverrideSecurity(LuceneSearchProvider.java:95) at com.atlassian.jira.issue.search.providers.DualSearchProvider.lambda$searchOverrideSecurity$2(DualSearchProvider.java:88) at com.atlassian.jira.issue.search.providers.DualSearchProvider.performSearch(DualSearchProvider.java:140) at com.atlassian.jira.issue.search.providers.DualSearchProvider.searchOverrideSecurity(DualSearchProvider.java:88) at com.atlassian.jira.index.ha.DefaultIndexRecoveryManager.getLatestIndexDate(DefaultIndexRecoveryManager.java:261) at com.atlassian.jira.index.ha.DefaultIndexRecoveryManager.getDurationToRecover(DefaultIndexRecoveryManager.java:244) at com.atlassian.jira.startup.IndexRecoveryLauncher.start(IndexRecoveryLauncher.java:45) at com.atlassian.jira.startup.DefaultJiraLauncher.lambda$postTenantArrived$4(DefaultJiraLauncher.java:183) at com.atlassian.jira.startup.DefaultInstantUpgradeManager$StatupTask.run(DefaultInstantUpgradeManager.java:113) at com.atlassian.jira.startup.DefaultInstantUpgradeManager.runTask(DefaultInstantUpgradeManager.java:46) at com.atlassian.jira.startup.DefaultInstantUpgradeManager.doNowOrWhenInstanceBecomesActive(DefaultInstantUpgradeManager.java:35) at com.atlassian.jira.startup.DefaultJiraLauncher.postTenantArrived(DefaultJiraLauncher.java:173) at com.atlassian.jira.startup.DefaultJiraLauncher.lambda$postDBActivated$3(DefaultJiraLauncher.java:161) at com.atlassian.jira.tenancy.DefaultTenantManager.doNowOrWhenTenantArrives(DefaultTenantManager.java:55) at com.atlassian.jira.startup.DefaultJiraLauncher.postDBActivated(DefaultJiraLauncher.java:158) at com.atlassian.jira.startup.DefaultJiraLauncher.lambda$postDbLaunch$2(DefaultJiraLauncher.java:147) at com.atlassian.jira.config.database.DatabaseConfigurationManagerImpl.doNowOrEnqueue(DatabaseConfigurationManagerImpl.java:298) at com.atlassian.jira.config.database.DatabaseConfigurationManagerImpl.doNowOrWhenDatabaseActivated(DatabaseConfigurationManagerImpl.java:194) at com.atlassian.jira.startup.DefaultJiraLauncher.postDbLaunch(DefaultJiraLauncher.java:137) at com.atlassian.jira.startup.DefaultJiraLauncher.lambda$start$0(DefaultJiraLauncher.java:103) at com.atlassian.jira.util.devspeed.JiraDevSpeedTimer.run(JiraDevSpeedTimer.java:31) at com.atlassian.jira.startup.DefaultJiraLauncher.start(DefaultJiraLauncher.java:101) at com.atlassian.jira.startup.LauncherContextListener.initSlowStuff(LauncherContextListener.java:115) at java.lang.Thread.run(Thread.java:745) Caused by: com.atlassian.cache.CacheException: com.atlassian.jira.exception.DataAccessException: org.ofbiz.core.entity.GenericDataSourceException: SQL Exception while executing the following:SELECT KEY, CUSTOMFIELDTYPEKEY, CUSTOMFIELDSEARCHERKEY, cfname, DESCRIPTION, defaultvalue, FIELDTYPE, PROJECT, ISSUETYPE FROM customfield WHERE ID=? (You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'KEY, CUSTOMFIELDTYPEKEY, CUSTOMFIELDSEARCHERKEY, cfname, DESCRIPTION, defaultval' at line 1) at com.atlassian.cache.memory.DelegatingCache.get(DelegatingCache.java:207) at com.atlassian.cache.memory.DelegatingCache.get(DelegatingCache.java:158) at com.atlassian.jira.issue.managers.DefaultCustomFieldManager.getCustomFieldsFromIds(DefaultCustomFieldManager.java:412) at com.atlassian.jira.issue.managers.DefaultCustomFieldManager.getCustomFieldObjects(DefaultCustomFieldManager.java:402) at com.atlassian.jira.issue.search.managers.DefaultSearchHandlerManager.createHelper(DefaultSearchHandlerManager.java:276) at com.atlassian.jira.issue.search.managers.DefaultSearchHandlerManager$1.get(DefaultSearchHandlerManager.java:102) at com.atlassian.jira.issue.search.managers.DefaultSearchHandlerManager$1.get(DefaultSearchHandlerManager.java:99) at com.atlassian.cache.memory.MemoryCacheManager$1$1.load(MemoryCacheManager.java:93) at com.atlassian.cache.memory.MemoryCacheManager$1$1.load(MemoryCacheManager.java:69) at com.google.common.cache.LocalCache$LoadingValueReference.loadFuture(LocalCache.java:3527) at com.google.common.cache.LocalCache$Segment.loadSync(LocalCache.java:2319) at com.google.common.cache.LocalCache$Segment.lockedGetOrLoad(LocalCache.java:2282) at com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2197) at com.google.common.cache.LocalCache.get(LocalCache.java:3937) at com.google.common.cache.LocalCache.getOrLoad(LocalCache.java:3941) at com.google.common.cache.LocalCache$LocalLoadingCache.get(LocalCache.java:4824) at com.google.common.cache.LocalCache$LocalLoadingCache.getUnchecked(LocalCache.java:4830) at com.atlassian.cache.memory.DelegatingCachedReference.getUnderLock(DelegatingCachedReference.java:94) at com.atlassian.cache.memory.DelegatingCachedReference.get(DelegatingCachedReference.java:79) ... 28 more Caused by: com.atlassian.jira.exception.DataAccessException: org.ofbiz.core.entity.GenericDataSourceException: SQL Exception while executing the following:SELECT KEY, CUSTOMFIELDTYPEKEY, CUSTOMFIELDSEARCHERKEY, cfname, DESCRIPTION, defaultvalue, FIELDTYPE, PROJECT, ISSUETYPE FROM customfield WHERE ID=? (You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'KEY, CUSTOMFIELDTYPEKEY, CUSTOMFIELDSEARCHERKEY, cfname, DESCRIPTION, defaultval' at line 1) at com.atlassian.jira.ofbiz.DefaultOfBizDelegator.findByPrimaryKey(DefaultOfBizDelegator.java:341) at com.atlassian.jira.ofbiz.DefaultOfBizDelegator.findByPrimaryKey(DefaultOfBizDelegator.java:333) at com.atlassian.jira.ofbiz.DefaultOfBizDelegator.findById(DefaultOfBizDelegator.java:325) at com.atlassian.jira.ofbiz.WrappingOfBizDelegator.findById(WrappingOfBizDelegator.java:192) at com.atlassian.jira.issue.managers.DefaultCustomFieldManager$CustomFieldByIdCacheLoader.load(DefaultCustomFieldManager.java:154) at com.atlassian.cache.memory.MemoryCacheManager$3$1.load(MemoryCacheManager.java:162) at com.atlassian.cache.memory.DelegatingCache.lambda$get$0(DelegatingCache.java:158) at com.atlassian.cache.memory.DelegatingCache.lambda$get$1(DelegatingCache.java:186) at com.google.common.cache.LocalCache$LocalManualCache$1.load(LocalCache.java:4742) at com.google.common.cache.LocalCache$LoadingValueReference.loadFuture(LocalCache.java:3527) at com.google.common.cache.LocalCache$Segment.loadSync(LocalCache.java:2319) at com.google.common.cache.LocalCache$Segment.lockedGetOrLoad(LocalCache.java:2282) at com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2197) at com.google.common.cache.LocalCache.get(LocalCache.java:3937) at com.google.common.cache.LocalCache$LocalManualCache.get(LocalCache.java:4739) at com.atlassian.cache.memory.DelegatingCache.get(DelegatingCache.java:173) ... 47 more Caused by: org.ofbiz.core.entity.GenericDataSourceException: SQL Exception while executing the following:SELECT KEY, CUSTOMFIELDTYPEKEY, CUSTOMFIELDSEARCHERKEY, cfname, DESCRIPTION, defaultvalue, FIELDTYPE, PROJECT, ISSUETYPE FROM customfield WHERE ID=? (You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'KEY, CUSTOMFIELDTYPEKEY, CUSTOMFIELDSEARCHERKEY, cfname, DESCRIPTION, defaultval' at line 1) at org.ofbiz.core.entity.jdbc.SQLProcessor.executeQuery(SQLProcessor.java:641) at org.ofbiz.core.entity.GenericDAO.select(GenericDAO.java:623) at org.ofbiz.core.entity.GenericDAO.select(GenericDAO.java:592) at org.ofbiz.core.entity.GenericHelperDAO.findByPrimaryKey(GenericHelperDAO.java:97) at org.ofbiz.core.entity.GenericDelegator.findByPrimaryKey(GenericDelegator.java:611) at com.atlassian.jira.ofbiz.DefaultOfBizDelegator.findByPrimaryKey(DefaultOfBizDelegator.java:339) ... 63 more Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'KEY, CUSTOMFIELDTYPEKEY, CUSTOMFIELDSEARCHERKEY, cfname, DESCRIPTION, defaultval' at line 1 at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:423) at com.mysql.jdbc.Util.handleNewInstance(Util.java:404) at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:939) at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3878) at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3814) at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2478) at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2625) at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2551) at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:1861) at com.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:1962) at org.apache.commons.dbcp2.DelegatingPreparedStatement.executeQuery(DelegatingPreparedStatement.java:83) at org.apache.commons.dbcp2.DelegatingPreparedStatement.executeQuery(DelegatingPreparedStatement.java:83) at org.ofbiz.core.entity.jdbc.SQLProcessor.executeQuery(SQLProcessor.java:633) ... 69 more {noformat} h3.Workaround * Roll back the upgrade. Please refer to [Rolling Back a JIRA Upgrade|https://confluence.atlassian.com/jira/rolling-back-a-jira-upgrade-251725626.html] on the steps to roll back to the previous version. h3. Notes This appears to be caused by not properly escaping 'KEY', which is a restricted column name in certain DBMS.

    Atlassian JIRA | 8 months ago | Mogavenasan Muthusamy [Atlassian]
    com.atlassian.cache.CacheException: com.atlassian.cache.CacheException: com.atlassian.jira.exception.DataAccessException: org.ofbiz.core.entity.GenericDataSourceException: SQL Exception while executing the following:SELECT KEY, CUSTOMFIELDTYPEKEY, CUSTOMFIELDSEARCHERKEY, cfname, DESCRIPTION, defaultvalue, FIELDTYPE, PROJECT, ISSUETYPE FROM customfield WHERE ID=? (You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'KEY, CUSTOMFIELDTYPEKEY, CUSTOMFIELDSEARCHERKEY, cfname, DESCRIPTION, defaultval' at line 1)
  2. 0

    h3. Summary Upgrading to JIRA 7.1.5 breaks because the ALTER SQL on customfield table has an incorrect syntax. h3. Environment * JIRA 7.1.5 * MSSQL and MySQL database h3. Steps to Reproduce Upgrade JIRA 7.1.4 to JIRA 7.1.5. h3. Expected Results Upgrade suppose to finish successfully. h3. Actual Results The below exception is thrown in the atlassian-jira.log file: * For MS SQL: {noformat} 2016-04-21 21:03:13,804 JIRA-Bootstrap WARN [o.o.c.entity.jdbc.DatabaseUtil] Entity "CustomField" has 10 fields but table "dbo.customfield" has 9 columns. 2016-04-21 21:03:13,804 JIRA-Bootstrap WARN [o.o.c.entity.jdbc.DatabaseUtil] Field "key" of entity "CustomField" is missing its corresponding column "KEY" 2016-04-21 21:03:14,491 JIRA-Bootstrap ERROR [o.o.c.entity.jdbc.DatabaseUtil] Could not add column "KEY" to table "dbo.customfield" 2016-04-21 21:03:14,491 JIRA-Bootstrap ERROR [o.o.c.entity.jdbc.DatabaseUtil] SQL Exception while executing the following: ALTER TABLE dbo.customfield ADD KEY NVARCHAR(255) Error was: java.sql.SQLException: Incorrect syntax near the keyword 'KEY'. {noformat} Following by: {noformat} 2016-04-21 21:04:47,736 JIRA-Bootstrap ERROR [c.a.jira.startup.IndexRecoveryLauncher] Automatic index recovery failed com.atlassian.cache.CacheException: com.atlassian.cache.CacheException: com.atlassian.jira.exception.DataAccessException: org.ofbiz.core.entity.GenericDataSourceException: SQL Exception while executing the following:SELECT KEY, CUSTOMFIELDTYPEKEY, CUSTOMFIELDSEARCHERKEY, cfname, DESCRIPTION, defaultvalue, FIELDTYPE, PROJECT, ISSUETYPE FROM dbo.customfield WHERE ID=? (Incorrect syntax near the keyword 'KEY'.) at com.atlassian.cache.memory.DelegatingCachedReference.get(DelegatingCachedReference.java:84) at com.atlassian.jira.issue.search.managers.DefaultSearchHandlerManager.getHelper(DefaultSearchHandlerManager.java:254) at com.atlassian.jira.issue.search.managers.DefaultSearchHandlerManager.getFieldIds(DefaultSearchHandlerManager.java:197) at com.atlassian.jira.issue.search.providers.LuceneSearchProvider.getSearchSorts(LuceneSearchProvider.java:435) at com.atlassian.jira.issue.search.providers.LuceneSearchProvider.search(LuceneSearchProvider.java:279) at com.atlassian.jira.issue.search.providers.LuceneSearchProvider.searchOverrideSecurity(LuceneSearchProvider.java:95) at com.atlassian.jira.issue.search.providers.DualSearchProvider.lambda$searchOverrideSecurity$2(DualSearchProvider.java:88) at com.atlassian.jira.issue.search.providers.DualSearchProvider.performSearch(DualSearchProvider.java:140) at com.atlassian.jira.issue.search.providers.DualSearchProvider.searchOverrideSecurity(DualSearchProvider.java:88) at com.atlassian.jira.index.ha.DefaultIndexRecoveryManager.getLatestIndexDate(DefaultIndexRecoveryManager.java:261) at com.atlassian.jira.index.ha.DefaultIndexRecoveryManager.getDurationToRecover(DefaultIndexRecoveryManager.java:244) at com.atlassian.jira.startup.IndexRecoveryLauncher.start(IndexRecoveryLauncher.java:45) at com.atlassian.jira.startup.DefaultJiraLauncher.lambda$postTenantArrived$4(DefaultJiraLauncher.java:183) at com.atlassian.jira.startup.DefaultInstantUpgradeManager$StatupTask.run(DefaultInstantUpgradeManager.java:113) at com.atlassian.jira.startup.DefaultInstantUpgradeManager.runTask(DefaultInstantUpgradeManager.java:46) at com.atlassian.jira.startup.DefaultInstantUpgradeManager.doNowOrWhenInstanceBecomesActive(DefaultInstantUpgradeManager.java:35) at com.atlassian.jira.startup.DefaultJiraLauncher.postTenantArrived(DefaultJiraLauncher.java:173) at com.atlassian.jira.startup.DefaultJiraLauncher.lambda$postDBActivated$3(DefaultJiraLauncher.java:161) at com.atlassian.jira.tenancy.DefaultTenantManager.doNowOrWhenTenantArrives(DefaultTenantManager.java:55) at com.atlassian.jira.startup.DefaultJiraLauncher.postDBActivated(DefaultJiraLauncher.java:158) at com.atlassian.jira.startup.DefaultJiraLauncher.lambda$postDbLaunch$2(DefaultJiraLauncher.java:147) at com.atlassian.jira.config.database.DatabaseConfigurationManagerImpl.doNowOrEnqueue(DatabaseConfigurationManagerImpl.java:298) at com.atlassian.jira.config.database.DatabaseConfigurationManagerImpl.doNowOrWhenDatabaseActivated(DatabaseConfigurationManagerImpl.java:194) at com.atlassian.jira.startup.DefaultJiraLauncher.postDbLaunch(DefaultJiraLauncher.java:137) at com.atlassian.jira.startup.DefaultJiraLauncher.lambda$start$0(DefaultJiraLauncher.java:103) at com.atlassian.jira.util.devspeed.JiraDevSpeedTimer.run(JiraDevSpeedTimer.java:31) at com.atlassian.jira.startup.DefaultJiraLauncher.start(DefaultJiraLauncher.java:101) at com.atlassian.jira.startup.LauncherContextListener.initSlowStuff(LauncherContextListener.java:115) at java.lang.Thread.run(Unknown Source) Caused by: com.atlassian.cache.CacheException: com.atlassian.jira.exception.DataAccessException: org.ofbiz.core.entity.GenericDataSourceException: SQL Exception while executing the following:SELECT KEY, CUSTOMFIELDTYPEKEY, CUSTOMFIELDSEARCHERKEY, cfname, DESCRIPTION, defaultvalue, FIELDTYPE, PROJECT, ISSUETYPE FROM dbo.customfield WHERE ID=? (Incorrect syntax near the keyword 'KEY'.) at com.atlassian.cache.memory.DelegatingCache.get(DelegatingCache.java:207) at com.atlassian.cache.memory.DelegatingCache.get(DelegatingCache.java:158) at com.atlassian.jira.issue.managers.DefaultCustomFieldManager.getCustomFieldsFromIds(DefaultCustomFieldManager.java:412) at com.atlassian.jira.issue.managers.DefaultCustomFieldManager.getCustomFieldObjects(DefaultCustomFieldManager.java:402) at com.atlassian.jira.issue.search.managers.DefaultSearchHandlerManager.createHelper(DefaultSearchHandlerManager.java:276) at com.atlassian.jira.issue.search.managers.DefaultSearchHandlerManager$1.get(DefaultSearchHandlerManager.java:102) at com.atlassian.jira.issue.search.managers.DefaultSearchHandlerManager$1.get(DefaultSearchHandlerManager.java:99) at com.atlassian.cache.memory.MemoryCacheManager$1$1.load(MemoryCacheManager.java:93) at com.atlassian.cache.memory.MemoryCacheManager$1$1.load(MemoryCacheManager.java:69) at com.google.common.cache.LocalCache$LoadingValueReference.loadFuture(LocalCache.java:3527) at com.google.common.cache.LocalCache$Segment.loadSync(LocalCache.java:2319) at com.google.common.cache.LocalCache$Segment.lockedGetOrLoad(LocalCache.java:2282) at com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2197) at com.google.common.cache.LocalCache.get(LocalCache.java:3937) at com.google.common.cache.LocalCache.getOrLoad(LocalCache.java:3941) at com.google.common.cache.LocalCache$LocalLoadingCache.get(LocalCache.java:4824) at com.google.common.cache.LocalCache$LocalLoadingCache.getUnchecked(LocalCache.java:4830) at com.atlassian.cache.memory.DelegatingCachedReference.getUnderLock(DelegatingCachedReference.java:94) at com.atlassian.cache.memory.DelegatingCachedReference.get(DelegatingCachedReference.java:79) ... 28 more Caused by: com.atlassian.jira.exception.DataAccessException: org.ofbiz.core.entity.GenericDataSourceException: SQL Exception while executing the following:SELECT KEY, CUSTOMFIELDTYPEKEY, CUSTOMFIELDSEARCHERKEY, cfname, DESCRIPTION, defaultvalue, FIELDTYPE, PROJECT, ISSUETYPE FROM dbo.customfield WHERE ID=? (Incorrect syntax near the keyword 'KEY'.) at com.atlassian.jira.ofbiz.DefaultOfBizDelegator.findByPrimaryKey(DefaultOfBizDelegator.java:341) at com.atlassian.jira.ofbiz.DefaultOfBizDelegator.findByPrimaryKey(DefaultOfBizDelegator.java:333) at com.atlassian.jira.ofbiz.DefaultOfBizDelegator.findById(DefaultOfBizDelegator.java:325) at com.atlassian.jira.ofbiz.WrappingOfBizDelegator.findById(WrappingOfBizDelegator.java:192) at com.atlassian.jira.issue.managers.DefaultCustomFieldManager$CustomFieldByIdCacheLoader.load(DefaultCustomFieldManager.java:154) at com.atlassian.cache.memory.MemoryCacheManager$3$1.load(MemoryCacheManager.java:162) at com.atlassian.cache.memory.DelegatingCache.lambda$get$0(DelegatingCache.java:158) at com.atlassian.cache.memory.DelegatingCache.lambda$get$1(DelegatingCache.java:186) at com.google.common.cache.LocalCache$LocalManualCache$1.load(LocalCache.java:4742) at com.google.common.cache.LocalCache$LoadingValueReference.loadFuture(LocalCache.java:3527) at com.google.common.cache.LocalCache$Segment.loadSync(LocalCache.java:2319) at com.google.common.cache.LocalCache$Segment.lockedGetOrLoad(LocalCache.java:2282) at com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2197) at com.google.common.cache.LocalCache.get(LocalCache.java:3937) at com.google.common.cache.LocalCache$LocalManualCache.get(LocalCache.java:4739) at com.atlassian.cache.memory.DelegatingCache.get(DelegatingCache.java:173) ... 47 more Caused by: org.ofbiz.core.entity.GenericDataSourceException: SQL Exception while executing the following:SELECT KEY, CUSTOMFIELDTYPEKEY, CUSTOMFIELDSEARCHERKEY, cfname, DESCRIPTION, defaultvalue, FIELDTYPE, PROJECT, ISSUETYPE FROM dbo.customfield WHERE ID=? (Incorrect syntax near the keyword 'KEY'.) at org.ofbiz.core.entity.jdbc.SQLProcessor.executeQuery(SQLProcessor.java:641) at org.ofbiz.core.entity.GenericDAO.select(GenericDAO.java:623) at org.ofbiz.core.entity.GenericDAO.select(GenericDAO.java:592) at org.ofbiz.core.entity.GenericHelperDAO.findByPrimaryKey(GenericHelperDAO.java:97) at org.ofbiz.core.entity.GenericDelegator.findByPrimaryKey(GenericDelegator.java:611) at com.atlassian.jira.ofbiz.DefaultOfBizDelegator.findByPrimaryKey(DefaultOfBizDelegator.java:339) ... 63 more Caused by: java.sql.SQLException: Incorrect syntax near the keyword 'KEY'. at net.sourceforge.jtds.jdbc.SQLDiagnostic.addDiagnostic(SQLDiagnostic.java:372) at net.sourceforge.jtds.jdbc.TdsCore.tdsErrorToken(TdsCore.java:2988) at net.sourceforge.jtds.jdbc.TdsCore.nextToken(TdsCore.java:2421) at net.sourceforge.jtds.jdbc.TdsCore.getMoreResults(TdsCore.java:671) at net.sourceforge.jtds.jdbc.JtdsStatement.executeSQLQuery(JtdsStatement.java:505) at org.apache.commons.dbcp2.DelegatingPreparedStatement.executeQuery(DelegatingPreparedStatement.java:83) at org.apache.commons.dbcp2.DelegatingPreparedStatement.executeQuery(DelegatingPreparedStatement.java:83) at org.ofbiz.core.entity.jdbc.SQLProcessor.executeQuery(SQLProcessor.java:633) ... 69 more {noformat} * For MySQL: {noformat} 2016-04-21 19:30:38,959 JIRA-Bootstrap WARN [o.o.c.entity.jdbc.DatabaseUtil] Entity "CustomField" has 10 fields but table "customfield" has 9 columns. 2016-04-21 19:30:38,959 JIRA-Bootstrap WARN [o.o.c.entity.jdbc.DatabaseUtil] Field "key" of entity "CustomField" is missing its corresponding column "KEY" 2016-04-21 19:30:38,962 JIRA-Bootstrap ERROR [o.o.c.entity.jdbc.DatabaseUtil] Could not add column "KEY" to table "customfield" 2016-04-21 19:30:38,962 JIRA-Bootstrap ERROR [o.o.c.entity.jdbc.DatabaseUtil] SQL Exception while executing the following: ALTER TABLE customfield ADD KEY VARCHAR(255) Error was: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'VARCHAR(255)' at line 1 {noformat} Following by: {noformat} 2016-04-21 19:31:35,175 JIRA-Bootstrap ERROR [c.a.jira.startup.IndexRecoveryLauncher] Automatic index recovery failed com.atlassian.cache.CacheException: com.atlassian.cache.CacheException: com.atlassian.jira.exception.DataAccessException: org.ofbiz.core.entity.GenericDataSourceException: SQL Exception while executing the following:SELECT KEY, CUSTOMFIELDTYPEKEY, CUSTOMFIELDSEARCHERKEY, cfname, DESCRIPTION, defaultvalue, FIELDTYPE, PROJECT, ISSUETYPE FROM customfield WHERE ID=? (You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'KEY, CUSTOMFIELDTYPEKEY, CUSTOMFIELDSEARCHERKEY, cfname, DESCRIPTION, defaultval' at line 1) at com.atlassian.cache.memory.DelegatingCachedReference.get(DelegatingCachedReference.java:84) at com.atlassian.jira.issue.search.managers.DefaultSearchHandlerManager.getHelper(DefaultSearchHandlerManager.java:254) at com.atlassian.jira.issue.search.managers.DefaultSearchHandlerManager.getFieldIds(DefaultSearchHandlerManager.java:197) at com.atlassian.jira.issue.search.providers.LuceneSearchProvider.getSearchSorts(LuceneSearchProvider.java:435) at com.atlassian.jira.issue.search.providers.LuceneSearchProvider.search(LuceneSearchProvider.java:279) at com.atlassian.jira.issue.search.providers.LuceneSearchProvider.searchOverrideSecurity(LuceneSearchProvider.java:95) at com.atlassian.jira.issue.search.providers.DualSearchProvider.lambda$searchOverrideSecurity$2(DualSearchProvider.java:88) at com.atlassian.jira.issue.search.providers.DualSearchProvider.performSearch(DualSearchProvider.java:140) at com.atlassian.jira.issue.search.providers.DualSearchProvider.searchOverrideSecurity(DualSearchProvider.java:88) at com.atlassian.jira.index.ha.DefaultIndexRecoveryManager.getLatestIndexDate(DefaultIndexRecoveryManager.java:261) at com.atlassian.jira.index.ha.DefaultIndexRecoveryManager.getDurationToRecover(DefaultIndexRecoveryManager.java:244) at com.atlassian.jira.startup.IndexRecoveryLauncher.start(IndexRecoveryLauncher.java:45) at com.atlassian.jira.startup.DefaultJiraLauncher.lambda$postTenantArrived$4(DefaultJiraLauncher.java:183) at com.atlassian.jira.startup.DefaultInstantUpgradeManager$StatupTask.run(DefaultInstantUpgradeManager.java:113) at com.atlassian.jira.startup.DefaultInstantUpgradeManager.runTask(DefaultInstantUpgradeManager.java:46) at com.atlassian.jira.startup.DefaultInstantUpgradeManager.doNowOrWhenInstanceBecomesActive(DefaultInstantUpgradeManager.java:35) at com.atlassian.jira.startup.DefaultJiraLauncher.postTenantArrived(DefaultJiraLauncher.java:173) at com.atlassian.jira.startup.DefaultJiraLauncher.lambda$postDBActivated$3(DefaultJiraLauncher.java:161) at com.atlassian.jira.tenancy.DefaultTenantManager.doNowOrWhenTenantArrives(DefaultTenantManager.java:55) at com.atlassian.jira.startup.DefaultJiraLauncher.postDBActivated(DefaultJiraLauncher.java:158) at com.atlassian.jira.startup.DefaultJiraLauncher.lambda$postDbLaunch$2(DefaultJiraLauncher.java:147) at com.atlassian.jira.config.database.DatabaseConfigurationManagerImpl.doNowOrEnqueue(DatabaseConfigurationManagerImpl.java:298) at com.atlassian.jira.config.database.DatabaseConfigurationManagerImpl.doNowOrWhenDatabaseActivated(DatabaseConfigurationManagerImpl.java:194) at com.atlassian.jira.startup.DefaultJiraLauncher.postDbLaunch(DefaultJiraLauncher.java:137) at com.atlassian.jira.startup.DefaultJiraLauncher.lambda$start$0(DefaultJiraLauncher.java:103) at com.atlassian.jira.util.devspeed.JiraDevSpeedTimer.run(JiraDevSpeedTimer.java:31) at com.atlassian.jira.startup.DefaultJiraLauncher.start(DefaultJiraLauncher.java:101) at com.atlassian.jira.startup.LauncherContextListener.initSlowStuff(LauncherContextListener.java:115) at java.lang.Thread.run(Thread.java:745) Caused by: com.atlassian.cache.CacheException: com.atlassian.jira.exception.DataAccessException: org.ofbiz.core.entity.GenericDataSourceException: SQL Exception while executing the following:SELECT KEY, CUSTOMFIELDTYPEKEY, CUSTOMFIELDSEARCHERKEY, cfname, DESCRIPTION, defaultvalue, FIELDTYPE, PROJECT, ISSUETYPE FROM customfield WHERE ID=? (You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'KEY, CUSTOMFIELDTYPEKEY, CUSTOMFIELDSEARCHERKEY, cfname, DESCRIPTION, defaultval' at line 1) at com.atlassian.cache.memory.DelegatingCache.get(DelegatingCache.java:207) at com.atlassian.cache.memory.DelegatingCache.get(DelegatingCache.java:158) at com.atlassian.jira.issue.managers.DefaultCustomFieldManager.getCustomFieldsFromIds(DefaultCustomFieldManager.java:412) at com.atlassian.jira.issue.managers.DefaultCustomFieldManager.getCustomFieldObjects(DefaultCustomFieldManager.java:402) at com.atlassian.jira.issue.search.managers.DefaultSearchHandlerManager.createHelper(DefaultSearchHandlerManager.java:276) at com.atlassian.jira.issue.search.managers.DefaultSearchHandlerManager$1.get(DefaultSearchHandlerManager.java:102) at com.atlassian.jira.issue.search.managers.DefaultSearchHandlerManager$1.get(DefaultSearchHandlerManager.java:99) at com.atlassian.cache.memory.MemoryCacheManager$1$1.load(MemoryCacheManager.java:93) at com.atlassian.cache.memory.MemoryCacheManager$1$1.load(MemoryCacheManager.java:69) at com.google.common.cache.LocalCache$LoadingValueReference.loadFuture(LocalCache.java:3527) at com.google.common.cache.LocalCache$Segment.loadSync(LocalCache.java:2319) at com.google.common.cache.LocalCache$Segment.lockedGetOrLoad(LocalCache.java:2282) at com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2197) at com.google.common.cache.LocalCache.get(LocalCache.java:3937) at com.google.common.cache.LocalCache.getOrLoad(LocalCache.java:3941) at com.google.common.cache.LocalCache$LocalLoadingCache.get(LocalCache.java:4824) at com.google.common.cache.LocalCache$LocalLoadingCache.getUnchecked(LocalCache.java:4830) at com.atlassian.cache.memory.DelegatingCachedReference.getUnderLock(DelegatingCachedReference.java:94) at com.atlassian.cache.memory.DelegatingCachedReference.get(DelegatingCachedReference.java:79) ... 28 more Caused by: com.atlassian.jira.exception.DataAccessException: org.ofbiz.core.entity.GenericDataSourceException: SQL Exception while executing the following:SELECT KEY, CUSTOMFIELDTYPEKEY, CUSTOMFIELDSEARCHERKEY, cfname, DESCRIPTION, defaultvalue, FIELDTYPE, PROJECT, ISSUETYPE FROM customfield WHERE ID=? (You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'KEY, CUSTOMFIELDTYPEKEY, CUSTOMFIELDSEARCHERKEY, cfname, DESCRIPTION, defaultval' at line 1) at com.atlassian.jira.ofbiz.DefaultOfBizDelegator.findByPrimaryKey(DefaultOfBizDelegator.java:341) at com.atlassian.jira.ofbiz.DefaultOfBizDelegator.findByPrimaryKey(DefaultOfBizDelegator.java:333) at com.atlassian.jira.ofbiz.DefaultOfBizDelegator.findById(DefaultOfBizDelegator.java:325) at com.atlassian.jira.ofbiz.WrappingOfBizDelegator.findById(WrappingOfBizDelegator.java:192) at com.atlassian.jira.issue.managers.DefaultCustomFieldManager$CustomFieldByIdCacheLoader.load(DefaultCustomFieldManager.java:154) at com.atlassian.cache.memory.MemoryCacheManager$3$1.load(MemoryCacheManager.java:162) at com.atlassian.cache.memory.DelegatingCache.lambda$get$0(DelegatingCache.java:158) at com.atlassian.cache.memory.DelegatingCache.lambda$get$1(DelegatingCache.java:186) at com.google.common.cache.LocalCache$LocalManualCache$1.load(LocalCache.java:4742) at com.google.common.cache.LocalCache$LoadingValueReference.loadFuture(LocalCache.java:3527) at com.google.common.cache.LocalCache$Segment.loadSync(LocalCache.java:2319) at com.google.common.cache.LocalCache$Segment.lockedGetOrLoad(LocalCache.java:2282) at com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2197) at com.google.common.cache.LocalCache.get(LocalCache.java:3937) at com.google.common.cache.LocalCache$LocalManualCache.get(LocalCache.java:4739) at com.atlassian.cache.memory.DelegatingCache.get(DelegatingCache.java:173) ... 47 more Caused by: org.ofbiz.core.entity.GenericDataSourceException: SQL Exception while executing the following:SELECT KEY, CUSTOMFIELDTYPEKEY, CUSTOMFIELDSEARCHERKEY, cfname, DESCRIPTION, defaultvalue, FIELDTYPE, PROJECT, ISSUETYPE FROM customfield WHERE ID=? (You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'KEY, CUSTOMFIELDTYPEKEY, CUSTOMFIELDSEARCHERKEY, cfname, DESCRIPTION, defaultval' at line 1) at org.ofbiz.core.entity.jdbc.SQLProcessor.executeQuery(SQLProcessor.java:641) at org.ofbiz.core.entity.GenericDAO.select(GenericDAO.java:623) at org.ofbiz.core.entity.GenericDAO.select(GenericDAO.java:592) at org.ofbiz.core.entity.GenericHelperDAO.findByPrimaryKey(GenericHelperDAO.java:97) at org.ofbiz.core.entity.GenericDelegator.findByPrimaryKey(GenericDelegator.java:611) at com.atlassian.jira.ofbiz.DefaultOfBizDelegator.findByPrimaryKey(DefaultOfBizDelegator.java:339) ... 63 more Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'KEY, CUSTOMFIELDTYPEKEY, CUSTOMFIELDSEARCHERKEY, cfname, DESCRIPTION, defaultval' at line 1 at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:423) at com.mysql.jdbc.Util.handleNewInstance(Util.java:404) at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:939) at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3878) at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3814) at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2478) at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2625) at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2551) at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:1861) at com.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:1962) at org.apache.commons.dbcp2.DelegatingPreparedStatement.executeQuery(DelegatingPreparedStatement.java:83) at org.apache.commons.dbcp2.DelegatingPreparedStatement.executeQuery(DelegatingPreparedStatement.java:83) at org.ofbiz.core.entity.jdbc.SQLProcessor.executeQuery(SQLProcessor.java:633) ... 69 more {noformat} h3.Workaround * Roll back the upgrade. Please refer to [Rolling Back a JIRA Upgrade|https://confluence.atlassian.com/jira/rolling-back-a-jira-upgrade-251725626.html] on the steps to roll back to the previous version. h3. Notes This appears to be caused by not properly escaping 'KEY', which is a restricted column name in certain DBMS.

    Atlassian JIRA | 8 months ago | Mogavenasan Muthusamy [Atlassian]
    com.atlassian.cache.CacheException: com.atlassian.cache.CacheException: com.atlassian.jira.exception.DataAccessException: org.ofbiz.core.entity.GenericDataSourceException: SQL Exception while executing the following:SELECT KEY, CUSTOMFIELDTYPEKEY, CUSTOMFIELDSEARCHERKEY, cfname, DESCRIPTION, defaultvalue, FIELDTYPE, PROJECT, ISSUETYPE FROM customfield WHERE ID=? (You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'KEY, CUSTOMFIELDTYPEKEY, CUSTOMFIELDSEARCHERKEY, cfname, DESCRIPTION, defaultval' at line 1)
  3. 0

    SQL Error

    GitHub | 2 years ago | honzik25
    java.lang.RuntimeException: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Unknown column 'prefix' in 'field list'
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    GitHub comment 12#161541759

    GitHub | 1 year ago | GoogleCodeExporter
    com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Mixing of GROUP columns (MIN(),MAX(),COUNT(),...) with no GROUP columns is illegal if there is no GROUP BY clause
  6. 0

    Spring 4.3.0.RELEASE + Hibernate 5.2.0.Final - GeneratedValue on mysql

    Stack Overflow | 5 months ago | Guyb
    com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Table 'searcherdb.hibernate_sequence' doesn't exist

  1. Kialandei 1 times, last 2 weeks ago
  2. davidvanlaatum 8 times, last 2 months ago
  3. AndrewProg 2 times, last 3 months ago
  4. kuldeep 2 times, last 3 months ago
  5. tvrmsmith 1 times, last 4 months ago
27 more registered users
64 unregistered visitors
Not finding the right solution?
Take a tour to get the most out of Samebug.

Tired of useless tips?

Automated exception search integrated into your IDE

Root Cause Analysis

  1. com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException

    You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'KEY, CUSTOMFIELDTYPEKEY, CUSTOMFIELDSEARCHERKEY, cfname, DESCRIPTION, defaultval' at line 1

    at sun.reflect.NativeConstructorAccessorImpl.newInstance0()
  2. Java RT
    Constructor.newInstance
    1. sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    2. sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
    3. sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    4. java.lang.reflect.Constructor.newInstance(Constructor.java:423)
    4 frames
  3. MySQL jdbc
    PreparedStatement.executeQuery
    1. com.mysql.jdbc.Util.handleNewInstance(Util.java:404)
    2. com.mysql.jdbc.SQLError.createSQLException(SQLError.java:939)
    3. com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3878)
    4. com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3814)
    5. com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2478)
    6. com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2625)
    7. com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2551)
    8. com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:1861)
    9. com.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:1962)
    9 frames
  4. Apache Commons DBCP
    DelegatingPreparedStatement.executeQuery
    1. org.apache.commons.dbcp2.DelegatingPreparedStatement.executeQuery(DelegatingPreparedStatement.java:83)
    2. org.apache.commons.dbcp2.DelegatingPreparedStatement.executeQuery(DelegatingPreparedStatement.java:83)
    2 frames
  5. org.ofbiz.core
    GenericDelegator.findByPrimaryKey
    1. org.ofbiz.core.entity.jdbc.SQLProcessor.executeQuery(SQLProcessor.java:633)
    2. org.ofbiz.core.entity.jdbc.SQLProcessor.executeQuery(SQLProcessor.java:641)
    3. org.ofbiz.core.entity.GenericDAO.select(GenericDAO.java:623)
    4. org.ofbiz.core.entity.GenericDAO.select(GenericDAO.java:592)
    5. org.ofbiz.core.entity.GenericHelperDAO.findByPrimaryKey(GenericHelperDAO.java:97)
    6. org.ofbiz.core.entity.GenericDelegator.findByPrimaryKey(GenericDelegator.java:611)
    6 frames
  6. com.atlassian.jira
    DefaultCustomFieldManager$CustomFieldByIdCacheLoader.load
    1. com.atlassian.jira.ofbiz.DefaultOfBizDelegator.findByPrimaryKey(DefaultOfBizDelegator.java:339)
    2. com.atlassian.jira.ofbiz.DefaultOfBizDelegator.findByPrimaryKey(DefaultOfBizDelegator.java:341)
    3. com.atlassian.jira.ofbiz.DefaultOfBizDelegator.findByPrimaryKey(DefaultOfBizDelegator.java:333)
    4. com.atlassian.jira.ofbiz.DefaultOfBizDelegator.findById(DefaultOfBizDelegator.java:325)
    5. com.atlassian.jira.ofbiz.WrappingOfBizDelegator.findById(WrappingOfBizDelegator.java:192)
    6. com.atlassian.jira.issue.managers.DefaultCustomFieldManager$CustomFieldByIdCacheLoader.load(DefaultCustomFieldManager.java:154)
    6 frames
  7. com.atlassian.cache
    DelegatingCache.lambda$get$1
    1. com.atlassian.cache.memory.MemoryCacheManager$3$1.load(MemoryCacheManager.java:162)
    2. com.atlassian.cache.memory.DelegatingCache.lambda$get$0(DelegatingCache.java:158)
    3. com.atlassian.cache.memory.DelegatingCache.lambda$get$1(DelegatingCache.java:186)
    3 frames
  8. Guava
    LocalCache$LocalManualCache.get
    1. com.google.common.cache.LocalCache$LocalManualCache$1.load(LocalCache.java:4742)
    2. com.google.common.cache.LocalCache$LoadingValueReference.loadFuture(LocalCache.java:3527)
    3. com.google.common.cache.LocalCache$Segment.loadSync(LocalCache.java:2319)
    4. com.google.common.cache.LocalCache$Segment.lockedGetOrLoad(LocalCache.java:2282)
    5. com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2197)
    6. com.google.common.cache.LocalCache.get(LocalCache.java:3937)
    7. com.google.common.cache.LocalCache$LocalManualCache.get(LocalCache.java:4739)
    7 frames
  9. com.atlassian.cache
    DelegatingCache.get
    1. com.atlassian.cache.memory.DelegatingCache.get(DelegatingCache.java:173)
    2. com.atlassian.cache.memory.DelegatingCache.get(DelegatingCache.java:207)
    3. com.atlassian.cache.memory.DelegatingCache.get(DelegatingCache.java:158)
    3 frames
  10. com.atlassian.jira
    DefaultSearchHandlerManager$1.get
    1. com.atlassian.jira.issue.managers.DefaultCustomFieldManager.getCustomFieldsFromIds(DefaultCustomFieldManager.java:412)
    2. com.atlassian.jira.issue.managers.DefaultCustomFieldManager.getCustomFieldObjects(DefaultCustomFieldManager.java:402)
    3. com.atlassian.jira.issue.search.managers.DefaultSearchHandlerManager.createHelper(DefaultSearchHandlerManager.java:276)
    4. com.atlassian.jira.issue.search.managers.DefaultSearchHandlerManager$1.get(DefaultSearchHandlerManager.java:102)
    5. com.atlassian.jira.issue.search.managers.DefaultSearchHandlerManager$1.get(DefaultSearchHandlerManager.java:99)
    5 frames
  11. com.atlassian.cache
    MemoryCacheManager$1$1.load
    1. com.atlassian.cache.memory.MemoryCacheManager$1$1.load(MemoryCacheManager.java:93)
    2. com.atlassian.cache.memory.MemoryCacheManager$1$1.load(MemoryCacheManager.java:69)
    2 frames
  12. Guava
    LocalCache$LocalLoadingCache.getUnchecked
    1. com.google.common.cache.LocalCache$LoadingValueReference.loadFuture(LocalCache.java:3527)
    2. com.google.common.cache.LocalCache$Segment.loadSync(LocalCache.java:2319)
    3. com.google.common.cache.LocalCache$Segment.lockedGetOrLoad(LocalCache.java:2282)
    4. com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2197)
    5. com.google.common.cache.LocalCache.get(LocalCache.java:3937)
    6. com.google.common.cache.LocalCache.getOrLoad(LocalCache.java:3941)
    7. com.google.common.cache.LocalCache$LocalLoadingCache.get(LocalCache.java:4824)
    8. com.google.common.cache.LocalCache$LocalLoadingCache.getUnchecked(LocalCache.java:4830)
    8 frames
  13. com.atlassian.cache
    DelegatingCachedReference.get
    1. com.atlassian.cache.memory.DelegatingCachedReference.getUnderLock(DelegatingCachedReference.java:94)
    2. com.atlassian.cache.memory.DelegatingCachedReference.get(DelegatingCachedReference.java:79)
    2 frames
  14. com.atlassian.jira
    LauncherContextListener.initSlowStuff
    1. com.atlassian.jira.issue.search.managers.DefaultSearchHandlerManager.getHelper(DefaultSearchHandlerManager.java:254)
    2. com.atlassian.jira.issue.search.managers.DefaultSearchHandlerManager.getFieldIds(DefaultSearchHandlerManager.java:197)
    3. com.atlassian.jira.issue.search.providers.LuceneSearchProvider.getSearchSorts(LuceneSearchProvider.java:435)
    4. com.atlassian.jira.issue.search.providers.LuceneSearchProvider.search(LuceneSearchProvider.java:279)
    5. com.atlassian.jira.issue.search.providers.LuceneSearchProvider.searchOverrideSecurity(LuceneSearchProvider.java:95)
    6. com.atlassian.jira.issue.search.providers.DualSearchProvider.lambda$searchOverrideSecurity$2(DualSearchProvider.java:88)
    7. com.atlassian.jira.issue.search.providers.DualSearchProvider.performSearch(DualSearchProvider.java:140)
    8. com.atlassian.jira.issue.search.providers.DualSearchProvider.searchOverrideSecurity(DualSearchProvider.java:88)
    9. com.atlassian.jira.index.ha.DefaultIndexRecoveryManager.getLatestIndexDate(DefaultIndexRecoveryManager.java:261)
    10. com.atlassian.jira.index.ha.DefaultIndexRecoveryManager.getDurationToRecover(DefaultIndexRecoveryManager.java:244)
    11. com.atlassian.jira.startup.IndexRecoveryLauncher.start(IndexRecoveryLauncher.java:45)
    12. com.atlassian.jira.startup.DefaultJiraLauncher.lambda$postTenantArrived$4(DefaultJiraLauncher.java:183)
    13. com.atlassian.jira.startup.DefaultInstantUpgradeManager$StatupTask.run(DefaultInstantUpgradeManager.java:113)
    14. com.atlassian.jira.startup.DefaultInstantUpgradeManager.runTask(DefaultInstantUpgradeManager.java:46)
    15. com.atlassian.jira.startup.DefaultInstantUpgradeManager.doNowOrWhenInstanceBecomesActive(DefaultInstantUpgradeManager.java:35)
    16. com.atlassian.jira.startup.DefaultJiraLauncher.postTenantArrived(DefaultJiraLauncher.java:173)
    17. com.atlassian.jira.startup.DefaultJiraLauncher.lambda$postDBActivated$3(DefaultJiraLauncher.java:161)
    18. com.atlassian.jira.tenancy.DefaultTenantManager.doNowOrWhenTenantArrives(DefaultTenantManager.java:55)
    19. com.atlassian.jira.startup.DefaultJiraLauncher.postDBActivated(DefaultJiraLauncher.java:158)
    20. com.atlassian.jira.startup.DefaultJiraLauncher.lambda$postDbLaunch$2(DefaultJiraLauncher.java:147)
    21. com.atlassian.jira.config.database.DatabaseConfigurationManagerImpl.doNowOrEnqueue(DatabaseConfigurationManagerImpl.java:298)
    22. com.atlassian.jira.config.database.DatabaseConfigurationManagerImpl.doNowOrWhenDatabaseActivated(DatabaseConfigurationManagerImpl.java:194)
    23. com.atlassian.jira.startup.DefaultJiraLauncher.postDbLaunch(DefaultJiraLauncher.java:137)
    24. com.atlassian.jira.startup.DefaultJiraLauncher.lambda$start$0(DefaultJiraLauncher.java:103)
    25. com.atlassian.jira.util.devspeed.JiraDevSpeedTimer.run(JiraDevSpeedTimer.java:31)
    26. com.atlassian.jira.startup.DefaultJiraLauncher.start(DefaultJiraLauncher.java:101)
    27. com.atlassian.jira.startup.LauncherContextListener.initSlowStuff(LauncherContextListener.java:115)
    27 frames
  15. Java RT
    Thread.run
    1. java.lang.Thread.run(Thread.java:745)
    1 frame