What's causing my java.net.SocketException: Connection reset?
The javadoc for SocketException states that it is
Thrown to indicate that there is an error in the underlying protocol such as a TCP error
In your case it seems that the connection has been closed by the server end of the connection. This could be an issue with the request you are sending or an issue at their end.
To aid debugging you could look at using a tool such as Wireshark to view the actual network packets. Also, is there an alternative client to your Java code that you could use to test the web service? If this was successful it could indicate a bug in the Java code.
As you are using Commons HTTP Client have a look at the Common HTTP Client Logging Guide. This will tell you how to log the request at the HTTP level.
Getting java.net.SocketException Connection reset error in socket communication with threads
java.net.SocketException: Connection reset
This means the OS has reseted the connection because the process on the other end is no longer running. It looks like your client crashes after processing first reply from the server.
Scanner scanner = new Scanner(System.in);
scanner.close();
Do not close Scanners
operating on System.in
. This will close System.in
and you will not be able to read anything anymore from there.
Related Topics
Java Runtime.Getruntime(): Getting Output from Executing a Command Line Program
What Are the Effects of Exceptions on Performance in Java
Quality of Image After Resize Very Low - Java
Overriding the Java Equals() Method - Not Working
Swing Animation Running Extremely Slow
Why Does Java Have Transient Fields
Array Initialization Syntax When Not in a Declaration
How to Prevent Java.Lang.Numberformatexception: For Input String: "N/A"
How to Return Multiple Objects from a Java Method
Difference Between String Object and String Literal
Adding External Library to Artifact Jar in Intellij Idea
Dependency Injection With Jersey 2.0
Check Whether a String Is Not Null and Not Empty
Resizing Issue With Canvas Within Jscrollpane Within Jsplitpane
Is There an Advantage to Use a Synchronized Method Instead of a Synchronized Block
Modify a Class Definition'S Annotation String Parameter At Runtime