aspose file tools*
The moose likes BEA/Weblogic and the fly likes Way to display stack trace instead of 500 internal server error? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » BEA/Weblogic
Bookmark "Way to display stack trace instead of 500 internal server error?" Watch "Way to display stack trace instead of 500 internal server error?" New topic
Author

Way to display stack trace instead of 500 internal server error?

Dave Alvarado
Ranch Hand

Joined: Jul 02, 2008
Posts: 436
Hi,

I'm using WebLogic 9.2.2 on Solaris. Occasionally, I'll get the message "Error 500--Internal Server Error" appear in my web browser when something has gone wrong and I have to look in the log files for the stack trace of the exception. How can I get the exception to be output directly to my browser?

I'm working in a development environment so anything I can do to save time is of value.

Thanks, - Dave
Joe Ess
Bartender

Joined: Oct 29, 2001
Posts: 8895
    
    8

There's several request attributes that get set when an error occurs:
javax.servlet.error.request_uri
javax.servlet.error.message
javax.servlet.error.status_code
javax.servlet.error.servlet_name
javax.servlet.error.exception

The last attribute contains the Exception object. From that you can get the stack trace of the exception.


"blabbing like a narcissistic fool with a superiority complex" ~ N.A.
[How To Ask Questions On JavaRanch]
Dave Alvarado
Ranch Hand

Joined: Jul 02, 2008
Posts: 436
Thanks for the reply but it is not the Java code that is printing the error. There is an exception in the controller which is getting thrown up to the WebLogic container, and the container is displaying that familiar error,


Error 500--Internal Server Error
From RFC 2068 Hypertext Transfer Protocol -- HTTP/1.1:
10.5.1 500 Internal Server Error
The server encountered an unexpected condition which prevented it from fulfilling the request.


I was hoping there is a setting in WebLogic somewhere that instead of showing this error, could print the stack trace instead. - Dave
Joe Ess
Bartender

Joined: Oct 29, 2001
Posts: 8895
    
    8

Right. Set up your application to use a JSP to display the 500 error, then grab the attributes above in the JSP and display them.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Way to display stack trace instead of 500 internal server error?