Return-Path: X-Original-To: apmail-tomcat-users-archive@www.apache.org Delivered-To: apmail-tomcat-users-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 4437A1743F for ; Sat, 1 Nov 2014 14:06:13 +0000 (UTC) Received: (qmail 1657 invoked by uid 500); 1 Nov 2014 13:02:09 -0000 Delivered-To: apmail-tomcat-users-archive@tomcat.apache.org Received: (qmail 1588 invoked by uid 500); 1 Nov 2014 13:02:09 -0000 Mailing-List: contact users-help@tomcat.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "Tomcat Users List" Delivered-To: mailing list users@tomcat.apache.org Received: (qmail 1577 invoked by uid 99); 1 Nov 2014 13:02:09 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 01 Nov 2014 13:02:09 +0000 X-ASF-Spam-Status: No, hits=-0.7 required=5.0 tests=RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of knst.kolinko@gmail.com designates 209.85.216.176 as permitted sender) Received: from [209.85.216.176] (HELO mail-qc0-f176.google.com) (209.85.216.176) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 01 Nov 2014 13:02:05 +0000 Received: by mail-qc0-f176.google.com with SMTP id x3so7060586qcv.7 for ; Sat, 01 Nov 2014 05:59:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=muntijtGKZOKzOhzUBJwSQIJNFwz4oAk8EKs6IGEhWA=; b=Mh2kHrr9NV7+HmzwJVBblOWbzQgpuv70+sPavPJ0AAKNgC8da1OO5a9GP/J0LiOPpv /DlkUYP5CLuuYDkyoEztt3rF5pwrbboKbzSI5Jgt5b3w5mFU13Z8AyCn+Pzp5IL0zIfC 3LZPFKGNolUDeMaWp0F5mHxZkRU3ZcFC1SJs2FPAFTP3HgLIEteMo5aBplmRIyfSK2g1 94e4T5ZPviI6PZnVfr3l/7n6GOaoj39RS+zTKodWmHaJMS8Bl4u8UUhweqtROmlfV4vc 1Av15nBgohFi5XL+o6iTaOQmCkYxEABSlaEsC51v0mwGkZdgpm9Q4OSSfrQ6P0mVkhuo iHJg== MIME-Version: 1.0 X-Received: by 10.140.34.102 with SMTP id k93mr43504355qgk.21.1414846769348; Sat, 01 Nov 2014 05:59:29 -0700 (PDT) Received: by 10.140.106.227 with HTTP; Sat, 1 Nov 2014 05:59:29 -0700 (PDT) In-Reply-To: References: Date: Sat, 1 Nov 2014 15:59:29 +0300 Message-ID: Subject: Re: How do you catch these exceptions From: Konstantin Kolinko To: Tomcat Users List Content-Type: text/plain; charset=UTF-8 X-Virus-Checked: Checked by ClamAV on apache.org 2014-11-01 3:57 GMT+03:00 Campbell, Lance : > > Tomcat 7.0.56 > > Java 7.0_72 > > > > I received the below Tomcat error messages in a web application. Is there a way for me to catch these exceptions so that I can then either execute Java code or trigger a Linux shell script? > > > > Oct 31, 2014 7:38:25 PM org.apache.tomcat.util.net.NioEndpoint$SocketProcessor doRun > > SEVERE: > > java.lang.OutOfMemoryError: Java heap space > > > > Oct 31, 2014 7:38:46 PM org.apache.tomcat.util.net.NioEndpoint$Acceptor run > > SEVERE: > > java.lang.OutOfMemoryError: Java heap space > > > > Oct 31, 2014 7:38:49 PM org.apache.tomcat.util.net.NioEndpoint$Poller run > > > Thanks, There is a family of options such as -XX:OnOutOfMemoryError, -XX:+HeapDumpOnOutOfMemoryError in Oracle Java. The first one is used to launch an external script in case of OOM. Doing anything from Java rarely works in case of an OOM error, especially a "PermGen" OOM. (You have a bit more luck with your "Java heap space" one). See http://markmail.org/message/rr26epg4oap4syus "Notification strategy for OutOfMemoryError" thread from about a year ago. Best regards, Konstantin Kolinko --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org For additional commands, e-mail: users-help@tomcat.apache.org