问题
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