Turning off default error page in GlassFish 3.x
In GlassFish, when no error page is specified for a given web application, a default error page will be displayed. In some use cases, it is desirable to turn off the default error page.
In this blog, we will summarize different ways to achieve this.
In a Virtual Server
One can turn off the default error page in a given virtual server by specifying a property with name <b>errorReportValve</b> and value "".
For instance, in domain.xml, it is as follows:
<config name="server-config"><br>
<http-service><br>
<access-log><access-log><br>
<virtual-server id="server" sso-enabled="false" network-listeners="http-listener-1,http-listener-2"><br>
<property name="errorReportValve" value=""><property><br>
<virtual-server>
Or one can acheive this through CLI:
asadmin set configs.config.server-config.http-service.virtual-server.server.property.errorReportValve=""
In a Web Application
One can create a file with no content and then specified it as a default error page for a given application.
A snapshot of web.xml is as follows:
<error-page><br>
<location>defaultErrorPage.jsp<location><br>
</error-page>
In a Servlet
One can specify a servlet init-param, <b>org.glassfish.web.isDefaultErrorPageEnabled</b>, in web.xml to turn on and off default error page for a given servlet as follows:
<init-param><br>
<param-name>org.glassfish.web.isDefaultErrorPageEnabled<param-name><br>
<param-value>false<param-value><br>
</init-param>
- Login or register to post comments
- Printer-friendly version
- swchan2's blog
- 1231 reads






Comments
<p>I suppose you can also set <error-page> and ...
by alexismp - 2011-04-26 15:07
I suppose you can also set <error-page> and <init-param> in config/default-web.xml for a domain-wide configuration.
If one modify <error-page> in default-web.xml, then one need ...
by swchan2 - 2011-04-29 13:16
If one modify in default-web.xml, then one need to make sure that the corresponding error page is accessible for all web application in the given domain.