Return-Path: Delivered-To: apmail-jakarta-tomcat-user-archive@apache.org Received: (qmail 68485 invoked from network); 11 Jan 2002 13:18:08 -0000 Received: from unknown (HELO nagoya.betaversion.org) (192.18.49.131) by daedalus.apache.org with SMTP; 11 Jan 2002 13:18:08 -0000 Received: (qmail 1232 invoked by uid 97); 11 Jan 2002 13:17:40 -0000 Delivered-To: qmlist-jakarta-archive-tomcat-user@jakarta.apache.org Received: (qmail 1205 invoked by uid 97); 11 Jan 2002 13:17:39 -0000 Mailing-List: contact tomcat-user-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Tomcat Users List" Reply-To: "Tomcat Users List" Delivered-To: mailing list tomcat-user@jakarta.apache.org Received: (qmail 1194 invoked from network); 11 Jan 2002 13:17:38 -0000 From: "Mike Curwen" To: "Tomcat Users List" Subject: RE: Change the default error message Date: Fri, 11 Jan 2002 07:16:36 -0600 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 8bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2911.0) X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4807.1700 In-Reply-To: <5.1.0.14.2.20020111131428.00a18ec0@correo> Importance: Normal X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N You could use a JSP error page from a servlet. Catch any ServletException errors, and do a redirect to your JSP error page. Here's short snips from one of my servlets: try { //sending email from the servlet... } catch (ServletException ex) { log("Failure to send email", ex); sendErrorRedirect(req, res, "/error.jsp", ex); } protected void sendErrorRedirect(HttpServletRequest request, HttpServletResponse response, String errorPageURL, Throwable e) { try { request.setAttribute ("javax.servlet.jsp.jspException", e); getServletConfig().getServletContext().getRequestDispatcher(errorPageURL).fo rward(request, response); } catch (Exception ex) { log(getServletName() + ".sendErrorRedirect ", ex); } } Hope that helps... -----Original Message----- From: H�ctor Garcia Peris [mailto:hector.garcia@ivie.es] Sent: Friday, January 11, 2002 6:20 AM To: tomcat-user@jakarta.apache.org Subject: Change the default error message Hello all, This is the first time I write to this page, and I send a salutation to all people. Well, this is my question. I have installed jakarta tomcat 3.2.2 in a linux machine. All works fine but I want change one thing and I don't know how can I make it. When occurs some error in a servlet, the servlet engine sends a response like this: Error: 500 Localizacion: /examples/servlet/EnbreveServlet Error interno del servlet: java.lang.NullPointerException at EnbreveServlet.doGet(EnbreveServlet.java:86) at javax.servlet.http.HttpServlet.service(HttpServlet.java:740) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java:405) at org.apache.tomcat.core.Handler.service(Handler.java:287) at org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372) at org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:79 7) at org.apache.tomcat.core.ContextManager.service(ContextManager.java:743) at org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpC onnectionHandler.java:213) at org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java:416) at org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java:501) at java.lang.Thread.run(Thread.java:484) Can I change this information to a default html page? Thanks. PS: Could be this is a FAQ, but I have searching in the FAQ-o-matic and in the archive list and I can't find answer to my question. --------------------------------------------------------------------- H�ctor Garcia Peris Dpto. Inform�tica Instituto Valenciano de Investigaciones Econ�micas S.A. (Ivie) C/ Guardia Civil, 22 esc-2 1� 46020 - Valencia (Spain) Tfno.: +34 - 963190050 / +34 - 963930816 Fax.: +34 - 963190055 / +34 - 963930856 e-mail: hector.garcia@ivie.es ---------------------------------------------------------------------- -- To unsubscribe: For additional commands: Troubles with the list: -- To unsubscribe: For additional commands: Troubles with the list: