Com.mysql.jdbc.PacketTooBigException:Packet for query is too large (2280 > 2048). Workaround for exception

Source: Internet
Author: User

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.