6 Replies Latest reply on Feb 24, 2015 11:55 AM by jbertram

    Unable to access JMS resources remotely through JNDI

    wterry

      Hello all!

       

      I'm having a problem that on the surface looks to be very simple but that has had me stumped for a couple days.

       

      I'm trying to deploy a JMS Connection factory and Queue on the server with the following jndi names on Wildfly 8.1.0 :

       

      java:jboss/exported/jms/UnicsRetry for the connection factory and java:jboss/exported/queue/Create for the queue.


      This is my configuration xml bit for these two components, and from what I've been able to gather from the documentation, it looks correct:


      <connection-factory name="UnicsJmsSource">

                 <connectors>

                      <connector-ref connector-name="http-connector"/>

                 </connectors>

                 <entries>

                        <entry name="java:jboss/exported/jms/UnicsRetry"/>

                </entries>

               <compress-large-messages>false</compress-large-messages>

               <failover-on-initial-connection>false</failover-on-initial-connection>

               <use-global-pools>true</use-global-pools>

      </connection-factory>


                         <jms-queue name="CreateQueue">

                              <entry name="java:jboss/exported/queue/Create"/>

                              <durable>true</durable>

                          </jms-queue>

       

      Wildfly itself accepts these and starts up without a hitch, however when I try to access the connection factory via JNDI (with this provider url: http-remoting://localhost:8080 using the jbss naming remote client context factory) I always get a name not found exception. I went and printed out the jndi bindings for both java:global and java:jboss like so:

           context.listBindings("java:global");

       

      And I on  both cases I get this output

       

      jboss/exported/jms/UnicsRetry -- service jboss.naming.context.java.jboss.exported.jboss.exported.jms.UnicsRetry

       

      It looks like the connection factory is actually up and bound, so why is it that the lookup fails? Needless to say, I haven´t been able to try out the queue itself or the MDB I actually want to test. I thought it may have been that I had to remove the java: part of the jndi when doing the lookup like the listing showed, but it didn't work either.

       

      If it has anything to do with my problem, I had to put up these dependencies in my pom.xml to build my testing client:

       

      <dependency>

         <groupId>org.jboss</groupId>

         <artifactId>jboss-remote-naming</artifactId>

         <version>2.0.1.Final</version>

      </dependency>

      <dependency>

         <groupId>org.jboss.xnio</groupId>

         <artifactId>xnio-nio</artifactId>

         <version>3.3.0.Final</version>

      </dependency>


      Any help any kind reader could provide would be greatly appreciated, this has me pulling my hair out.

        • 1. Re: Unable to access JMS resources remotely through JNDI
          jbertram

          What lookup string are you using from the client?

          • 2. Re: Unable to access JMS resources remotely through JNDI
            wterry

            This is my connection String

             

            java:jboss/exported/jms/UnicsRetry

             

            And this is the Exception I get when I attempt the lookup:

             

            Exception in thread "main" javax.naming.NameNotFoundException: jboss/exported/jms/UnicsRetry -- service jboss.naming.context.java.jboss.exported.jboss.exported.jms.UnicsRetry

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

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

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

              at org.jboss.naming.remote.protocol.v1.Protocol$1.handleServerMessage(Protocol.java:127)

              at org.jboss.naming.remote.protocol.v1.RemoteNamingServerV1$MessageReciever$1.run(RemoteNamingServerV1.java:73)

              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)

            • 3. Re: Unable to access JMS resources remotely through JNDI
              jbertram

              I would expect such an exception if you attempted to look-up "java:jboss/exported/jms/UnicsRetry" from a remote client.  In other words, it looks to me like everything is working as it should.

               

              The problem here is your look-up string.  You shouldn't be using "java:jboss/exported/jms/UnicsRetry".  You should use "jms/UnicsRetry" instead.  As the documentation states:

              The entry declaration of a connection-factory or a pooled-connection-factory specifies the JNDI name under which the factory will be exposed.  Only JNDI names bound in the "java:jboss/exported" namespace are available to remote clients.  If a connection-factory has an entry bound in the "java:jboss/exported" namespace a remote client would look-up the connection-factory using the text after "java:jboss/exported".  For example, the "RemoteConnectionFactory" is bound by default to "java:jboss/exported/jms/RemoteConnectionFactory" which means a remote client would look-up this connection-factory using "jms/RemoteConnectionFactory".

              • 4. Re: Unable to access JMS resources remotely through JNDI
                wterry

                Oh? Is it not a remote invocation if it is done from outside Wildfly? As in, since this is a standalone client or, what I'm actually setting this up for, a Mule JMS connector running on a standalone Mule installation (albeit on the same machine) shouldn't it need the remote sort of JNDI?

                • 5. Re: Unable to access JMS resources remotely through JNDI
                  jbertram

                  If the look-up is done from outside Wildfly then yes, it is considered a remote invocation which means you're resources on the server should use the "java:jboss/exported" namespace.  It looks to me like you've set that up correctly.

                   

                  What you haven't done correctly (and what I pointed out in my previous comment) is use the proper look-up string from your remote client.  You're trying to use the "java:jboss/exported" namespace from the remote client which is wrong.  I'll quote the documentation again:

                  If a connection-factory has an entry bound in the "java:jboss/exported" namespace a remote client would look-up the connection-factory using the text after "java:jboss/exported".

                  As I stated before, you should use "jms/UnicsRetry" from your remote client if the server is using <entry name="java:jboss/exported/jms/UnicsRetry"/>.

                  • 6. Re: Unable to access JMS resources remotely through JNDI
                    jbertram

                    BTW, the same is true for queues.