aspose file tools*
The moose likes Web Services and the fly likes Debugging HTTP 500 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Web Services
Bookmark "Debugging HTTP 500" Watch "Debugging HTTP 500" New topic
Author

Debugging HTTP 500

Michael Staszewski
Greenhorn

Joined: Oct 10, 2011
Posts: 16
Hi there, I have a JAX-RS application and am attempting to delete an item. I receive HTTP 500 errors and am unsure where the problem lies. What is the best way to debug these? I am using NetBeans 7 and Glassfish. I have started Glassfish in debug mode and reproduced my problem, placing a breakpoint on the line of code that issues the remove call, but I don't see any sort of exception dialog or anything meaningful.

The specific scenario that is raising the error is trying to delete a user. If I issue an HTTP delete to remove a user profile identified by its ID then the profile is removed, but it leaves a record in the users table which is undesirable. If I issue the delete to remove a user using its ID then I receive the HTTP 500. My tables are on Oracle DB and there are proper PK/FK relationships setup. The user_profiles table is also setup to remove the appropriate record when the corresponding users record has been removed using the ON DELETE CASCADE clause. The script for setting up the tables is as follows.



Alternatively I suppose I could setup a trigger on the DB to remove the appropriate user record when the profile record has been removed, but I'd like to figure out this 500 error to better my understanding of Java/web service app development.

Thanks in advance,
Michael
Ivan Krizsan
Ranch Hand

Joined: Oct 04, 2006
Posts: 2198
    
    1
Hi!
HTTP 500 is a server error, so the error is likely to occur in the server implementation.
Have you had a look in the GlassFish log? Isn't there any exception there?
If you want to set breakpoints etc, then you should do it in the RESTful service implementation class that is supposed to handle the request (DELETE in your case).
Best wishes!


My free books and tutorials: http://www.slideshare.net/krizsan
Michael Staszewski
Greenhorn

Joined: Oct 10, 2011
Posts: 16
HTTP 500 is a server error, so the error is likely to occur in the server implementation.

If you want to set breakpoints etc, then you should do it in the RESTful service implementation class that is supposed to handle the request (DELETE in your case).


Understood. As stated in my original post I started Glassfish in debug mode and placed breakpoints in my web service application, but everything ran "smoothly" or so it seems. Other than the glaring 500 error there was nothing in NetBeans that indicated an exception had occurred. At least nothing that jumped out at me. I'm a Delphi developer by trade and Delphi IDE does an excellent job of breaking on exception so you see not only the location of the exception, but what exception was raised and the call stack at that time. I'm not sure if NetBeans has something similar, but anything close to this would be helpful. I was unable to find any debugging options to perform a similar break on exception function. Again, when I reproduced the exception while running Glassfish in debug mode and by setting breakpoints at the appropriate places in my WS app, nothing useful was gained from what I could tell. The flow did stop on the breakpoint as expected, but stepping into, over, etc. all ran as if no exception had been raised. Perhaps I'm just not doing something correctly in NetBeans to debug properly.

Have you had a look in the GlassFish log? Isn't there any exception there?


No. I always forget about the @#$ log! I'll check it out.

Thanks,
Michael
Michael Staszewski
Greenhorn

Joined: Oct 10, 2011
Posts: 16
Thanks, Ivan. The LOG! I need to remember this.



Heh, ORA exception. Thanks, I can get past this one now.

Michael
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Debugging HTTP 500