Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

handling exceptions in MDBs

 
Ashish Sarin
author
Ranch Hand
Posts: 444
10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What is the best way to handle exception in MDBs? They should be caught and thrown as RemoteException ? they should be caught and thrown as EJBException? or they should be handled somehow in the bean code itself ? Or there is any other way to handle exceptions in case of MDBs?
regards
ashish sarin
scjp,scjd,scwcd,scbcd,scea(part i),ibm-xml
 
Pradeep bhatt
Ranch Hand
Posts: 8933
Firefox Browser Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
RemoteException does not make sense since there is no remote client. If you cannot handle an Exception, then spec suggests that an EJBException be thrown.
 
Brian Nice
Ranch Hand
Posts: 195
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If it is an Exception that the client really is concerned about, the MDB can catch the exception and perhaps put some message on another queue that the client can listen to. If a message appears on the "Error" queue, than it can get some ID out of the message so it can somehow relate it to the original message and get the error. Of course good logging is very helpful too.
Brian
 
Sivasundaram Umapathy
Ranch Hand
Posts: 360
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I would opt for logging to a persistent store for notifying the admin.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic