You could try this:

try 
{ 
 ... 
} 
catch(Exception e) 
{ 
    Throwable cause = e.getCause(); 
    if (cause != null)
        cause.printStackTrace();
    else
        System.err.println("ROOT CAUSE is null");
} 

Andy

-----Original Message-----
From: Nagpal, Vikas [mailto:vinagpal@;utmb.edu]
Sent: 21 October 2002 20:10
To: '[EMAIL PROTECTED]'
Subject: RE: [OFF-TOPIC] - RE: How to capture the ROOT cause of
EXCEPTION


Date: Mon, 21 Oct 2002 14:13:54 -0500
MIME-Version: 1.0
X-Mailer: Internet Mail Service (5.5.2653.19)
Content-Type: text/plain

Hi all, 

I tried out the following code but it did not work. 

try 
{ 
 ... 
} 
catch(Exception e) 
       { 
      Throwable cause = e.getCause(); 
       System.out.println(e.getCause()); 
       } 

Can anyone help. 

Thanks, 
Vikas. 
-----Original Message----- 
From: Shapira, Yoav [mailto:Yoav.Shapira@;mpi.com] 
Sent: Monday, October 21, 2002 11:17 AM 
To: Tomcat Users List 
Subject: [OFF-TOPIC] - RE: How to capture the ROOT cause of EXCEPTION 



Hi, 
Did you try: 

try 
{ 
  ... do something... 
} 
catch(Exception e) 
{ 
  Throwable cause = e.getCause(); 
  ... do whatever you want with the cause ... 
} 

By the way, as this is not a tomcat question, please either post 
somewhere appropriate (comp.lang.java.help for example), or at least add 
OFF-TOPIC to your subject.  Thanks, 

Yoav Shapira 
Millennium ChemInformatics 



>-----Original Message----- 
>From: Nagpal, Vikas [mailto:vinagpal@;utmb.edu] 
>Sent: Monday, October 21, 2002 12:12 PM 
>To: '[EMAIL PROTECTED]' 
>Subject: How to capture the ROOT cause of EXCEPTION 
> 
>Hello EveryBody, 
> 
>I have been trying to catch the ROOT cause of the exception. I am able 
to 
>get the NULL for the number which caused this exception but not the 
NUMBER. 
>Can anyone tell how to PRINT the NUMBER which caused the EXCEPTION. I 
want 
>to subsitute the NULL with the NUMBER. 
> 
>Thanks, 
>With regards, 
>Vikas nagpal. 


--
To unsubscribe, e-mail:
<mailto:tomcat-user-unsubscribe@;jakarta.apache.org>
For additional commands, e-mail:
<mailto:tomcat-user-help@;jakarta.apache.org>

--
To unsubscribe, e-mail:   <mailto:tomcat-user-unsubscribe@;jakarta.apache.org>
For additional commands, e-mail: <mailto:tomcat-user-help@;jakarta.apache.org>

Reply via email to