Cause: When creating a QueueBrowser with a destination created using an addressing string a java.lang.ClassCastException is thrown.
Consequence: The application is unable to create QueueBrowser from destinations created using an addressing string. The workaround was to create a Queue using session.createQueue method passing an address string.
Fix: The createBrowser method has been modified to avoid doing the unnecessary cast to AMQQueue object, as this doesn't work with the AMQAnyDestination object created by the jndi queue creation model. The code is now modified to work with the javax.jms.Queue interface instead of the concrete implementation.
Result: The createBrowser method is now able to create a QueueBrowser from a destination created using an address string(if it implements the Queue Interface).
Longer term, it might be nicer to deprecate the older addressing scheme, and stick to the new one. Also, it will be nicer to have a common queue creation code, not a separate path, when created using jndi, and when created using session.createQueue(). Since I'm newer to this project I don't have great expertise, about the reason to different models. It'd be great if someone can throw some light about this.