Global Error Page Tomcat
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more tomcat custom error page about Stack Overflow the company Business Learn more about hiring developers or posting
Tomcat Default Error Page Location
ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack tomcat error-page Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up Empty page instead of custom tomcat error page up vote 7
Tomcat Custom Error Page For All Errors
down vote favorite 1 My setting: Apache 2.2 + Tomcat 6.0 @ Windows 2008 R2 64bit static webpages: / servlet: /foo tomcat and apache are connected by mod_jk 404.jsp is placed in tomcat\webapps\ROOT tomcat\conf\web.xml: 404 /404.jsp apache\conf\extra\httpd-ssl.conf: JkMount /foo/* worker1 JkMount /404.jsp worker1 When I open https://...../404.jsp my custom error page is displayed. But when I open https://...../foo/nonexisting.html an empty page is displayed. If I remove the tomcat error page configuration ... code from web.xml and open https://...../foo/nonexisting.html then tomcats own 404 is displayed. Any hints? tomcat custom-error-pages share|improve this question edited Oct 5 '10 at 13:03 asked Oct 4 '10 at 14:23 Alexander 1431210 add a comment| 7 Answers 7 active oldest votes up vote 2 down vote The Jkmount should have the context as parameter, ex: JkMount /mycontext/* worker1 then the pages are accessed this way: https://mycontext/someservlet/ or https://mycontext/foo/nonexisting.html share|improve this answer edited Nov 28 '12 at 21:42 Francesco 7,41912249 answered Nov 28 '12 at 21:20 Leon 525 add a comment| up vote 1 down vote accepted As far as i can see it, webapps' errors can't be handled with error pages placed in ROOT. I now put the 404.jsp in every webapp (/foo/404.jsp, /bar/404.jsp, ...) and now it works. I can safely delete the 404.jsp in ROOT, but if I delete the 404.jsp in /foo or /bar a blank page is served if a 404 occurres in either webapp. Either tomcat ignores the leading / in the "location" element or the content of this element is appended at the 'calling' webapp's path. share|improve this answer edited Jan 21 '11 at 9:16 answered Jan 17 '11 at 13:50 Alexander 1431210 add a comment
Start here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack
Tomcat Error Page Location
Overflow the company Business Learn more about hiring developers or posting ads with us Server
Apache Tomcat Error Page Location
Fault Questions Tags Users Badges Unanswered Ask Question _ Server Fault is a question and answer site for system and network administrators. tomcat custom error page for all webapps Join them; it only takes a minute: Sign up Here's how it works: Anybody can ask a question Anybody can answer The best answers are voted up and rise to the top Set Error-Pages for all http://stackoverflow.com/questions/3856145/empty-page-instead-of-custom-tomcat-error-page Applications in Tomcat up vote 1 down vote favorite I'm trying to set up custom error pages in tomcat 6, because I don't want the default ones to show up. My error pages are static html, no jsp or anything dynamic. I know how to do this through the web.xml in each application but I'd prefere to setup the error pages only once for the entire server. I tried to add the http://serverfault.com/questions/125288/set-error-pages-for-all-applications-in-tomcat following fragment to the global web.xml (in conf), but no matter what I add under location, it does not show. 404 /404.html What do I need to do to gobally define custom error pages? Thanks! tomcat errordocument share|improve this question asked Mar 23 '10 at 8:57 phisch 10817 add a comment| 1 Answer 1 active oldest votes up vote 2 down vote accepted Your syntax is correct (and worked fine for me). But you will need a file called 404.html at the root level for every webapp deployed for it to work. If you do NOT want to do that - there is the little know errorReportValveClass as part of StandardHost in which you can provide your own implementation of a class to handle all the uncaught errors. http://tomcat.apache.org/tomcat-6.0-doc/config/host.html share|improve this answer answered Jan 31 '11 at 0:48 Tim Funk 38414 add a comment| Your Answer draft saved draft discarded Sign up or log in Sign up using Google Sign up using Facebook Sign up using Email and Password Post as a guest Name Email Post as a guest Name Email discard By posting your answer, you agree to the privacy policy and terms of service. Not the answer you're looking for? Browse other questions tagged tomcat errordocument or ask your own questi
This bug is not in your last search results. Bug52135 - Global error page is not handled Summary: Global error page https://bz.apache.org/bugzilla/show_bug.cgi?id=52135 is not handled Status: RESOLVED FIXED Product: Tomcat 7 Classification: Unclassified Component: Servlet & JSP API Version: 7.0.22 Hardware: PC All Importance: P2 enhancement with 2 votes (vote) TargetMilestone: --- Assigned To: http://davidghedini.blogspot.com/2010/10/tomcat-custom-404-page.html Tomcat Developers Mailing List URL: Keywords: Depends on: Blocks: Show dependency tree Reported: 2011-11-04 14:15 UTC by balusc Modified: 2013-03-17 14:35 UTC (History) CC List: 4 users (show) jens.borgland jks error page ljelinek sutanu_g Attachments globalerrortest.war (1.29 KB, application/octet-stream) 2013-01-10 02:49 UTC, Konstantin Kolinko Details View All Add an attachment (proposed patch, testcase, etc.) Note You need to log in before you can comment on or make changes to this bug. Description balusc 2011-11-04 14:15:58 UTC The new Servlet 3.0 global error page /error.jsp is not handled in Tomcat 7. On Glassfish 3 for example, tomcat custom error it works fine. Comment 1 Mark Thomas 2011-11-04 19:41:49 UTC There is no "new Servlet 3.0 global error page" I can find references to in the Servlet 3.0 specification. Tomcat uses error pages with some of the applications that ship with Tomcat and error pages work correctly in those applications. Please feel free to re-open this issue but if you do you are going to have to provide a lot more detail else it will simply be re-closed as invalid. You'll need to provide the full steps to reproduce this issue on a clean install of the latest Tomcat 7 release. Providing the simplest possible web application (with source code) that demonstrates the issue is one way to do this. Comment 2 balusc 2011-11-04 21:01:09 UTC The and entries are now *optional* by XSD, before either one of them was required. Comment 3 balusc 2011-11-04 21:05:57 UTC (where's the edit comment link?) Sorry, in the previous comment I meant to say instead of . Also the figure 14-10 in Servlet 3.0 spec identifies those options with a dotted line which means that they are optional. Comment 4 Sutanu
exist, a 404 Error is raised and the user is served Tomcat's default 404 error page as below: Above, I requested a page called 'david' which does not exist. To make your 404 page a bit more presentable, provide the user with a link back into your site, as well as hide the Tomcat version in use, you can easily add a custom 404 error page. Start by creating the page you wish to use. In my case, I am creating a page called 'NotFound.jsp' Add the 404 page you crated to your site directory. Now, in your $CATALINA_HOME/conf directory, edit your web.xml file. Add the following entry just beneath the welcome-file-list entry as shown below: index.html index.htm index.jsp 404 /NotFound.jsp Now, when someone goes to a page that does not exist, they get the custom 404 page we created. for example: http://www.davidghedini.com/YadaYadaYada.jsp SEO Disclaimer: I've called my page NotFound.jsp page and have added a meta-tag: meta content="noindex" name="robots"> I did this as it (supposedly), the tag will stop search engined from indexing my 404 page. I'm not an SEO guy so whether this is necessary (or even a good idea), I don't know. You could, of course, place your 404 page within a sub directory (e.g. '404') and adjust the location in your web.xml from /404/NotFound.jsp to /NotFound.jsp. You could then add a robots.txt file to prevent crawling of the directory. Related Posts: Install Tomcat 6 on CentOS Tomcat Oracle JDBC Connection Tomcat Manager Password Posted by David Ghedini at 4:29 PM Email ThisBlogThis!Share to TwitterShare to FacebookShare to Pinterest Labels: 404 page, Tomcat No comments: Post a Comment Newer Post Older Post Home Subscribe to: Post Comments (Atom) About David Ghedini View my complete profile LinkedIn Technorati Profile Blog Information Profile for DavidGhedini Blog Archive ► 2012 (1) ► July (1) ► 2011 (8) ► June (1) `