java - HTTP 状态 500 - 内部服务器错误 - 管道损坏

标签 java mysql apache jdbc glassfish

我是 jsp 和 java 的初学者。我开发了一个简单的 Web 应用程序。 当我在服务器上部署一段时间后,应用程序工作正常。 当我尝试在一段时间后运行我的 Web 应用程序时,服务器返回以下消息:

HTTP Status 500 - Internal Server Error

类型 - 异常报告

消息 - 内部服务器错误

描述 - 服务器遇到内部错误,导致其无法满足此请求。

异常-

javax.servlet.ServletException: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: The last packet successfully received from the server was 37,611,394 milliseconds ago.  The last packet sent successfully to the server was 37,611,394 milliseconds ago. is longer than the server configured value of 'wait_timeout'. You should consider either expiring and/or testing connection validity before use in your application, increasing the server configured values for client timeouts, or using the Connector/J connection property 'autoReconnect=true' to avoid this problem.

root cause -

com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: The last packet successfully received from the server was 37,611,394 milliseconds ago.  The last packet sent successfully to the server was 37,611,394 milliseconds ago. is longer than the server configured value of 'wait_timeout'. You should consider either expiring and/or testing connection validity before use in your application, increasing the server configured values for client timeouts, or using the Connector/J connection property 'autoReconnect=true' to avoid this problem.

root cause -

java.net.SocketException: Broken pipe

note - The full stack traces of the exception and its root causes are available in the GlassFish Server Open Source Edition 4.0 logs.
GlassFish Server Open Source Edition 4.0 

(不知道出了什么问题。仍在搜索 Google,但还没有运气)

最佳答案

可能您需要将连接 URL 设置为此。

jdbcUrl = jdbc:mysql://localhost:3306/yourdatabase?useUnicode=yes&characterEncoding=utf8&autoReconnect=true&verifyServerCertificate=false&useSSL=false

关于java - HTTP 状态 500 - 内部服务器错误 - 管道损坏,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44192981/

相关文章:

java - 仅当另一个列表不为空时如何过滤列表

php - 数据迁移查询

MySql 语法(Join、UNION ALL)?

php - Codeigniter 加载程序超时已过期

java - 发送到数据库时 Android GPS 延迟

java - setTextColor 的参数是一个 int 但可以接受 8 位十六进制值是怎么回事?

mysql - 更新时触发错误

apache - 是否可以不将 Tomcat 与 apache http 服务器集成并向部署在 Tomcat 中的 servlet 发出 @Injectable 请求?

python - 如何修复 Apache mod_wsgi 的 Python 版本不匹配问题?

java - JNLP - application-desc 与 applet-desc - 当不在浏览器中运行时,一个比另一个更好?