View exception stack in browser instead of "Server Error" with SJS Web Server 7.0 Update 2

Are you an application developer using SJS Web Server 7 Update 2?
Now you can see exception stack in browser itself. You don't need to go through error log to see what's wrong with the JSP page.

In Web Server releases prior to 7.0 Update 2, when an exception occurs in the servlet container at the request time, a "Server Error" is displayed in browser without exposing internal application details and the exception is logged in the error log. This is what is wanted for production environment. However, displaying exception details in browser would save quite some time for developers (in development environment) as they don't have to dig through the error log for trivial errors in their applications. A simple example could be an invalid JSP standard action in a JSP page. This would throw a "Server Error" at the request time and it could be caused b/c of a simple typo.

In Sun Java System Web Server 7.0 Update 2 release, the "Display Exception" functionality was added to address this concern. By default, this functionality is disabled. You can enable it using administration CLI or GUI. In this blog, I'll show below how to enable this functionality using Administration GUI.

1) Start the admin server.
<WS7_INSTALLATION_DIR>/admin-server/bin/startserv

2) Open https://localhost:8989/ from browser and Log into Admin console. (if you are running admin server locally)

3) From the Home page, Click "Edit Java Settings"




4) Select "Servlet Container" tab and enable "Display Exception" check box.




5) Click "Save" and then click "Deployment pending" link.

6) Now that you enabled "Display Exception" feature, for a error such as <jsp:include path="foo.jsp" /> in a JSP page, you will see below exception stack in the browser which otherwise would have been "Server Error".



This is intended for development environment only. Please turn off this functionality for production environment

Comments:

Post a Comment:
  • HTML Syntax: NOT allowed
About

kmeduri

Search

Categories
Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today