Hrair,
This is an explanation that was described to by Dave Wolf. This is expected
and as per the EJB1.1 and EJB-CORBA specifications. You need to understand
the difference between SYSTEM and APPLICATION exceptions. SYSTEM exceptions
map to a CORBA UNKNOWN as per the spec. The CORBA UNKNOWN has no room for a
message field so it is lost. This is not really an issue as SYSTEM
exceptions represent major catastrophic failures of the system. Think of
them like the EJB version of a GPF. The container does some horribly
drastic things when you throw a SYSTEM Exception like
(1) Rollback every pending transaction
(2) Destroy the beans instance! In other words in a stateful bean when you
throw this the bean is totally destroyed and the client cant use it anymore.
In a stateless on its not pooled.
SYSTEM exceptions like RemoteException, EJBException or any subclass of
java.lang.RuntimeException (say NullPointerException) should be saved for
only the most catastrophic or totally unexpected situations. Instead you
should be using a standard APPLICATION exception.
Jay Wagner
Sybase Inc.
-----Original Message-----
From: Hrair Karaboyadjian [mailto:[EMAIL PROTECTED]]
Sent: Friday, February 23, 2001 2:48 AM
To: [EMAIL PROTECTED]
Subject: Re: Custom Application Exceptions [ Was: no subject ]
In My EJB code I was trying to throw an EJBException instead of Custom one,
although I added to 'throws' clause in the remote interface
javax.ejb.EJBException, it still not working properly and I get CORBA
UNKNOWN 0.
I don't know why this is happening, and how can I throw an Exception from
my
EJB.
Maybe a small sample would be appreciated.
Thank you
Hrair K.
-----Original Message-----
From: A mailing list for Enterprise JavaBeans development
[mailto:[EMAIL PROTECTED]]On Behalf Of Perryn Fowler
Sent: Friday, February 23, 2001 7:59 AM
To: [EMAIL PROTECTED]
Subject: Custom Application Exceptions [ Was: no subject ]
You certainly can - as is covered in the EJB spec
section 12.2.1
your problem is that you need to specify your
exception
in the throws clause of your remote interface. The
container will catch EJBExceptions and throw
RemoteExceptions in their place but it will pass your
application exception straight through so it needs to
be in the remote interface.
(Im surprised you were able to deploy the bean)
cheers
Perryn
>Hi, I have a question about Exception catching in
>EJB. How can I throw a
>custom Exception from my EJB?
<SNIP>
__________________________________________________
Do You Yahoo!?
Yahoo! Auctions - Buy the things you want at great prices!
http://auctions.yahoo.com/
===========================================================================
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".