5

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.

user207421
  • 305,947
  • 44
  • 307
  • 483
nasty pasty
  • 6,584
  • 7
  • 24
  • 26

3 Answers3

6

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

Harun
  • 667
  • 7
  • 13
  • yep this helps, but you can't use the HTTP Monitor anymore – oers Nov 08 '11 at 12:59
  • you can always enable it when you need it. Do not enable HTTP Monitor can also make your application run faster. – Harun Nov 10 '11 at 16:10
  • 1
    **For newbies** ... To disable HTTP monitor for a specific server: `Tools` --> `Server` --> `Choose the server` --> Toggle `Enable HTTP Monitor` – CᴴᴀZ Jul 20 '13 at 19:23
  • Very very unlikely. This is caused by network problems, not by software configurations. I suspect this solved a different problem, probably 'connection reset by peer'. – user207421 Mar 28 '15 at 22:47
2

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.

user207421
  • 305,947
  • 44
  • 307
  • 483
  • Thanks for replying, I appreciate your help. I've done some looking through the Microsoft KB site. I've only found a couple articles. I should add I'm running Windows 7 x64. None of the articles are relevant, as far as I can see. Do you mean one of these: http://support.microsoft.com/kb/204594 http://support.microsoft.com/kb/819124 http://support.microsoft.com/kb/331756 http://support.microsoft.com/kb/830597. – nasty pasty Jul 21 '11 at 08:22
  • 1
    @mieze it corresponds to 'WSAECONNABORTED (10053) Translation: Software caused connection abort. Description: An established connection was stopped by the software in your host computer, possibly because of a data transmission time-out or protocol error.' – user207421 Jul 21 '11 at 08:50
  • Ah I see. Do you have any idea on how to go about troubleshooting this? I'm stumped. – nasty pasty Jul 22 '11 at 08:25
  • @mieze you're going to have to sniff the network, looking for TCP retransmissions from the node that gets this exception, then work upstream until you find the offending segment or node or bridge or router. – user207421 Jul 22 '11 at 10:15
  • Turns out the answer is, at least for me, to roll back. From Netbeans 7 > 6.9, from JDK 6 to 5, from Tomcat 7 to 6. I know this leaves a VERY WIDE area in which this issue could have originated, but it did resolve the problem. I might add, this issue did not seem to affect the operation of my app (I thought it was the cause of a problem that turned out to be something else). I rolled back for a different reason and it went away. I suspect buggy Netbeans 7, but this is _only_ a suspicion as the 7.0 release is reputed to be buggy. – nasty pasty Jul 28 '11 at 05:47
  • @mieze very very unlikely. It is a network condition. Application software can neither cause nor fix it. You might be looking at a coincidental lessening of network load, or an intermittent hardware fault that has gone quiescent for the moment, etc... – user207421 Jul 29 '11 at 08:06
-1

It is a network error!

1.If you run your sparkstreaming on windows.just run:

ncat.exe -lk 7777

and download ncat.exe at https://nmap.org/ncat/

2.If you run your sparkstreaming on linux.just run:

nc -lk 7777

and make sure you have install on your linux

leocook
  • 191
  • 1
  • 13