Description
I create my queue using the JNDI properties, and when I try to create a queue browser from the Destination object, I get the
java.lang.ClassCastException: org.apache.qpid.client.AMQAnyDestination cannot be cast to org.apache.qpid.client.AMQQueue
at org.apache.qpid.client.AMQSession.createBrowser(AMQSession.java:963)
at org.apache.qpid.client.AMQSession.createBrowser(AMQSession.java:950)
A sample code snippet is below; (just to give an idea).
Properties properties = new Properties();
String queueAddress = "T1;{create: always , node : {type : queue, durable : true}}"
properties.put("destination.T1", queueAddress);
InitialContext ctx = new InitialContext(properties);
Destination queue = (Destination) ctx.lookup(queueName);
QueueBrowser queueBrowser = qpidSession.createBrowser(queueRef);
triggers =>
java.lang.ClassCastException: org.apache.qpid.client.AMQAnyDestination cannot be cast to org.apache.qpid.client.AMQQueue
at org.apache.qpid.client.AMQSession.createBrowser(AMQSession.java:963)
at org.apache.qpid.client.AMQSession.createBrowser(AMQSession.java:950)
The createBrowser call is part of JMS. However this part of the API cannot
be used with Destinations defined using the addressing scheme.