• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Useful points on exceptions in ejb 2.0

 
Alex Sharkoff
Ranch Hand
Posts: 209
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
Valentin Crettaz
Gold Digger
Sheriff
Posts: 7610
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Cool complement to my cheatsheet on exceptions handling.
Thanks Alex
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic