Bill,

The confusion probably resulted because it wasnt clear you were talking
about
ejbStore(). As I understand it the comments about application exceptions
are all correct, but an ejbStore() should never throw an app exception.

basically any changes to the state of the bean should be validated in the
business method that made them - if this has been done successfully and you
then have
a problem storing that info it means that the synchronization between the
bean and the db has somehow gone awry and that is considered a system error.
(and therefore should result in rollback, discard instance etc )

-----Original Message-----
From: Bill Pfeiffer [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, 15 January 2002 15:55
To: Olaf Strozyk; JBoss-User
Subject: Re: [JBoss-user] Passing Business Exception to Client


OK, now I'm confused.  Using JBoss 2.4.4, how do I correctly return
application level errors from my entity bean's ejbStore method?  Do I throw
my own exception?  Does this exception extend RemoteException, Exception?
Since ejbStore actually overrides its ancestor's method, how do I declare
that my own exception will be thrown?  If I don't declare it as being
thrown, I get a compile time error.

Thanks for any clarity on this issue,

Bill Pfeiffer
----- Original Message -----
From: "Olaf Strozyk" <[EMAIL PROTECTED]>
To: "danch" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Monday, January 14, 2002 7:28 PM
Subject: Re: [JBoss-user] Passing Business Exception to Client


> danch wrote:
> > EJBException is actually a runtime exception that you use to complain to
> > the container when something _really_ wacky happens that you want to
> > call a system error. The EJB spec defines a business exception (AKA
> > Application Exception) as a different category of exception, with
> > different behavior.
> >
> > To throw a business exception, define separate classes for them,
> > extending RemoteException, then replace your 'throws EJBException'
> > declaration with your newly defined exception.
>
> Hi,
>
> sorry to interfere, but let me help out with a "not". The above has to
> be "_not_ extending RemoteException".
>
> See the spec (Enterprise JavaBeans 2.0, Final Release, 18.1.1):
> "An application exception class must be a subclass (direct or indirect)
> of java.lang.Exception. An application exception class must not be
> defined as a subclass of the java.lang.RuntimeException or of the
> java.rmi.RemoteException."
>
> -Olaf
>
> > the biggest difference in the container's behavior (aside from passing
> > the proper exception back to the client) is that when you throw an
> > EJBException, the container marks your transaction Rollback-only, while
> > it _doesn't_ for application exceptions. If you want your transaction
> > rolled back, you'll need to call setRollbackOnly yourself (on the
> > session context).
> >
> > -danch
> >
> > Bill Pfeiffer wrote:
> >
> > > I am having a problem with JBoss 2.4.4 and Tomcat 4.0.1.  When I
> > > encounter a business logic problem (or sql problem, etc) and want to
> > > send it back to the client, I create and throw an EJBException.  The
> > > problem I am encounter is that I actually recieve, on the client
> > > (Tomcat) end, an UndeclaredThrowableException which contains no info
on
> > > the original error.
> > >
> > >
> > >
> > > Probably related is the fact that I get these warnings when deploying
my
> > > beans:
> > >
> > >
> > >
> > > ------------------------------------------------------
> > >
> > > [ERROR,ContainerFactory]
> > > Bean   : EBSecurityUser
> > > Method : public abstract String getPassword() throws RemoteException,
> > > EJBExcepti
> > > on
> > > Section: 9.2.7
> > > Warning: The exceptions thrown by methods in the remote interface must
> > > be valid
> > > types for RMI/IIOP
> > >
> > >
> > >
> > > [ERROR,ContainerFactory]
> > > Bean   : SBWebSessMgr
> > > Method : public abstract SBWebSessMgr create() throws CreateException,
> > > EJBExcept
> > > ion, RemoteException
> > > Section: 6.10.6
> > > Warning: The method return values in the home interface must be of
valid
> > > types f
> > > or RMI/IIOP.
> > >
> > >
> > >
> > > [ERROR,ContainerFactory]
> > > Bean   : SBEspeedUtility
> > > Method : public abstract SBCaseLockHome getSbCaseLockHome() throws
> > > RemoteExcepti
> > > on
> > > Section: 6.10.5
> > > Warning: The method return values in the remote interface must be of
> > > valid types
> > >  for RMI/IIOP.
> > >
> > > ---------------------------------------
> > >
> > >
> > >
> > >
> > >
> > > It appears the I am not returning throwing valid types for RMI/IIOP.
> > > Any ideas what would cause this?  What  constitutes a valid RMI/IIOP
> > > type or what would cause my objects not be considered valid RMI/IIOP
types?
> > >
> > >
> > >
> > > Thanks for any assistance,
> > >
> > >
> > >
> > > Bill Pfeiffer
> > >
> >
> > _______________________________________________
> > JBoss-user mailing list
> > [EMAIL PROTECTED]
> > https://lists.sourceforge.net/lists/listinfo/jboss-user
>
> _______________________________________________
> JBoss-user mailing list
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/jboss-user


_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user

_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to