Exception Handling In Ejb

ADVERTISEMENT

Exception Handling in EJB 2.0
Notes:
Definitions (in the context of EJB)
system exception – does not allow the method to successfully complete
o
application exception – does not automatically cause the Container to rollback the transaction
o
checked exception – not a subclass of RuntimeException
o
Application Exceptions
must be checked exceptions
o
must not subclass RuntimeException/RemoteException
o
Txn is short for transaction
Research?
o
There is a java.lang.IllegalStateException and javax.jms.IllegalStateException
About the headings:
runtime – is this a runtime exception or checked exception?
o
system – is this a system exception or application exception?
o
o
remote – is this a remote or local exception?
who throws this – bean, container, or both?
o
Exception
Package
Runtime?
System?
Remote?
Parent?
Who throws?
Comments
AccessException
java.rmi
N
Y
Y
RemoteException
Container
Caller does not have permission to call method
IIOP: map to NO_PERMISSION 19.5.3
AccessLocalException
javax.ejb
Y
Y
N
EJBException
Container
Caller does not have permission to call method
CreateException
javax.ejb
N
N
N
Exception
Both
Create/postCreate methods 10.5.8.1
ejbCreate/ejbPostCreate methods 10.6.5
DuplicateKeyException
N
N
N
CreateException
Both
Attempt to create duplicate entity 10.5.8.2
EJBException
javax.ejb
Y
N
RuntimeException
Both
Unexpected error 18.4.2
Attempted loopback to local interface, re-entrant
false 10.5.11
FinderException
javax.ejb
N
N
N
Exception
Both
Finder methods in home interface 10.5.8.3
IllegalArgumentException
java.lang
Y
Y
N
RuntimeException
Container
Attempt to assign removed entity as value of cmr-
field of another object 10.3.4.1
Argument to set accessor not same type as cmr-
field 10.3.6
IllegalStateException
java.lang
Y
Y
N
RuntimeException
Container
Access to context methods not allowed 7.6.1
Illegal use of set/getRollbackOnly 7.6.1
Reset primary key value 10.3.6
JMSException
javax.jms
N
N
Exception
Container
Spec recommends container throw this if EJBs call
any of the methods in this section 24.2.6
InvalidTxnException
javax.txn
N
Y
Y
RemoteException
Container
Invalid transaction context
IIOP: map to INVALID_TRANSACTION 19.5.3
MarshalException
java.rmi
N
Y
Y
RemoteException
Container
IIOP: map to MARSHAL 19.5.3
Eileen Sauer, Volantec.biz – eileen@volantec.biz
Page 1

ADVERTISEMENT

00 votes

Related Articles

Related forms

Related Categories

Parent category: Education
Go
Page of 2