1 Reply Latest reply on Mar 16, 2011 12:03 PM by mp911de

    Custom error responses by using virtualhost

    mountainmountain

      Hi there, I'm using JBoss 5.1.0.GA .

      I want to operate the web application by using a virtual host (The example: Name-based virtual hosts). When the error (Example 404 or 503) occurs in the web application, I want to distribute the custom error screen by the host. To achieve this, two methods were devised.

       

      1.JBoss-5.1.0.GA and Apache2.2 are connected with mod_proxy. When JBoss(Tomcat) returns 404, the error screen is controlled on the apache side. In this case, Even if Errodocument404 /error.html describes it in the httpd.conf file of Apache2.2, error.html is not displayed.

       

      2.The setting is described to server.xml and web.xml by using only JBoss-5.1.0.GA.

       

      Can the error screen be distributed by either method or other methods?

       

      Thank You

        • 1. Custom error responses by using virtualhost
          mp911de

          Hi there,

          you should do both. For file not found (404) and internal server error (500, when your servlet raises an exception) you can use web.xml of your web-app

                  <error-page>                                                           

                          <error-code>404</error-code>                                   

                          <location>/error/404.jsp</location>                           

                  </error-page>                                                          

                  <error-page>                                                           

                          <error-code>500</error-code>                                   

                          <location>/error/500.jsp</location>                           

                  </error-page>

           

          In Apache you could use ErrorDocument 503 /error.html (in case your JBoss is not running). Please keep in mind, that ErrorDocument-path is relative to your document root.

           

          Best regards,

          Mark