dcsimg
MyException becomes RemoteException
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Alan_Parker
Posted On:   Monday, March 25, 2002 04:32 AM

HI I have the following problem: I have a controller stateful session bean A that calls a BMP steteful entity bean B. I would like to raise an exception in B ejbCreate() method, allowing A to know that some parameter passed to A is incorrect. That exception should be passed to A and finally to the client. So I code my exception like this: public class MyException extends Exception implements java.io.Serializable {....} This works fine if I throw it from A to the client. But when I throw it in B I got a RemoteException in A instead of MyException. Why ? Whatt am I missing ? (I'm using JBoss)    More>>

HI

I have the following problem:

I have a controller stateful session bean A that calls a BMP steteful entity
bean B.

I would like to raise an exception in B ejbCreate() method, allowing A to
know that some parameter passed to A is incorrect.

That exception should be passed to A and finally to the client.
So I code my
exception like this:



public class MyException extends Exception
implements java.io.Serializable

{....}



This works fine if I throw it from A to the client. But when I throw it in B
I got a RemoteException in A instead of MyException.

Why ? Whatt am I missing ? (I'm using JBoss)



Many thanks

Alan

   <<Less

Re: MyException becomes RemoteException

Posted By:   Bozidar_Dangubic  
Posted On:   Monday, March 25, 2002 05:48 AM

you must declare that a method in B throws MyException. otherwise it will be wrapped in RemoteException. if exception is thrown that is not in the throws list, it is automatically send back to the client as RemoteException. therefore, you must declare that a method throws MyException.
About | Sitemap | Contact