Sachin,

You shouldn't be getting RuntimeExceptions.

RuntimeExceptions (imho) should be used to indicate programmer error.

Either, you're getting NullPointerExceptions and the like, in which case
more defensive programming needs ot be done, or you're getting your own
NuixRuntimeExceptions, which should be avoidable...  look at the "Effective
Java" book for how to handle runtime exceptions, but a good example is
Iterator, where if you call next() then you might get a RuntimeException -
however, this is avoidable wiht the use of hasNext().

hth
dim

ps - hope all's well up there (o:

----- Original Message -----
From: "Sachin Pandey" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, September 26, 2002 11:54 AM
Subject: Re: Handling RuntimeExceptions in MDB


> So should I catch RuntimeExceptions explicitly in my onMessage()
> implementation.
> The MDB is using container managed transaction.
>
> Cheers
> Sachin Pandey
> NUIX Pty Ltd
> Level 8, 143 York Street,
> Sydney 2000
> Phone: (02) 92839010
> Fax: (02) 92839020
>
> Disclaimer:
> This message is intended only for the named recipient. If you are not the
> intended recipient you are notified that disclosing,copying, distributing
or
> taking any action in reliance on the contents of this information is
> strictly prohibited.
> ----- Original Message -----
> From: "Saurabh Sahai" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Thursday, September 26, 2002 11:54 AM
> Subject: Re: Handling RuntimeExceptions in MDB
>
>
> > Refer to the EJB 2.1 specs sec 15.4.13 (there will be something similar
in
> > the older specs too) ...
> >
> > "Message-driven beans should not, in general, throw
RuntimeExceptions...."
> >
> > In case of an MDB using bean managed tx, the container will not
> acknowldege
> > the message in case of a RuntimeException and hence the message will be
> > redelivered. If you handle the exception in the onMessage, the container
> > will duly acknowledge the message.
> >
> > -Saurabh
> >
> > ----- Original Message -----
> > From: "Sachin Pandey" <[EMAIL PROTECTED]>
> > To: <[EMAIL PROTECTED]>
> > Sent: Thursday, September 26, 2002 11:38 AM
> > Subject: Handling RuntimeExceptions in MDB
> >
> >
> > Hi,
> >
> >      I want to know what's the best way of handling RuntimeExceptions in
> > Message Driven Beans. Currently I have an MDB listening to a Queue. The
> > acknowledgement mode is set to AUTO_ACKNOWLEDGE. If the onMessage()
throws
> a
> > RuntimeException will the app server retry the delivery of the message.
I
> > guess that's what is happening currently with my application. If I catch
> the
> > base class Exception it works fine. I am not sure if this is the right
way
> > to do it though?
> >
> > Using JBoss 2.4.4 (JBossMQ).
> > Thanks for any suggestions.
> >
> > Sachin Pandey
> > NUIX Pty Ltd
> > Level 8, 143 York Street,
> > Sydney 2000
> > Phone: (02) 92839010
> > Fax: (02) 92839020
> >
> > Disclaimer:
> > This message is intended only for the named recipient. If you are not
the
> > intended recipient you are notified that disclosing,copying,
distributing
> or
> > taking any action in reliance on the contents of this information is
> > strictly prohibited.
> >
> >
>
===========================================================================
> > To unsubscribe, send email to [EMAIL PROTECTED] and include in the
> body
> > of the message "signoff EJB-INTEREST".  For general help, send email to
> > [EMAIL PROTECTED] and include in the body of the message "help".
>
>
===========================================================================
> To unsubscribe, send email to [EMAIL PROTECTED] and include in the
body
> of the message "signoff EJB-INTEREST".  For general help, send email to
> [EMAIL PROTECTED] and include in the body of the message "help".
>

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff EJB-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

Reply via email to