activemq-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "James Strachan" <james.strac...@gmail.com>
Subject Re: Why cannot get Destination
Date Sat, 12 May 2007 02:26:52 GMT
On 5/11/07, Jiang <zju_jjc@163.com> wrote:
>
> I add one topic(name is Hello) use jmx . And I can see the topic through
> jconsole. But when I use code below to get the destination :
>
> Hashtable env = new Hashtable();
> env.put(Context.INITIAL_CONTEXT_FACTORY,
> "org.apache.activemq.jndi.ActiveMQInitialContextFactory");
> env.put(Context.PROVIDER_URL, "tcp://localhost:61616");
> Context ctx = new InitialContext(env);
> Destination des = (Destination)ctx.lookup("Hello");
>
> It throught Exception like :
>                 javax.naming.NameNotFoundException: Hello
>         at
> org.apache.activemq.jndi.ReadOnlyContext.lookup(ReadOnlyContext.java:215)
>         at javax.naming.InitialContext.lookup(Unknown Source)
>         at JndiTest.start(JndiTest.java:36)
>         at JndiTest.main(JndiTest.java:74)
>
> Why I can see the topic but cannot lookup it ???

You don't add topics to JNDI via JMX, you do it by using JNDI
explicitly yourself or by editing the jndi.properties file
http://activemq.apache.org/jndi-support.html
-- 
James
-------
http://macstrac.blogspot.com/

Mime
View raw message