无法从与另一个主题同名的InitialContext队列中查找 [英] Cannot Lookup from InitialContext Queue that has same name with another Topic

查看:145
本文介绍了无法从与另一个主题同名的InitialContext队列中查找的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这行代码会产生异常

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]

背景信息:

  • 我尝试使用另一个队列名称,并且工作正常.

  • 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?

推荐答案

如果在TIBCO中配置了具有相同名称的主题和队列,则可以添加$queues.$topics.前缀,它应该可以工作,例如:

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

这篇关于无法从与另一个主题同名的InitialContext队列中查找的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆