MQ connection not closed and giving MQ Error-2009

Problem :

Sometimes MQ connection does not close even after calling close method. It gives us MQ Error code-2009. I found out solution for this problem after a long struggle and hit & try, so i thought to share it with everyone.

Solution :

What most people do the mistake is that they close queue connection before queue manager connection. When you close queue connection first then it made queue manager connection unavailable and open inspite of firing disconnect method on queue manager connection after queue close. IBM MQ close these open connections self but when you create connection very frequently before MQ close them and eventually it gives you 2009 error. So always close queue manager before queue connection.

Other related posts are :
Top 10 spring interview questions and their answers. Spring basic concepts.
JPA Hibernate Sequence generator generating odd ID value and IntegrityConstraintVolation exception is coming
Set datasource spring bean properties dynamically if server is not available

Please share these posts on facebook,Linkeedin,Google+,Twitter by clicking on below icons.