aspose file tools*
The moose likes EJB and other Java EE Technologies and the fly likes Handle Exceptions in MDB (EJB) [how to handle the exceptions control before coming to MDB ] Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "Handle Exceptions in MDB (EJB) [how to handle the exceptions control before coming to MDB ]" Watch "Handle Exceptions in MDB (EJB) [how to handle the exceptions control before coming to MDB ]" New topic
Author

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

veera naga
Greenhorn

Joined: Sep 11, 2012
Posts: 3
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

Joined: Oct 16, 2003
Posts: 1083
    
  10

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?


Ranga.
SCJP 1.4, OCMJEA/SCEA 5.0.
veera naga
Greenhorn

Joined: Sep 11, 2012
Posts: 3
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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Handle Exceptions in MDB (EJB) [how to handle the exceptions control before coming to MDB ]