如何修复java.net.SocketException:管道坏了? [英] How to fix java.net.SocketException: Broken pipe?

查看:157
本文介绍了如何修复java.net.SocketException:管道坏了?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用apache commons http客户端使用post方法调用url来发布参数,并且很少抛出以下错误。

I am using apache commons http client to call url using post method to post the parameters and it is throwing the below error rarely.

java.net.SocketException: Broken pipe
        at java.net.SocketOutputStream.socketWrite0(Native Method)
        at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:92)
        at java.net.SocketOutputStream.write(SocketOutputStream.java:136)
        at java.io.BufferedOutputStream.write(BufferedOutputStream.java:105)
        at java.io.FilterOutputStream.write(FilterOutputStream.java:80)
        at org.apache.commons.httpclient.methods.ByteArrayRequestEntity.writeRequest(ByteArrayRequestEntity.java:90)
        at org.apache.commons.httpclient.methods.EntityEnclosingMethod.writeRequestBody(EntityEnclosingMethod.java:499)
        at org.apache.commons.httpclient.HttpMethodBase.writeRequest(HttpMethodBase.java:2114)
        at org.apache.commons.httpclient.HttpMethodBase.execute(HttpMethodBase.java:1096)
        at org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry(HttpMethodDirector.java:398)

有人可以建议导致此异常的原因以及如何调试它吗? / p>

Can someone suggest what is causing this Exception and how to debug it?

推荐答案

这是因为当另一端已经关闭连接时写入连接。

This is caused by writing to a connection when the other end has already closed it.

因此,您的应用程序协议定义不明确。

So you have a poorly defined or implemented application protocol.

这篇关于如何修复java.net.SocketException:管道坏了?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆