2 Replies Latest reply on Sep 12, 2016 9:41 AM by notify

    ActiveMQ - Can't find Queue

    notify

      Last time I used JMS it was with HornetQ and it worked fine. Now when trying with ActiveMQ I can't get it to work:

       

      Have configured a queue in WildFly 10.0.0 via the Management Interface and start using "standalone-full.xml"

       

      Name: AffiliateWindowQueue

      JNDI Names: java:/jms/queue/AffiliateWindowQueue

       

      When I try and lookup the queue:

       

      public final static String JMS_QUEUE_JNDI = "jms/queue/AffiliateWindowQueue";

       

      try {

         queue = (Queue) ctx.lookup(JMS_QUEUE_JNDI);

      } catch (NamingException e) {

        System.out.println(">>>>> NamingException = " + e);

      }

       

      I get:

       

      >>>>> 4 javax.naming.NameNotFoundException: jms/queue/AffiliateWindowQueue -- service jboss.naming.context.java.jboss.exported.jms.queue.AffiliateWindowQueue

      Exception in thread "main" java.lang.UnsupportedOperationException: Cannot specify destination if producer has a default destination

        at org.apache.activemq.artemis.jms.client.ActiveMQMessageProducer.checkDefaultDestination(ActiveMQMessageProducer.java:309)

        at org.apache.activemq.artemis.jms.client.ActiveMQMessageProducer.send(ActiveMQMessageProducer.java:171)

        at com.nohagl.jms.CreateAffiliateWindowDatabase.send(CreateAffiliateWindowDatabase.java:91)

        at com.nohagl.jms.CreateAffiliateWindowDatabase.readAndSend(CreateAffiliateWindowDatabase.java:103)

        at com.nohagl.jms.CreateAffiliateWindowDatabase.main(CreateAffiliateWindowDatabase.java:130)

        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)

        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

        at java.lang.reflect.Method.invoke(Method.java:606)

        at com.intellij.rt.execution.application.AppMain.main(AppMain.java:147)

       

      Any pointers?

        • 1. Re: ActiveMQ - Can't find Queue
          jbertram

          What is your queue configuration?  My guess is that the JNDI entry is not in the "java:jboss/exported/" namespace and therefore not available to remote clients.  Remember, in Wildfly any JNDI name that needs to be accessible to a remote client needs to be in the "java:jboss/exported/" namespace and the JNDI lookup will refer to everything after the "java:jboss/exported/" prefix.

          • 2. Re: ActiveMQ - Can't find Queue
            notify

            Added "java:jboss/exported/" to Queue name in the Management Interface and I no longer get the error.

             

            Now get:

             

            Caused by: ActiveMQSecurityException[errorType=SECURITY_EXCEPTION message=AMQ119032: User: NOTiFY does not have permission='SEND' on address jms.queue.AffiliateWindowQueue]

             

            Will look at permissions for my user NOTiFY.

             

            Update - Sorted working fine now.

             

            Thanks for your help.