https://blog.csdn.net/weixin_34185320/article/details/87115268
https://ask.helplib.com/others/post_12706136
https://stackoverflow.com/questions/37997306/error-500-during-sonar-runner-execution-on-jenkins
报错截图:
报错原因查看:
sonarqube的web.log文件报错如下:
Caused by: com.mysql.jdbc.PacketTooBigException: Packet for query is too large (6324977 > 4194304). You can change this value on the server by setting the max_allowed_packet' variable.
at com.mysql.jdbc.MysqlIO.send(MysqlIO.java:3681)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2512)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2683)
at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2486)
at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:1858)
at com.mysql.jdbc.PreparedStatement.executeUpdateInternal(PreparedStatement.java:2079)
at com.mysql.jdbc.PreparedStatement.executeUpdateInternal(PreparedStatement.java:2013)
at com.mysql.jdbc.PreparedStatement.executeLargeUpdate(PreparedStatement.java:5104)
at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1998)
at org.apache.commons.dbcp2.DelegatingPreparedStatement.executeUpdate(DelegatingPreparedStatement.java:136)
at org.apache.commons.dbcp2.DelegatingPreparedStatement.executeUpdate(DelegatingPreparedStatement.java:136)
at org.sonar.db.ce.CeTaskInputDao.insert(CeTaskInputDao.java:53)
... 48 common frames omitted
1、修改mysql配置
在my.ini(或者my.conf)文件中添加如下三行配置
[mysqld]
max_allowed_packet=512M
innodb_log_file_size=256M
2、修改sonar.properties配置
增加&max_allowed_packet=512M配置,与mysql
sonar.jdbc.url=jdbc:mysql://localhost:3306/sonar?useUnicode=true&characterEncoding=utf8&rewriteBatchedStatements=true&max_allowed_packet=512M
3、重启mysql和sonar