paul
paul

Reputation: 13471

Topic and queue with the same name, classcastexception

my question is, using ActiveMQ can we have a topic and queue with the same name for jndi?.

I have both defined with the same name, and when I try to create a queue with lookup I´m receiving this exception.

  java.lang.ClassCastException: org.apache.activemq.command.ActiveMQTopic cannot be cast to javax.jms.Queue

Upvotes: 0

Views: 883

Answers (1)

Petter Nordlander
Petter Nordlander

Reputation: 22279

While you can actually have a topic and queue with the same name you cannot share a JNDI name between a topic and a queue. A JNDI name makes you lookup a single object (queue or topic).

So - make sure you have JNDI entries with unique names.

queue.MyQueue = samePhysicalName
topic.MyTopic = samePhysicalName

Although I think it's bad practice to share names, since it's harder to document, trouble shoot etc etc.

Upvotes: 1

Related Questions