[jboss-user] [JNDI and Naming] - Creating a queue and ConnectionFactory

R S do-not-reply at jboss.com
Sat Oct 20 18:25:06 EDT 2012

R S [https://community.jboss.org/people/rsmrsmrsm] created the discussion

"Creating a queue and ConnectionFactory"

To view the discussion, visit: https://community.jboss.org/message/769814#769814


if I create a queue with the command
[standalone at localhost:9999 /] jms-queue add --queue-address=TestQ --entries=queue/TestQ --durable=false
I can't find this queue with InitialContext().lookup("queue/TestQ")

I get the error javax.naming.NameNotFoundException: queue/TestQ -- service jboss.naming.context.java.*jboss.exported.queue.TestQ*

So, my approach was to register the queue as
jms-queue add --queue-address=TestQ --entries=jboss/exported/queue/TestQ --durable=false

As next, I have to look up the ConnectionFactory. The ConnectionFactory can be found on the JBoss admin site with the address *java:/ConnectionFactory* 
So, I look up for the factory as InitialContext.lookup("/ConnectionFactory") and get the error javax.naming.NameNotFoundException: ConnectionFactory -- service jboss.naming.context.java.jboss.exported.ConnectionFactory

My question is: Why I can't find the factory with "/ConnectionFactory", as the factory can be found on the admin site with the address java:/ConnectionFactory? What to do to solve the problem?

By the way, after registering the queue as "jboss/exported/queue/TestQ" the queue can not be found on the jboss admin site on the JNDI view - but the lookup code seems to work. As contrast, if I add the queue as "queue/TestQ", the queue is visible on JNDI view - but the lookup code doesn't work.

Thank you for helping.

Reply to this message by going to Community

Start a new discussion in JNDI and Naming at Community

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20121020/01e8dc5e/attachment-0001.html 

More information about the jboss-user mailing list