aspose file tools*
The moose likes EJB Certification (SCBCD/OCPJBCD) and the fly likes Useful points on exceptions in ejb 2.0 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Certification » EJB Certification (SCBCD/OCPJBCD)
Bookmark "Useful points on exceptions in ejb 2.0" Watch "Useful points on exceptions in ejb 2.0" New topic
Author

Useful points on exceptions in ejb 2.0

Alex Sharkoff
Ranch Hand

Joined: Apr 11, 2004
Posts: 209
Hi all,

Just thought that the following points in regards to the exceptions could be useful for the exam preparations:

1. When a session or entity bean call getEJBHome/getEJBObject on SessionContext/EntityContext and the bean does not have a remote interface defined - Container throws java.lang.IllegalStateException

2. When a session or entity bean call getEJBLocalHome/getEJBLocalObject on SessionContext/EntityContext and the bean does not have a local interface defined - Container throws java.lang.IllegalStateException

3. Client gets RemoveException when
a. remove() is called on SFSB that is in a transaction (BMT sfsb)
b. remove(Object pk) is called on a session bean remote/local home intf
c. application level error occurred in ejbRemove() method of the entity bean

4. Client gets a RemoteException when calls getPrimaryKey() on session bean's remote component interface.
Client gets a EJBException when calls getPrimaryKey() on session bean's local component interface

5. Client gets a RuntimeException when extracts EJBMetaData from session bean's remote home interface and calls EJBMetaData#getPrimaryKey()

6. Container throws IllegalStateException when bean calls methods on EJBContext that are not allowed (eg, getEJBObject() from setSessionContext()) or when tried to reset pk, or when performing prohibited operation on java.util.Collection API that represents a cmr-field)

7. When a bean attempts to access a resource manager or other beans and the access is not allowed (accessing a resource in ejbActivate() of entity bean) the behaviour is undefined by ejb spec




[ July 03, 2004: Message edited by: Alex Sharkoff ]

[ July 03, 2004: Message edited by: Alex Sharkoff ]
[ July 05, 2004: Message edited by: Alex Sharkoff ]

Alex (SCJP 1.4, SCBCD 1.3, SCWCD 1.4, SCJD 1.4)
Valentin Crettaz
Gold Digger
Sheriff

Joined: Aug 26, 2001
Posts: 7610
Cool complement to my cheatsheet on exceptions handling.
Thanks Alex


SCJP 5, SCJD, SCBCD, SCWCD, SCDJWS, IBM XML
[Blog] [Blogroll] [My Reviews] My Linked In
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Useful points on exceptions in ejb 2.0