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

Handle Exceptions in MDB (EJB) [how to handle the exceptions control before coming to MDB ]

 
veera naga
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I was written a simple MessageListener(MDB) it is working fine.How to handle runtime exceptions in this.

[Ex: if was try to deploy this listener with a wrong queue name like "XXXX" instead of right one that time it is showing Exceptions and moreover deployment failure also coming.]

So how to avoid this type of Exceptions is there any EJB Annotations are available ?

And I tried to handle inside the below Class(ORANGE_QUEUE_MDB). But the control is not coming to inside . Please help me how to solve this type of Errors.





When I deploy above listener(with wrong queue name) in Jboss it is showing below exception The Exception is like below :



How to handle this type of exceptions , Can any one help me on this.
Thanks,
VeeraNaga
 
Ranganathan Kaliyur Mannar
Bartender
Posts: 1103
10
Java Netbeans IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi veera,
Welcome to the Ranch!

Please UseCodeTags when posting code.

First of all, why does your MDB extend RuntimeException? That doesn't make sense to me and is a poor programming practice.

As far as this exception goes, it says that the particular queue is not present. If you look at the end of the trace, you can find a compcode and reasonCode - which will explain more about the issue. In this case, it also says "MQRC_UNKNOWN_OBJECT_NAME". You are trying to connect to a WebSphere MQ and it says this queue is not found.

Also, in the code you have queue name as "ORANGE.QUEUE", but your exception trace shows "Failed to open MQ queue 'OORANGE.QUEUE'.** ". Are you sure you have given the correct queue name in the code? Can you check if there is a typo?
 
veera naga
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Ranganathan,

Thanks for your reply and you valuable suggetions.

Well my class is extending RuntimeException , it's my problem i was posted wrongly.(it should not happen again)

And In my MDB program my Queue name(also same as my target Queue name) is : ORANGE.QUEUE .
If i intentionally give wrong Queue name in my MDB like :

And if i deploy above application in my Jobss it is showing Exceptions immediately on server console (like i posted above) and failed to deploy the application.

but My Intention is to deploy the ejb mdb eventhough when i give wrong Queue name (or) Queue server is not available.


Thanks,
VeeraNaga
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic