views:

36

answers:

3

We are getting the "java.io.IOException: Server returned HTTP response code: 500 for URL" error for the following code which is for applet-servlet communication. The same code has been working for long and now suddenly we see this error. Could something be wrong with tomcat setup? Tomcat logs do not show any error. The exception is thrown on the java console which points to this piece of code. Is there a good way to debug this error code?

     URLConnection u = getConnection( url );
     BufferedOutputStream bo = new BufferedOutputStream( u.getOutputStream() );
     ObjectOutputStream oo = new ObjectOutputStream( bo );
     oo.writeObject( someobject );
     oo.flush();
     BufferedInputStream bi = new BufferedInputStream( u.getInputStream() ); //getting the error on this line
     ObjectInputStream oi = new ObjectInputStream( bi );
     Object a_object = oi.readObject();

Any help would be appreciated.

+1  A: 

I would take the following steps:

  • Try the same URL from a browser, ideally on several different boxes and browsers
  • Use Wireshark to see what's happening on the network
  • Try to run the applet against a debugger, to see whether your code is actually getting called

Basically it's unlikely to be a client-side issue at all, unless something like a proxy is getting in the way and screwing things up. WireShark will show you what's happening on the network... and if it really is getting to your code, debugging should help you find out what's going on in your server, and hopefully why it's not getting into the Tomcat logs.

Jon Skeet
A: 

Do you have access to the Tomcat? You should inspect its log to find a reason of the error.

Dmitriy
A: 

500 Internal Server Error is an Error on the Server, not the Client. If your program is the client, you can't fix this other that telling the server administrator to fix it.

Leo Izen