Skip to main content

Turning off default error page in GlassFish 3.x

Posted by swchan2 on April 18, 2011 at 5:23 PM PDT

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 errorReportValve and value "".

For instance, in domain.xml, it is as follows:

  <config name="server-config">
    <http-service>
      <access-log><access-log>
      <virtual-server id="server" sso-enabled="false" network-listeners="http-listener-1,http-listener-2">
        <property name="errorReportValve" value=""><property>
      <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>
    <location>defaultErrorPage.jsp<location>
  </error-page>

In a Servlet

One can specify a servlet init-param, org.glassfish.web.isDefaultErrorPageEnabled, in web.xml to turn on and off default error page for a given servlet as follows:

  <init-param>
    <param-name>org.glassfish.web.isDefaultErrorPageEnabled<param-name>
    <param-value>false<param-value>
  </init-param>

Comments

Be thankful to you you should not do this superior quality ...

Be thankful to you you should not do this superior quality article, let me share the whole size with my social life on social marketing. I would really like to suggest i request you stay restore your web blog as much as possible i likewise subscribe you to get more details newsletters. chicago treatment clinic
iphone cases review
usa made peptides



<p>I suppose you can also set &lt;error-page&gt; and ...

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 ...

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.