6 Replies Latest reply on Apr 9, 2013 11:14 AM by petal1

    Queue lookup failing (because it is not being created)

    petal1

      Hello,

       

      I'm struggling with the configuration of HornetQ. I am migrating from JBoss4.0.4.GA (which had JBoss MQ) to JBoss6.0.0.Final with HornetQ.

      I had an issue last week where the lookup of a queue was failing. I noticed on my old JBoss4.0.4 machines that a netstat -an showed:

       

          Proto  Recv-Q Send-Q Local Address           Foreign Address         State

          tcp              0          0  0.0.0.0:1099             0.0.0.0:*               LISTEN

       

      but on JBoss6 showed:

       

          Proto  Recv-Q Send-Q Local Address           Foreign Address         State

          tcp              0          0  127.0.0.1:1099             0.0.0.0:*               LISTEN

       

      I changed the JBoss startup command to include "-b 0.0.0.0" and my lookup (from an external Java client program running on the same machine) was successful.

       

      Today, I restarted JBoss (again with "-b 0.0.0.0") and the lookup fails - javax.naming.NameNotFoundException: MyQueue not bound. Sure enough I cannot see the queue in admin-console. I'm not sure what's different - why are my queues and topics not being created when JBoss starts? I have a file deploy/hornetq/myqueues-hornetq-jms-service.xml with the following contents:

       

          <configuration xmlns="urn:hornetq"

                     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

                     xsi:schemaLocation="urn:hornetq /schema/hornetq-jms.xsd">

       

              <queue name="MyQueue">

                  <entry name="/queue/MyQueue"/>

              </queue>

       

          </configuration>

       

      and my java jndi lookup program is:

       

          env.put (javax.naming.Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");

          env.put (javax.naming.Context.URL_PKG_PREFIXES, "org.jboss.naming:org.jnp.interfaces");

          env.put (javax.naming.Context.PROVIDER_URL, "jnp://localhost:1099");

       

          context = new InitialContext(env);

          Object o = context.lookup("queue/MyQueue");

       

      Can anyone please tell me why I have seen the inconsistent behaviour, and what is wrong with the hornetq configuration - because from what I've seen having the config file present should be enough to have the queue created when JBoss is started.

       

      Thanks,

      Paul