项目中发生的一个奇葩问题:
- 现象
本地点击按钮,画面正常,不发生err。
服务器上点按钮,画面报错
列索引无效。
报错信息
org.springframework.jdbc.UncategorizedSQLException: SqlMapClient operation; uncategorized SQLException for SQL []; SQL state [99999]; error code [17003];
--- The error occurred while applying a parameter map.
--- Check the parameter mapping for the 'xxxxx' property.
--- Cause: java.sql.SQLException: 列索引无效
- 思路
将sql拿出来在DB中执行也没有报错。
sqlmap.xml文件中有单行注释/*xxx*/
,服务器的编码不正确,导致拼接出来的注释乱码,影响了正确的sql拼接,才出现在服务器err,本地正常的现象。
测试时将注释删掉,画面正常。