SocketException:通过JDBC访问mysql数据库的管道损坏

时间:2011-08-02 11:26:56

标签: mysql jdbc tomcat6

我有一个带有通过JDBC访问的MySQL后端的Web应用程序。每天早上我都会看到这个例外:

**开始没有异常**

java.net.SocketException
MESSAGE: Broken pipe

堆栈跟踪:

java.net.SocketException: Broken pipe
at java.net.SocketOutputStream.socketWrite0(Native Method)
at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:109)
at java.net.SocketOutputStream.write(SocketOutputStream.java:153)
at java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:82)
at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:140)
at com.mysql.jdbc.MysqlIO.send(MysqlIO.java:2744)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1612)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1723)
at com.mysql.jdbc.Connection.execSQL(Connection.java:3283)
at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:1332)
at com.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:1467)
at com.model.dbchecks.DatabaseConnectHandler.db_execute_prepared_query(DatabaseConnectHandler.java:117)
at com.model.dbchecks.UserHandler.does_user_exist(UserHandler.java:154)
at com.model.dbchecks.UserHandler.authenticate_user(UserHandler.java:66)
at com.web.security.LoginServlet.doPost(LoginServlet.java:68)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)

如何防止这种情况?

1 个答案:

答案 0 :(得分:0)

根据日志LoginServlet被调用并调用 导致麻烦的com.model.dbchecks.DatabaseConnectHandler.does_user_exist()