1. 程式人生 > 實用技巧 >Caused by: java.sql.SQLSyntaxErrorException: Expression #16 of SELECT list is not in GROUP BY clause

Caused by: java.sql.SQLSyntaxErrorException: Expression #16 of SELECT list is not in GROUP BY clause

現象是這樣的,前端訪問應用稽核功能,系統出現數據庫錯誤,前端的message將錯誤資訊也展示出來了。

原因是這樣:

  1. 錯誤資訊的產生是因為資料庫配置與SQL語句不相容

Caused by: java.sql.SQLSyntaxErrorException: Expression #16 of SELECT list is not in GROUP BY clause and contains nonaggregated column ‘r.dicName’ which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by

在這裡插入圖片描述

解決方式:需要修改資料庫sql_mode的only_full_group_by配置。

  1. 錯誤資訊的展示是因為appstore-portal使用的exception庫不是最新版本,導致將異常描述資訊作為API的響應描述資訊返回了,現在已經將appstore-portal使用的exception庫升級到了最新的1.1.1版本。