Cannot Lookup from InitialContext Queue that has same name with another Topic

1.1k views Asked by At

This line of code produces an exception

Queue queue = (Queue) initialCtx.lookup("sample");

javax.naming.CannotProceedException: Name 'sample' is ambiguous: both a topic and a queue exist
at com.tibco.tibjms.naming.TibjmsContext.lookup(TibjmsContext.java:715)[tibjms-4.4.3.jar:4.4.3]
at com.tibco.tibjms.naming.TibjmsContext.lookup(TibjmsContext.java:489)[tibjms-4.4.3.jar:4.4.3]
at javax.naming.InitialContext.lookup(InitialContext.java:392)[:1.6.0_45]

Background info:

  • I have tried with another queue name, and it works fine.

  • The problem with this "sample" queue is there is another topic with exactly the same name

Is there any way to work around this?

1

There are 1 answers

0
Tomasz Rebizant On

If you have configured topic and queue with the same name in TIBCO, you can add $queues. or $topics. prefix and it should work, example :

initialCtx.lookup("$queues.sample")