1 Reply Latest reply on Apr 26, 2018 4:33 AM by Miroslav Novak

    Remote JMS client on Wildfly 11

    Luca Stancapiano Expert

      I'm triing to call a remote queue from my client. Here the code:

       

       

        final java.util.Properties env = new java.util.Properties();

        env.put(javax.naming.Context.INITIAL_CONTEXT_FACTORY, "org.jboss.naming.remote.client.InitialContextFactory");

        env.put(javax.naming.Context.PROVIDER_URL, "http-remoting://127.0.0.1:8080");

        javax.naming.Context namingContext = new  javax.naming.InitialContext(env);

        namingContext.lookup("jms/queue/Questionary");

       

      When I execute the lookup I have this exception:

       

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

        at org.jboss.as.naming.ServiceBasedNamingStore.lookup(ServiceBasedNamingStore.java:106)

        at org.jboss.as.naming.NamingContext.lookup(NamingContext.java:207)

        at org.jboss.as.naming.NamingContext.lookup(NamingContext.java:193)

        at org.jboss.as.naming.NamingContext.lookup(NamingContext.java:189)

        at org.wildfly.naming.client.remote.RemoteServerTransport.handleLookup(RemoteServerTransport.java:185)

        at org.wildfly.naming.client.remote.RemoteServerTransport$1.handleMessage(RemoteServerTransport.java:106)

        at org.jboss.remoting3.remote.RemoteConnectionChannel.lambda$handleMessageData$3(RemoteConnectionChannel.java:430)

        at org.jboss.remoting3.EndpointImpl$TrackingExecutor.lambda$execute$0(EndpointImpl.java:926)

        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)

        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)

        at java.lang.Thread.run(Thread.java:745)

       

      The destination is created with java through the following Arquillian code:

       

        static class MessagingResourcesSetupTask implements org.jboss.as.arquillian.api.ServerSetupTask {

       

               @Override

               public void setup(org.jboss.as.arquillian.container.ManagementClient managementClient, String containerId) throws Exception {

                       org.jboss.as.controller.client.ModelControllerClient modelControllerClient = managementClient.getControllerClient();

                      org.jboss.as.test.integration.common.jms.JMSOperations jmsOperations = org.jboss.as.test.integration.common.jms.JMSOperations.getInstance(modelControllerClient);

                      jmsOperations.createJmsQueue("questionary", "java:jboss/exported/jms/queue/Questionary");

               }

       

      }

       

      The queue is created because I see it in the CLI console:

       

      [standalone@localhost:9990 jms-queue=questionary] ls

      consumer-count=0                                        expiry-address=jms.queue.ExpiryQueue                    queue-address=jms.queue.questionary                    

      dead-letter-address=jms.queue.DLQ                       legacy-entries=undefined                                scheduled-count=0                                      

      delivering-count=0                                      message-count=0                                         selector=undefined                                     

      durable=true                                            messages-added=0                                        temporary=false                                        

      entries=["java:/jboss/exported/jms/queue/Questionary"]  paused=false                                           

       

      [standalone@localhost:9990 jms-queue=questionary] pwd

      /subsystem=messaging-activemq/server=default/jms-queue=questionary

       

       

      Working with WildFly 10, the lookup succeed. Passing to WildFly 11 it throws the NameNotFoundException. What I miss?