File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes EJB Certification (SCBCD/OCPJBCD) and the fly likes MDB ejbCreate And createException Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » EJB Certification (SCBCD/OCPJBCD)
Bookmark "MDB ejbCreate And createException" Watch "MDB ejbCreate And createException" New topic

MDB ejbCreate And createException

Rashmi Tambe
Ranch Hand

Joined: Aug 07, 2001
Posts: 418
can an ejbCreate() method in MDB throw CreateException? What happens if it does throw? If it's not allowed , then why not? can anybody explain....
Yi Si
Ranch Hand

Joined: Nov 12, 2003
Posts: 54
You can not throw CreateException in ebjCreate() methods of MDB , session bean and entity bean.the mothods its name begin with "ejb" invoked by container,container does expect get application exception such as CreateException .But you can throw CreateException in Create() methods of session bean and entity bean home interface, but not MDB.beasause MDB have not client, if you throw one, who will receive it.(MDB have not Home interface and component interface.)
[ March 04, 2004: Message edited by: si yi ]

Sun(java)-SCJA SCJP SCWCD SCBCD SCDJWS SCEA<br />Sun(solaris)-SCSA SCSN<br />IBM-486 Object-Oriented Analysis and Design with UML Test <br />IBM Certified System Administrator - WebSphere Application Server Network Deployment V6.0<br />Oracle-OCA
Sudhir V
Ranch Hand

Joined: Dec 25, 2002
Posts: 143
Hi Si
CreateExceptions are allowed to be thrown from ejbCreate methods of session and entity beans but not from MDB beans. See EJB Spec Pg 96 7.10.3.

Sudhir V<br />(SCJP 1.2, SCWCD, OCA, SCBCD)
Reid M. Pinchback
Ranch Hand

Joined: Jan 25, 2002
Posts: 775
Also spec section 15.7.3 page 324 - you aren't supposed to even declare any application exception on the ejbCreate for an MDB.

Reid - SCJP2 (April 2002)
I agree. Here's the link:
subject: MDB ejbCreate And createException
It's not a secret anymore!