Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

java.net.SocketException: Software caused connection abort: recv failed, with java.net.SocketException: Connection reset [duplicate]

Tags:

java

sockets

I'm getting an exception in my Java, Hibernate, MySQL project within Netbeans IDE.

I've done some digging to try and fix this strange Socket exception, to no avail.

Some forum solutions suggested implementing a c3p0 connection pool for Hibernate. No fix.

Others suggested disabling AV and firewall (!!) as these could interfere with the socket connection. No fix.

I've tagged this question with Hibernate, as I'm not certain that hibernate is the cause, but the exceptions occur on a Hibernate call (running a query). Other Hibernate code in the app works fine. The Hibernate version is 3.2 .

The exception:

NotifyUtil::java.net.SocketException: Software caused connection abort: recv failed
at java.net.SocketInputStream.socketRead0(Native Method)
at java.net.SocketInputStream.read(SocketInputStream.java:129)
at java.io.BufferedInputStream.fill(BufferedInputStream.java:218)
at java.io.BufferedInputStream.read1(BufferedInputStream.java:258)
at java.io.BufferedInputStream.read(BufferedInputStream.java:317)
at java.io.FilterInputStream.read(FilterInputStream.java:116)
at     sun.net.www.protocol.http.HttpURLConnection$HttpInputStream.read(HttpURLConnection.java:2676)
at sun.nio.cs.StreamDecoder.readBytes(StreamDecoder.java:264)
at sun.nio.cs.StreamDecoder.implRead(StreamDecoder.java:306)
at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:158)
at java.io.InputStreamReader.read(InputStreamReader.java:167)
at java.io.BufferedReader.fill(BufferedReader.java:136)
at java.io.BufferedReader.readLine(BufferedReader.java:299)
at java.io.BufferedReader.readLine(BufferedReader.java:362)
at org.netbeans.modules.web.monitor.server.NotifyUtil$RecordSender.run(NotifyUtil.java:299)

This exception may occur once, or a few times, and be followed by none or a few of this exception:

NotifyUtil::java.net.SocketException: Connection reset
at java.net.SocketInputStream.read(SocketInputStream.java:168)
at java.io.BufferedInputStream.fill(BufferedInputStream.java:218)
at java.io.BufferedInputStream.read1(BufferedInputStream.java:258)
at java.io.BufferedInputStream.read(BufferedInputStream.java:317)
at java.io.FilterInputStream.read(FilterInputStream.java:116)
at sun.net.www.protocol.http.HttpURLConnection$HttpInputStream.read(HttpURLConnection.java:2676)
at sun.nio.cs.StreamDecoder.readBytes(StreamDecoder.java:264)
at sun.nio.cs.StreamDecoder.implRead(StreamDecoder.java:306)
at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:158)
at java.io.InputStreamReader.read(InputStreamReader.java:167)
at java.io.BufferedReader.fill(BufferedReader.java:136)
at java.io.BufferedReader.readLine(BufferedReader.java:299)
at java.io.BufferedReader.readLine(BufferedReader.java:362)
at org.netbeans.modules.web.monitor.server.NotifyUtil$RecordSender.run(NotifyUtil.java:299)

Help would be much appreciated. This is a bit of a strange one.

Thanks.

like image 353
nasty pasty Avatar asked Jul 21 '11 06:07

nasty pasty


People also ask

What does Java net SocketException connection reset mean?

java.net.SocketException: Connection reset This SocketException occurs on the server-side when the client closed the socket connection before the response could be returned over the socket. For example, by quitting the browser before the response was retrieved. Connection reset simply means that a TCP RST was received.

How do I fix Software caused connection abort socket write error?

Possible solution: Check Virus scan service whether it's blocking the port for the outgoing requests for connections. Software caused connection abort: socket write error. Possible solution: Make sure you're writing the correct length of bytes to the stream. So double check what you're sending.


2 Answers

In my case, I was using Tomcat. Right click on Tomcat in Server list and then click properties, then uncheck "Enable HTTP Monitor". This solve my issues

like image 70
Harun Avatar answered Nov 02 '22 07:11

Harun


There's a Microsoft Knowledge Base article about this, see if you can find it. Basically this is a result of prior errors writing to the network by the peer that gets the exception. Indicates a network problem rather than software.

like image 26
user207421 Avatar answered Nov 02 '22 05:11

user207421