-
1. Re: custom error pages for all applications?
peterj Oct 2, 2009 12:54 PM (in response to kmasood)The global web.xml is located at server/xxx/deployers/jbossweb.deployer, you can specify them there. And you will probably want to place the HTML pages in server/xxx/deploy/ROOT.war.
P.S. You never said with version of JBoss AS so I assume the latest (5.x). -
2. Re: custom error pages for all applications?
kmasood Oct 2, 2009 2:35 PM (in response to kmasood)Hi Peter,
Thank you for the reply. I am using version 4.2.3 and I have successfully added the error-page tag in web.xml in
server/all/deploy/jboss-web.deployer/ROOT.war/WEB-INF/
When I go to http://host:8080/blablah, I see the customized 404 page.
However, when I go to http://host:8080/app1/blablah or http://host:8080/app2/blablah, etc, I get the standard JBoss error.
I think I am almost there, and missing an obvious step, but easy step ... any ideas?
KM -
3. Re: custom error pages for all applications?
peterj Oct 2, 2009 3:49 PM (in response to kmasood)Wrong web.xml file - the one you edited is specific to the ROOT application. You need to edit the global web.xml file. In 4.2.x it is located at server/xxx/deploy/jboss-web.deployer/conf.
-
4. Re: custom error pages for all applications?
kmasood Oct 5, 2009 12:18 PM (in response to kmasood)I've added this line in server/xxx/deploy/jboss-web.deployer/conf/web.xml:
<error-page>
<error-code>404</error-code>
/404.html
</error-page>
and added the 404.html file in ROOT.war, with partial success.
http://host:8080/blablah - returns correct 404 page
http://host:8080/app1/blablah - returns a blank page ...
What might be causing the blank page? I don't see anything unusual in the log files ... hmm ... /-:
KM -
5. Re: custom error pages for all applications?
erasmomarciano Oct 6, 2009 5:14 AM (in response to kmasood)This two url are different
1)http://host:8080/blablah - returns correct 404 page
2)http://host:8080/app1/blablah - returns a blank page ..
You must put also in app1/WEB-INF/web.xml this code<error-page> <error-code>404</error-code> /404.html </error-page
-
6. Re: custom error pages for all applications?
kmasood Oct 6, 2009 3:50 PM (in response to kmasood)So there is no way to configure the error pages in one central place have them take effect for all other applications? Just confirming ...
-
7. Re: custom error pages for all applications?
peterj Oct 6, 2009 4:59 PM (in response to kmasood)If there is a way, the global web.xml is not it. Think of it this way - the configuration for a web app is the combination of the contents of the global web.xml and the web.xml specific to that app. Thus to get the 404 page for app1, you would have to place a copy of 404.html into app1.war (though you do not need to add anything to the web.xml for app1 - the global web.xml declaration is sufficient.) But this still would not work if the user entered a bad context name (for example http://hostname:8080/nosuchapp/aaa) - that would still give the app server's built in error message.
There is probably a way of using a filter, or some other mechanism, to do this, however. Perhaps someone knows off-hand.