Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
Dave Alvarado
Ranch Hand
Posts: 436
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 9280
10
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Dave Alvarado
Ranch Hand
Posts: 436
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 9280
10
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic