I am experiencing this problem although not sure if exactly.
I have discovered Cannot write output after reading input
in logs and, per the above, I believe this is occurring because of a getResponseCode()
followed by a getOutputStream()
.
Would this be the cause of the logged error I am seeing?
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
if(conn.getResponseCode() == 0){
logger.debug("Success");
} else {
logger.debug("Time out set for 30 seconds");
}
String input = writer.getBuffer().toString();
OutputStream os = conn.getOutputStream();
os.write(input.getBytes());
The following code
will result in a
java.net.ProtocolException
because of the following located here:Thus, the OP is calling
conn.getOutputStream();
afterconn.getResponseCode()
which is generating thejava.net.ProtocolException
whoseException.getMessages()
yields