1 Reply Latest reply on Dec 27, 2015 2:35 PM by ggam

    Remote JNDI entry binding in Naming Subsystem

    ggam

      Hi,

       

      I have an application deployed on one WildFly server that needs to access a remote JMS Topic on another WildFly. I'd like to use resource injection and standard JMS activation properties for an MDB.

       

      What I've currently done is: I've exported the topic (java:jboss/exported/MyTopic) and the RemoteConnectionFactory and I've configured an object factory on the "client" server, pointing to the remote objects.

       

      I know one can create an external initial context form the Naming subsystem, but that only allows me for InitialContext injection. I need to do directly lookup on that InitialContext. It is theoretically possible based on [WFLY-1727] Allow injection of resources from external JNDI contexts - JBoss Issue Tracker but it didn't work for me, and anyway, it would only work for the @Resource injection, while I also need it for the ConnectionFactoryLookup property on the MDB.

       

      The Naming Subsystem allows creation of alias entries, but as far as I see, you can only do lookups based on the local JDNI. Is there any way I can point it to an specific ExternalContext?

       

      Thanks in advance and Merry Christmas!

        • 1. Re: Remote JNDI entry binding in Naming Subsystem
          ggam

          I've already found the solution.

           

          A lookup can navigate through an external context. My working configuration is now:

           

                  <subsystem xmlns="urn:jboss:domain:naming:2.0">

                          <bindings>

                              <external-context name="java:/global/mqserver" module="org.jboss.as.naming" class="javax.naming.InitialContext" cache="true">

                                  <environment>

                                      <property name="java.naming.factory.initial" value="org.jboss.naming.remote.client.InitialContextFactory"/>

                                      <property name="java.naming.provider.url" value="http-remoting://localhost:8290"/>

                                      <property name="java.naming.security.principal" value="remote"/>

                                      <property name="java.naming.security.credentials" value="remote"/>

                                  </environment>

                              </external-context>

                              <lookup name="java:global/ExportedTopic" lookup="java:/global/mqserver/jms/topic/prueba"/>

                              <lookup name="java:global/ExportedFactory" lookup="java:/global/mqserver/jms/RemoteConnectionFactory"/>

                          </bindings>

                          <remote-naming/>

                      </subsystem>

           

          Obviously, the remote server needs to have the entries exported.