Today encountered an exception, in the execution of a query function, the background will be error, did not return the query results.
Linux server is generally the MySQL configuration file problems (the same data in the local error), MySQL Restart may reset the configuration file caused, or be maliciously modified.
My error is as follows:
Critical: Servlet.service () for Servlets [Dispatcherservlet] in context with path [/******] threw exception [Request processing F Ailed Nested exception is org.hibernate.exception.GenericJDBCException:could no extract ResultSet] with root cause
Com.mysql.jdbc.PacketTooBigException:Packet for query is too large (2280 > 2048). You can change this value on the server by setting the Max_allowed_packet ' variable.
On-line search of some methods, the main problem is max_allowed_packet parameters do not meet the requirements, summarized as follows
Find my.cnf config file, linux under input command mysql--help | grep my.cnf
Several paths are shown below, but there may be some paths that do not have a file, which is usually the default in the first/etc/my.cnf (you can find this file anyway)
It is also possible to create a new my.cnf file under etc without the configuration file
After locating the configuration file, add a column at the end max_allowed_packet=32m
Restart the MySQL Services service mysqld restart
Here is my configuration file:
[Mysqld]
Datadir=/var/lib/mysql
Socket=/var/lib/mysql/mysql.sock
Lower_case_table_names=1
max_allowed_packet=100m
Symbolic-links=0
Sql_mode=no_engine_substitution,strict_trans_tables
[Mysqld_safe]
Log-error=/var/log/mysqld.log
Pid-file=/var/run/mysqld/mysqld.pid
max_allowed_packet=32m
The above is for reference only
If you encounter such problems later, you can directly see if the MY.CNF configuration has been modified.
Com.mysql.jdbc.PacketTooBigException:Packet for query is too large (2280 > 2048). Workaround for exception