Well, any program you write in Java will undoubtedly throw exceptions at some point. To get the most of those exceptions, make you you write them to a log file or console. Also, you stack trace is a huge help in getting to source of a problem.
That said... you are seeing the error itself. You said you are requesting a URL and getting a 500 msg. Well, that's the message being returned by the server. There might possibly be some more embedded in the response you could pull out using the returned object... but heck, an internal server error is an internal server error.
--- EDIT UPDATE ---
I'm betting you won't be able to get that information in your Java application. Your question seems to indicate that you want to know what error the web server (or underlying app server) encountered. Unfortunately, those types of servers rarely return their underlying errors back to the requesting client.
You see, the server encountering the error has to report the problem somewhere. This will be in one of the servers error logs. Your Java application is simply a client of the server, not part of the server. In this respect, the server simply tells the client that something (but not what) has gone wrong.
While it is true that an ODBC connection is basically a client/server situation as well, the rules of the game are different. ODBC connections imply a much more involved relationship between client and server than a web connection does.
Imagine if every web server in the world passed the underlying problem back to the client? Every time Yahoo Answers "took a coffee break" you would be bombarded with more information than you need. What would your browser do with the information? You can't change the situation and you can't fix the problem.