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

大城市里の小女人 提交于 2019-12-11 23:12:27

问题


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:


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")


来源:https://stackoverflow.com/questions/20233583/cannot-lookup-from-initialcontext-queue-that-has-same-name-with-another-topic

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!