Hi all, I have trouble with my applet-servet communication. I send a file from an applet to a servlet. The servlet then sends a response "Thank you" (or an error message).
Generally this works, however it does not at one of the users. The user gets this error sending the file to the servlet:
java.io.IOException: Error writing to server at sun.net.www.protocol.http.HttpURLConnection.writeRequests(Unknown Source) at sun.net.www.protocol.http.HttpURLConnection.writeRequests(Unknown Source) at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source) at AppletGUI.sendToServlet(AppletGUI.java:354)
I cannot reproduce the error, so I assume this is maybe due to a firewall. Which ports does my HTTP connection require except of 80?
Thanks Ulf, Sorry, I did not post the catch block, because it didn't seem relevant to me concerning my question. Of course I catch Exceptions in the servlet. However, no exception is thrown in the Servlet, because the doPost function is not invoked by the *one* user who has the problem.
I am really helpless with this problem. The user uses the latest JRE, WinXP and tested IE6 and Firefox. On my computers all this works fine (and also on the ones of other users). I think I can also exlude firewall problems, since port 80 is definitely open. Strange.
If you have any ideas where the problem could be, I am grateful!
Joined: Mar 22, 2005
OK. You could check whether the client request ever got to your server (by checking the access log of the server), if you know when exactly this happened.
The client could also try to access other parts of your server, maybe by using a test applet that tries to connect to various URLs.
I'm facing almost exactly the same problem, only in my case the response is also a Java Object containing a pdf as byte or an Exception Object in case of a server side Exception.
Some users have the same IOException as in your post, no matter when and how many times they try.
At the server side, I have a ProtocolException that I do not understand:
java.net.ProtocolException: EOF after reading only: '98304' of: '197686' promised bytes, out of which at least: '512' were already buffered
The number of bytes in the error message are always the same if the user tries multiple times. Has any one seen this Exception before? Can anyone explain me what it means? I guess that a TCP packet is lost and that server gives up trying to read the incomming request, but I'm not sure at all. Especially not as this happens for a minority of users every time again, and always at the same byte.
A custom Exception indicating a transfer error is stored in a JavaObject which is returned to my applet.
From the applet logging, I can see that the user has been sending for 4 minutes and 36 seconds. I have the exact same stacktrace in my applet (on the HttpURLConnection.getInputStream()). The timeout on the servers is 5 minutes;
Until now, I have never succeeded to reproduce the problem, even if I send the same data the user send.
Did any one find an explanation and/or a solution for this problem?
This is a real killer.
subject: applet-servlet communication: Error writing to server