1 Reply Latest reply on Oct 21, 2012 5:51 AM by rsmrsmrsm

    Creating a queue and ConnectionFactory

    rsmrsmrsm

      Hi,

       

      if I create a queue with the command

      [standalone@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.