PacketTooBigException when running a sonar analysis

廉价感情. 提交于 2019-12-18 21:15:50

问题


When I try and run a sonar analysis I get this exception

com.mysql.jdbc.PacketTooBigException: Packet for query is too large (1807198 > 1048576). You can change this value on the server by setting the max_allowed_packet' variable.

Where on the sonar server should I set this value?

I'm using Sonar 3.4.1 and MySQL 5.x


回答1:


Locate the config file my.cnf (If your MySQL is running in Windows, locate my.ini)

Add this to the config file

[mysqld]
max_allowed_packet=256M

Then, restart mysql

  • For Linux, service mysql restart
  • For Windows
    • net stop mysql
    • net start mysql

Give it a Try !!!




回答2:


I had a same issue however, we had a limitation where we could not change the MySQL server configuration (max_allowed_packet)

I was able to get this working by changing the Client side jdbc URL configurations -> leaving the server config as is.

jdbc:mysql://[dbhost]:[dbport]?useUnicode=true&rewriteBatchedStatements=true&characterEncoding=utf8&useServerPrepStmts=true&maxAllowedPacket=20000000&useSSL=false

Check the mysql connector config reference here

There is one more post on SO that talks abt Client side change in detail - check here

Hope this helps!



来源:https://stackoverflow.com/questions/14592351/packettoobigexception-when-running-a-sonar-analysis

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!