When you throw a SYSTEM Exception in EJB, like an EJBException, a
RemoteException or a subclass of RuntimeException, as per the EJB-CORBA
mappings this is marshalled over IIOP as a CORBA UNKNOWN. During this
marshalling the message String filed of the EJBException is truncated due to
the CORBA UNKNOWN exception having no matching member to marshall this in.
In Sybase EAServer we replace this missing String field on the client with a
toString() of the UNKNOWN. So in your case, I believe this is working
properly. On the client you are catching the RemoteException, just that to
toString() is returning the message field.
You need to understand that a SYSTEM Exception is like the EJB equivlant of
a GPF. If you need an exception to marshall which contains things like
message fields, etc, use an APPLICATION Exception.
Dave Wolf
Internet Applications Division
Sybase
----- Original Message -----
From: "Hrair Karaboyadjian" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, February 23, 2001 2:48 AM
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".