本地运行没问题的项目在Tomcat持续运行一段时间后报错的部分解决办法

遇到的这些问题均为项目在本地运行很正常,发布在服务器上后出现的各种报错。

报错信息:

严重[ajp-nio-8009-exec-1] org.apache.coyote.ajp.AjpMessHeader Invalid received signature [18245]

信息[http-nio-8080-exec-6] org.apache.coyote.tp11Processor.service Error parsing HTTP request header
Note: further occurrences of HTTP header parsing errors will be logged level

解决方法:

在Tomcat的server.xml中将<Connector port="8009" protocol="AJP/1.3" redirectPort="8443" />注释掉。

找到<Connector port="8080" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="8443"/>这个标签,添加maxHttpHeaderSize="8192"这一属性,这里顺便把端口改成了8001,8080端口不知为什么总是报一些莫名其妙的错误。

报错信息:

SQLException com.mysql.jdbc.exception.jdbc4.CommunicationException:The last packet successfully received from the server was xxx milliseconds ago. The last packet sent successfully to the server was xxx milliseconds ago, is longer than the server configured value of 'wait_timeout'...

解决方法:

在MySQL的my.ini中添加wait_timeout=数值,这里的数值为秒数,设置完后一定要重启MySql,否则无效,在连接数据库的地址后添加?autoReconnect=true&autoReconnectForPools=true

报错信息(这个在本地运行也会马上报错):

Establishing SSL connection without server's identityverification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+requirements SSL connection must be established by default if explicit optionisn't set. For compliance with existing applications not using SSL theverifyServerCertificate property is set to 'false'. You need either toexplicitly disable SSL by setting useSSL=false, or set useSSL=true and providetruststore for server certificate verification.

解决方法:

在连接数据库的地址后添加?useSSL=false

猜你喜欢

转载自blog.csdn.net/the_first_snow/article/details/79335970