10 Replies Latest reply on Aug 17, 2017 5:34 AM by Miroslav Novak

    Why Won't This Code Obtain a JMS ConnectionFactory?

    George Berish Novice

      I’ve failed for over a week to learn enough JBoss/Wildfly 10 to write a java class that could obtain a JMS connection to Wildfly. Help!

       

      The class is executed on Eclipse running on the same computer as Wildfly. (technically it’s a remote connection?)

       

      The error is:

      javax.naming.CommunicationException

      Failed to connect to any server.

      Servers tried: [http-remoting://localhost:9990

      [OR: Servers tried: [http-remoting://localhost:8080 (depending on Context.PROVIDER_URL value in code below)]

      (java.io.IOException: Unknown service name)]

       

      I start Wildfly with this command:

      <wildfly-10.1.0.Final>\bin\standalone.bat --server-config=standalone-full.xml

       

      Wildfly command window excerpts (below) confirms there is a factory bound to jndi name:

      java:jboss/exported/jms/RemoteConnectionFactory

       

      The Wildfly console opens from http://localhost:9990

      The user ID and password shone in the code opens it

       

      I’ve pasted the CLASS CODE, ECLIPSE CONSOLE OUTPUT, and WILDFLY CONSOLE EXCERPTS below.

       

      I’m out of ideas.  Hope someone can point me in the right direction

       

      CLASS CODE

      import javax.naming.Context;

      import javax.naming.InitialContext;

      import javax.naming.NameClassPair;

      import javax.naming.NamingEnumeration;

      import java.util.HashMap;

      import java.util.Properties;

      import org.hornetq.jms.client.HornetQJMSConnectionFactory;

      import static org.america3.gotest.shared.tools.Utility.padRight;

       

      public class PostedCode {

        private Context ctx = null;

        private HornetQJMSConnectionFactory factory = null;

        private Properties ENV_LOCAL = new Properties() {

          private static final long serialVersionUID = 1L;

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

            put(Context.PROVIDER_URL, "http-remoting://localhost:9990");

         Context.PROVIDER_URL, "http-remoting://localhost:8080"); Same error

          //put(Context.PROVIDER_URL, "http://localhost:9990");  Same error

            put(Context.SECURITY_PRINCIPAL, "jmsUser"); 

            put(Context.SECURITY_CREDENTIALS, "jmsPW123!"); 

          //put("jboss.naming.client.ejb.context", true); This made no difference either 

          }

        };

        public static void main (String args[]) {

         //Instantiate instance of this class

          PostedCode test = new PostedCode ();

          // Set Wildfly Initial Context

          test.ctx = test.getInitialContetext();

          if (test.ctx == null) {

            return;

          } else {

            System.out.println("\nInitialContext not null: " + test.ctx);}

          // Print list of IntialContxt

          test.listCtx (test.ctx);

          // Set JMS ConnectionFacytory

          test.factory = (HornetQJMSConnectionFactory)test.getFactory(test.ctx);

          if (test.factory == null) {

            return;

          } else {

            System.out.println("ConnectionFactory not null: " + test.factory);

          }

        }

        //This method Instantiates a WF InitalContext.

        private Context getInitialContetext () {

          //Print properties used to Eclipse Console

          pProps(ENV_LOCAL); // Prints properties to console

          try {

            return new InitialContext(ENV_LOCAL);

          } catch (Exception e) {

            System.out.println("\ngetInitialContext() caught: " + e.getClass().getName());

            System.out.println("                    msg  :    " + e.getMessage());

            return null;

          }

        }

        //This method looks up the JMSConnectionFactory using the WF InitialContext.

        //Right now it throws an Exception.

        private HornetQJMSConnectionFactory getFactory (Context ctx) {

          try {

            return (HornetQJMSConnectionFactory) ctx.lookup("java:jboss/exported/jms/RemoteConnectionFactory");

          } catch (Exception e) {

            System.out.println("\ngetFactory() caught: " + e.getClass().getName());

            System.out.println("            msg  :    " + e.getMessage());

            e.printStackTrace();

            return null;

          }

        }

        //This method prints the properties used to get WF's InitialContext

        static private void pProps (Properties p) {

          StringBuffer sb = new StringBuffer ();

          sb.append("Properties used to obtain IntialContext"+"\n");

          for (Object key: p.keySet()) {

            String pKey = padRight ("  " + (String)key,40,' ');

            sb.append(pKey);

            sb.append("\"" + p.get(key) + "\"" + "\n");

          }

          System.out.println(sb);

        }

        //This method prints jndi bindings from WF Context.

        //Right not it throws an exception

        private void listCtx (Context ctx) {

          HashMap<String, String> map = new HashMap<String, String>();

          try {

            System.out.println("Listing InitialContext NameClassPair Enumeration:");

            NamingEnumeration<NameClassPair> list = this.ctx.list("");

            System.out.println("Enumerator: " + list);

            while (list.hasMoreElements()) {

              NameClassPair next = list.next();

              String name = next.getName();

              String jndiPath = "name: " + name;

              map.put(name, jndiPath);

            }

            System.out.println("map.size(): " +map.size());

          } catch (Exception e) {

            System.out.println("\nlistCtx(): caught: " + e.getClass().getName());

            System.out.println("          msg  :    " + e.getMessage());

          }

        }

      }

       

      ECLIPSE CONSOLE OUTPUT:

      Properties used to obtain IntialContext

        java.naming.provider.url              "http-remoting://localhost:9990"

        java.naming.factory.initial          "org.jboss.naming.remote.client.InitialContextFactory"

        java.naming.security.principal        "jmsUser"

        java.naming.security.credentials      "jmsPW123!"

      Aug 08, 2017 11:03:03 AM org.xnio.Xnio <clinit>

      INFO: XNIO version 3.4.6.Final

      Aug 08, 2017 11:03:03 AM org.xnio.nio.NioXnio <clinit>

      INFO: XNIO NIO Implementation Version 3.4.3.Final

      Aug 08, 2017 11:03:03 AM org.jboss.remoting3.EndpointImpl <clinit>

      INFO: JBoss Remoting version 4.0.7.Final

      InitialContext not null: javax.naming.InitialContext@6108b2d7

      Listing InitialContext NameClassPair Enumeration:

      listCtx(): caught: javax.naming.CommunicationException

                msg  :    Failed to connect to any server. Servers tried: [http-remoting://localhost:9990 (java.io.IOException: Unknown service name)]

                <OR: msg  :    Failed to connect to any server. Servers tried: [http-remoting://localhost:9990 (java.io.IOException: Unknown service name)]>

       

      getFactory() caught: javax.naming.CommunicationException

                  msg  :    Failed to connect to any server. Servers tried: [http-remoting://localhost:9990 (java.io.IOException: Unknown service name)]

                <OR: msg  :    Failed to connect to any server. Servers tried: [http-remoting://localhost:9990 (java.io.IOException: Unknown service name)]>

       

      <Stack Trace>

      javax.naming.CommunicationException: Failed to connect to any server. Servers tried: [http-remoting://localhost:9990 (java.io.IOException: Unknown service name)]

          at org.jboss.naming.remote.client.HaRemoteNamingStore.failOverSequence(HaRemoteNamingStore.java:244)

          at org.jboss.naming.remote.client.HaRemoteNamingStore.namingStore(HaRemoteNamingStore.java:149)

          at org.jboss.naming.remote.client.HaRemoteNamingStore.namingOperation(HaRemoteNamingStore.java:130)

          at org.jboss.naming.remote.client.HaRemoteNamingStore.lookup(HaRemoteNamingStore.java:272)

          at org.jboss.naming.remote.client.RemoteContext.lookup(RemoteContext.java:87)

          at org.jboss.naming.remote.client.RemoteContext.lookup(RemoteContext.java:129)

          at javax.naming.InitialContext.lookup(Unknown Source)

          at org.america3.gotest.xtra.PostedCode.getFactory(PostedCode.java:55)

          at org.america3.gotest.xtra.PostedCode.main(PostedCode.java:38)

       

      WILDFLY CONSOLE EXCEPTS:

      Calling "C:\ProgramFilesGeo\Wildfly\wildfly-10.1.0.Final\bin\standalone.conf.bat"

      Setting JAVA property to "C:\Program Files\Java\jdk1.8.0_121\bin\java"

      ====================================================

        JBoss Bootstrap Environment

      JAVA_OPTS: "-Dprogram.name=standalone.bat -Xms64M -Xmx512M -XX:MetaspaceSize=96M -XX:MaxMetaspaceSize=256m -Djava.net.preferIPv4Stack=true -Djboss.modules.system.pkgs=org.jboss.byteman"

      =====================================================

      10:48:03,475 INFO  [org.wildfly.extension.messaging-activemq]

      (ServerService Thread Pool -- 73) WFLYMSGAMQ0002:

      Bound messaging object to jndi name java:jboss/exported/jms/RemoteConnectionFactory

      10:48:04,111 INFO  [org.jboss.as]

      (Controller Boot Thread) WFLYSRV0051:

      Admin console listening on http://127.0.0.1:9990

      10:48:04,113 INFO  [org.jboss.as]

      (Controller Boot Thread) WFLYSRV0025:

      WildFly Full 10.1.0.Final (WildFly Core 2.2.0.Final) started in 3714ms - Started 486 of 741 services (428 services are lazy, passive or on-demand)

        • 2. Re: Why Won't This Code Obtain a JMS ConnectionFactory?
          George Berish Novice

          Thanks, but no luck.

          I tried that again and amended the post to show it's been tried..

          • 3. Re: Why Won't This Code Obtain a JMS ConnectionFactory?
            Wolfgang Mayer Master

            I don't see any log showing the connection attempt with port 8080

            • 4. Re: Why Won't This Code Obtain a JMS ConnectionFactory?
              Miroslav Novak Master

              Hi George,

               

              Wolgang is right...for remote JNDI look up port 8080 must be used. I've noticed another problem in your code that you're casting to legacy org.hornetq.jms.client.HornetQJMSConnectionFactory but here javax.jms.ConnectionFactory should be used. Also when looking up objects from remote jndi, use just "jms/RemoteConnectionFactory" and not "java:jboss/exported/jms/RemoteConnectionFactory". The full jndi name will not work.

               

              If you still have problems then share your standalone-full.xml configuration file.

               

              Thanks,

              Mirek

              • 5. Re: Why Won't This Code Obtain a JMS ConnectionFactory?
                George Berish Novice

                Thanks Mirek, I tried your suggestions, but please note this line from WF's server.log on startup.

                 

                "2017-08-10 10:40:24,304 INFO [org.wildfly.extension.messaging-activemq] (ServerService Thread Pool -- 66) WFLYMSGAMQ0002: Bound messaging object to jndi name java:jboss/exported/jms/RemoteConnectionFactory

                 

                But at least your suggestion at least made the error messages change.

                 

                Only now I’m losing control of what’s been tried and when, so I’m posting the code I just ran, the new Eclipse Console output. I can't figure out how to attach the standalone-full.xml file. So I guess I'll cut and past it below as well.

                 

                Please note. I modified by print statements to make it very clear the Exception is being thrown when I try to read the Initial Context I’m getting. Not only when I try to to use it for a JNDI lookup of the Connection Factory.

                 

                I’ve also gone back and confirmed that’s always been the problem. It always looks like I’ve been getting a valid InitialContext Object, but as near as I can tell, it isn't, because it throws an Exception when I’ve tried to list it’s JNDI Names.

                 

                Only change is that now listCTX()throws an Exception dealing with Authentication when I try to list it. So I guess I need first  figure out why it looks like my ID/PW properties are recognized when I obtain an IntialContext, but then the IntitalContext can’t be listed without another set. I mean until I know the JNDI name I lookup is in the Context I can't tell whats not working.

                 

                Any and all suggestions are welcome from.

                 

                CODE As Modified to Date

                 

                import javax.naming.Context;

                import javax.naming.InitialContext;

                import javax.naming.NameClassPair;

                import javax.naming.NamingEnumeration;

                import java.util.HashMap;

                import java.util.Properties;

                import static org.america3.gotest.shared.tools.Utility.padRight;

                import javax.jms.ConnectionFactory;

                //import org.hornetq.jms.client.HornetQJMSConnectionFactory;

                 

                public class PostedCode {

                 

                  private Context ctx = null;

                  //private HornetQJMSConnectionFactory factory = null;

                  private ConnectionFactory factory = null;

                 

                  private Properties ENV_LOCAL = new Properties() {

                    private static final long serialVersionUID = 1L;

                    {

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

                      //put(Context.PROVIDER_URL, "http-remoting://localhost:9990");

                      //put(Context.PROVIDER_URL, "http://localhost:9990"); //This produces identical failures

                      put(Context.PROVIDER_URL, "http-remoting://localhost:8080"); // This produced the authentication Exception below
                      //put(Context.PROVIDER_URL, "http://localhost:8080");  THIS PROP Throws the prior: "Failed to connect to any server. Servers tried: [http://localhost:8080" Exception

                      put(Context.SECURITY_PRINCIPAL, "jmsUser"); 

                      put(Context.SECURITY_CREDENTIALS, "jmsPW123!"); 

                      //put("jboss.naming.client.ejb.context", true); 

                    

                    }

                  };

                  

                  public static void main (String args[]) {

                    PostedCode test = new PostedCode ();

                    // Set Wildfly Initial Context

                    test.ctx = test.getInitialContetext();

                    if (test.ctx == null) {return;} else {System.out.println("main(): \nInitialContext not null: " + test.ctx);}

                    // Print list of IntialContxt

                    test.listCtx (test.ctx);

                    // Set JMS ConnectionFacytory

                    test.factory = (ConnectionFactory)test.getFactory(test.ctx);

                    if (test.factory == null) {return;} else {System.out.println("main(): ConnectionFactory not null: " + test.factory);}

                    }

                 

                  private Context getInitialContetext () {

                    pProps(ENV_LOCAL); // Prints properties to console

                    try {

                      return new InitialContext(ENV_LOCAL);

                    } catch (Exception e) {

                      System.out.println("\ngetInitialContext(): caught - " + e.getClass().getName());

                      System.out.println(" msg    - " + e.getMessage());

                      return null;

                    }

                  }

                 

                //  private HornetQJMSConnectionFactory getFactory (Context ctx) {

                    private ConnectionFactory getFactory (Context ctx) {

                    try {

                      //return (HornetQJMSConnectionFactory) ctx.lookup("java:jboss/exported/jms/RemoteConnectionFactory");

                      return (ConnectionFactory) ctx.lookup("jms/RemoteConnectionFactory");

                    } catch (Exception e) {

                      System.out.println("\ngetFactory(): caught - " + e.getClass().getName());

                      System.out.println(" msg   - " + e.getMessage());

                      e.printStackTrace();

                      return null;

                    }

                  }

                  

                  static private void pProps (Properties p) {

                    StringBuffer sb = new StringBuffer ();

                    sb.append("props(): Properties used to obtain IntialContext"+"\n");

                    for (Object key: p.keySet()) {

                      String pKey = padRight ("  " + (String)key,40,' ');

                      sb.append(pKey);

                      sb.append("\"" + p.get(key) + "\"" + "\n");

                    }

                    System.out.println(sb);

                  }

                 

                  private void listCtx (Context ctx) {

                    HashMap<String, String> map = new HashMap<String, String>();

                    try {

                      System.out.println("listCtx(): A. Listing InitialContext NameClassPair Enumeration:\n");

                NamingEnumeration<NameClassPair> list = this.ctx.list("");

                      System.out.println("listCtx(): B. Enumerator: " + list);

                      while (list.hasMoreElements()) {

                        NameClassPair next = list.next();

                        String name = next.getName();

                        String jndiPath = "listCtx(): C. name: " + name;

                        map.put(name, jndiPath);

                      }

                      System.out.println("listCtx(): D. map.size(): " +map.size());

                    } catch (Exception e) {

                      System.out.println("\nlistCtx(): E. caught: " + e.getClass().getName());

                      System.out.println(  "              msg   : " + e.getMessage());

                    }

                  }

                }

                 

                ECLIPSE CONSOLE OUTPUT

                props(): Properties used to obtain IntialContext

                java.naming.provider.url "http-remoting://localhost:8080"

                java.naming.factory.initial "org.jboss.naming.remote.client.InitialContextFactory"

                java.naming.security.principal "jmsUser"

                java.naming.security.credentials "jmsPW123!"

                 

                Aug 10, 2017 10:50:01 AM org.xnio.Xnio <clinit>

                INFO: XNIO version 3.4.6.Final

                Aug 10, 2017 10:50:01 AM org.xnio.nio.NioXnio <clinit>

                INFO: XNIO NIO Implementation Version 3.4.3.Final

                Aug 10, 2017 10:50:02 AM org.jboss.remoting3.EndpointImpl <clinit>

                INFO: JBoss Remoting version 4.0.7.Final

                main():

                InitialContext not null: javax.naming.InitialContext@6108b2d7

                listCtx(): A. Listing InitialContext NameClassPair Enumeration:

                 

                Aug 10, 2017 10:50:02 AM org.jboss.remoting3.remote.RemoteConnection handleException

                ERROR: JBREM000200: Remote connection failed: javax.security.sasl.SaslException: Authentication failed: all available authentication mechanisms failed:

                   DIGEST-MD5: Server rejected authentication

                 

                listCtx(): E. caught: javax.naming.AuthenticationException

                              msg   : Failed to connect to any server. Servers tried: [http-remoting://localhost:8080 (Authentication failed: all available authentication mechanisms failed:

                   DIGEST-MD5: Server rejected authentication)]

                Aug 10, 2017 10:50:02 AM org.jboss.remoting3.remote.RemoteConnection handleException

                ERROR: JBREM000200: Remote connection failed: javax.security.sasl.SaslException: Authentication failed: all available authentication mechanisms failed:

                   DIGEST-MD5: Server rejected authentication

                 

                getFactory(): caught - javax.naming.AuthenticationException

                                 msg   - Failed to connect to any server. Servers tried: [http-remoting://localhost:8080 (Authentication failed: all available authentication mechanisms failed:

                   DIGEST-MD5: Server rejected authentication)]

                1. javax.naming.AuthenticationException: Failed to connect to any server. Servers tried: [http-remoting://localhost:8080 (Authentication failed: all available authentication mechanisms failed:

                   DIGEST-MD5: Server rejected authentication)] [Root exception is javax.security.sasl.SaslException: Authentication failed: all available authentication mechanisms failed:

                   DIGEST-MD5: Server rejected authentication]

                     at org.jboss.naming.remote.client.HaRemoteNamingStore.failOverSequence(HaRemoteNamingStore.java:238)

                     at org.jboss.naming.remote.client.HaRemoteNamingStore.namingStore(HaRemoteNamingStore.java:149)

                     at org.jboss.naming.remote.client.HaRemoteNamingStore.namingOperation(HaRemoteNamingStore.java:130)

                     at org.jboss.naming.remote.client.HaRemoteNamingStore.lookup(HaRemoteNamingStore.java:272)

                     at org.jboss.naming.remote.client.RemoteContext.lookup(RemoteContext.java:87)

                     at org.jboss.naming.remote.client.RemoteContext.lookup(RemoteContext.java:129)

                     at javax.naming.InitialContext.lookup(Unknown Source)

                     at org.america3.gotest.xtra.PostedCode.getFactory(PostedCode.java:61)

                     at org.america3.gotest.xtra.PostedCode.main(PostedCode.java:42)

                Caused by: javax.security.sasl.SaslException: Authentication failed: all available authentication mechanisms failed:

                   DIGEST-MD5: Server rejected authentication

                     at org.jboss.remoting3.remote.ClientConnectionOpenListener.allMechanismsFailed(ClientConnectionOpenListener.java:113)

                     at org.jboss.remoting3.remote.ClientConnectionOpenListener$Capabilities.handleEvent(ClientConnectionOpenListener.java:443)

                     at org.jboss.remoting3.remote.ClientConnectionOpenListener$Capabilities.handleEvent(ClientConnectionOpenListener.java:242)

                     at org.xnio.ChannelListeners.invokeChannelListener(ChannelListeners.java:92)

                     at org.xnio.channels.TranslatingSuspendableChannel.handleReadable(TranslatingSuspendableChannel.java:198)

                     at org.xnio.channels.TranslatingSuspendableChannel$1.handleEvent(TranslatingSuspendableChannel.java:112)

                     at org.xnio.ChannelListeners.invokeChannelListener(ChannelListeners.java:92)

                     at org.xnio.ChannelListeners$DelegatingChannelListener.handleEvent(ChannelListeners.java:1092)

                     at org.xnio.ChannelListeners.invokeChannelListener(ChannelListeners.java:92)

                     at org.xnio.conduits.ReadReadyHandler$ChannelListenerHandler.readReady(ReadReadyHandler.java:66)

                     at org.xnio.nio.NioSocketConduit.handleReady(NioSocketConduit.java:89)

                     at org.xnio.nio.WorkerThread.run(WorkerThread.java:567)

                     at ...asynchronous invocation...(Unknown Source)

                     at org.jboss.remoting3.EndpointImpl.doConnect(EndpointImpl.java:272)

                     at org.jboss.remoting3.EndpointImpl.doConnect(EndpointImpl.java:253)

                     at org.jboss.remoting3.EndpointImpl.connect(EndpointImpl.java:351)

                     at org.jboss.remoting3.EndpointImpl.connect(EndpointImpl.java:335)

                     at org.jboss.naming.remote.client.EndpointCache$EndpointWrapper.connect(EndpointCache.java:111)

                     at org.jboss.naming.remote.client.HaRemoteNamingStore.failOverSequence(HaRemoteNamingStore.java:197)

                     ... 8 more

                 

                STANDALONE-FULL.XML

                <?xml version='1.0' encoding='UTF-8'?>

                 

                <server xmlns="urn:jboss:domain:4.2">

                 

                    <extensions>

                        <extension module="org.jboss.as.clustering.infinispan"/>

                        <extension module="org.jboss.as.connector"/>

                        <extension module="org.jboss.as.deployment-scanner"/>

                        <extension module="org.jboss.as.ee"/>

                        <extension module="org.jboss.as.ejb3"/>

                        <extension module="org.jboss.as.jaxrs"/>

                        <extension module="org.jboss.as.jdr"/>

                        <extension module="org.jboss.as.jmx"/>

                        <extension module="org.jboss.as.jpa"/>

                        <extension module="org.jboss.as.jsf"/>

                        <extension module="org.jboss.as.jsr77"/>

                        <extension module="org.jboss.as.logging"/>

                        <extension module="org.jboss.as.mail"/>

                        <extension module="org.jboss.as.naming"/>

                        <extension module="org.jboss.as.pojo"/>

                        <extension module="org.jboss.as.remoting"/>

                        <extension module="org.jboss.as.sar"/>

                        <extension module="org.jboss.as.security"/>

                        <extension module="org.jboss.as.transactions"/>

                        <extension module="org.jboss.as.webservices"/>

                        <extension module="org.jboss.as.weld"/>

                        <extension module="org.wildfly.extension.batch.jberet"/>

                        <extension module="org.wildfly.extension.bean-validation"/>

                        <extension module="org.wildfly.extension.io"/>

                        <extension module="org.wildfly.extension.messaging-activemq"/>

                        <extension module="org.wildfly.extension.request-controller"/>

                        <extension module="org.wildfly.extension.security.manager"/>

                        <extension module="org.wildfly.extension.undertow"/>

                        <extension module="org.wildfly.iiop-openjdk"/>

                    </extensions>

                 

                 

                    <management>

                        <security-realms>

                            <security-realm name="ManagementRealm">

                                <authentication>

                                    <local default-user="$local" skip-group-loading="true"/>

                                    <properties path="mgmt-users.properties" relative-to="jboss.server.config.dir"/>

                                </authentication>

                                <authorization map-groups-to-roles="false">

                                    <properties path="mgmt-groups.properties" relative-to="jboss.server.config.dir"/>

                                </authorization>

                            </security-realm>

                            <security-realm name="ApplicationRealm">

                                <server-identities>

                                    <ssl>

                                        <keystore path="application.keystore" relative-to="jboss.server.config.dir" keystore-password="password" alias="server" key-password="password" generate-self-signed-certificate-host="localhost"/>

                                    </ssl>

                                </server-identities>

                                <authentication>

                                    <local default-user="$local" allowed-users="*" skip-group-loading="true"/>

                                    <properties path="application-users.properties" relative-to="jboss.server.config.dir"/>

                                </authentication>

                                <authorization>

                                    <properties path="application-roles.properties" relative-to="jboss.server.config.dir"/>

                                </authorization>

                            </security-realm>

                        </security-realms>

                        <audit-log>

                            <formatters>

                                <json-formatter name="json-formatter"/>

                            </formatters>

                            <handlers>

                                <file-handler name="file" formatter="json-formatter" path="audit-log.log" relative-to="jboss.server.data.dir"/>

                            </handlers>

                            <logger log-boot="true" log-read-only="false" enabled="false">

                                <handlers>

                                    <handler name="file"/>

                                </handlers>

                            </logger>

                        </audit-log>

                        <management-interfaces>

                            <http-interface security-realm="ManagementRealm" http-upgrade-enabled="true">

                                <socket-binding http="management-http"/>

                            </http-interface>

                        </management-interfaces>

                        <access-control provider="simple">

                            <role-mapping>

                                <role name="SuperUser">

                                    <include>

                                        <user name="$local"/>

                                    </include>

                                </role>

                            </role-mapping>

                        </access-control>

                    </management>

                 

                    <profile>

                        <subsystem xmlns="urn:jboss:domain:logging:3.0">

                            <console-handler name="CONSOLE">

                                <level name="INFO"/>

                                <formatter>

                                    <named-formatter name="COLOR-PATTERN"/>

                                </formatter>

                            </console-handler>

                            <console-handler name="MY-CONSOLE" autoflush="true">

                                <formatter>

                                    <named-formatter name="MY-PATTERN"/>

                                </formatter>

                                <target name="System.out"/>

                            </console-handler>

                            <periodic-rotating-file-handler name="FILE" autoflush="true">

                                <formatter>

                                    <named-formatter name="PATTERN"/>

                                </formatter>

                                <file relative-to="jboss.server.log.dir" path="server.log"/>

                                <suffix value=".yyyy-MM-dd"/>

                                <append value="true"/>

                            </periodic-rotating-file-handler>

                            <logger category="com.arjuna">

                                <level name="WARN"/>

                            </logger>

                            <logger category="org.jboss.as.config">

                                <level name="DEBUG"/>

                            </logger>

                            <logger category="sun.rmi">

                                <level name="WARN"/>

                            </logger>

                            <root-logger>

                                <level name="INFO"/>

                                <handlers>

                                    <handler name="CONSOLE"/>

                                    <handler name="FILE"/>

                                </handlers>

                            </root-logger>

                            <formatter name="PATTERN">

                                <pattern-formatter pattern="%d{yyyy-MM-dd HH:mm:ss,SSS} %-5p [%c] (%t) %s%e%n"/>

                            </formatter>

                            <formatter name="COLOR-PATTERN">

                                <pattern-formatter pattern="%K{level}%d{HH:mm:ss,SSS} %-5p [%c] (%t) %s%e%n"/>

                            </formatter>

                            <formatter name="MY-PATTERN">

                                <pattern-formatter pattern="%s%n"/>

                            </formatter>

                        </subsystem>

                        <subsystem xmlns="urn:jboss:domain:batch-jberet:1.0">

                            <default-job-repository name="in-memory"/>

                            <default-thread-pool name="batch"/>

                            <job-repository name="in-memory">

                                <in-memory/>

                            </job-repository>

                            <thread-pool name="batch">

                                <max-threads count="10"/>

                                <keepalive-time time="30" unit="seconds"/>

                            </thread-pool>

                        </subsystem>

                        <subsystem xmlns="urn:jboss:domain:bean-validation:1.0"/>

                        <subsystem xmlns="urn:jboss:domain:datasources:4.0">

                            <datasources>

                                <datasource jndi-name="java:jboss/datasources/ExampleDS" pool-name="ExampleDS" enabled="true" use-java-context="true">

                                    <connection-url>jdbc:h2:mem:test;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE</connection-url>

                                    <driver>h2</driver>

                                    <security>

                                        <user-name>sa</user-name>

                                        <password>sa</password>

                                    </security>

                                </datasource>

                                <datasource jndi-name="java:jboss/jdbc/tappdb" pool-name="TappDS">

                                    <connection-url>jdbc:mysql://localhost:3306/tappdb</connection-url>

                                    <driver>mysql</driver>

                                    <security>

                                        <user-name>tappdbUser</user-name>

                                        <password>&amp;amp;MxTappOTB&amp;amp;</password>

                                    </security>

                                </datasource>

                                <drivers>

                                    <driver name="h2" module="com.h2database.h2">

                                        <xa-datasource-class>org.h2.jdbcx.JdbcDataSource</xa-datasource-class>

                                    </driver>

                                    <driver name="mysql" module="com.mysql.driver">

                                        <driver-class>org.mariadb.jdbc.Driver</driver-class>

                                    </driver>

                                </drivers>

                            </datasources>

                        </subsystem>

                        <subsystem xmlns="urn:jboss:domain:deployment-scanner:2.0">

                            <deployment-scanner path="deployments" relative-to="jboss.server.base.dir" scan-interval="5000" runtime-failure-causes-rollback="${jboss.deployment.scanner.rollback.on.failure:false}"/>

                        </subsystem>

                        <subsystem xmlns="urn:jboss:domain:ee:4.0">

                            <spec-descriptor-property-replacement>false</spec-descriptor-property-replacement>

                            <concurrent>

                                <context-services>

                                    <context-service name="default" jndi-name="java:jboss/ee/concurrency/context/default" use-transaction-setup-provider="true"/>

                                </context-services>

                                <managed-thread-factories>

                                    <managed-thread-factory name="default" jndi-name="java:jboss/ee/concurrency/factory/default" context-service="default"/>

                                </managed-thread-factories>

                                <managed-executor-services>

                                    <managed-executor-service name="default" jndi-name="java:jboss/ee/concurrency/executor/default" context-service="default" hung-task-threshold="60000" keepalive-time="5000"/>

                                </managed-executor-services>

                                <managed-scheduled-executor-services>

                                    <managed-scheduled-executor-service name="default" jndi-name="java:jboss/ee/concurrency/scheduler/default" context-service="default" hung-task-threshold="60000" keepalive-time="3000"/>

                                </managed-scheduled-executor-services>

                            </concurrent>

                            <default-bindings context-service="java:jboss/ee/concurrency/context/default" datasource="java:jboss/datasources/ExampleDS" jms-connection-factory="java:jboss/DefaultJMSConnectionFactory" managed-executor-service="java:jboss/ee/concurrency/executor/default" managed-scheduled-executor-service="java:jboss/ee/concurrency/scheduler/default" managed-thread-factory="java:jboss/ee/concurrency/factory/default"/>

                        </subsystem>

                        <subsystem xmlns="urn:jboss:domain:ejb3:4.0">

                            <session-bean>

                                <stateless>

                                    <bean-instance-pool-ref pool-name="slsb-strict-max-pool"/>

                                </stateless>

                                <stateful default-access-timeout="5000" cache-ref="simple" passivation-disabled-cache-ref="simple"/>

                                <singleton default-access-timeout="5000"/>

                            </session-bean>

                            <mdb>

                                <resource-adapter-ref resource-adapter-name="${ejb.resource-adapter-name:activemq-ra.rar}"/>

                                <bean-instance-pool-ref pool-name="mdb-strict-max-pool"/>

                            </mdb>

                            <pools>

                                <bean-instance-pools>

                                    <strict-max-pool name="slsb-strict-max-pool" derive-size="from-worker-pools" instance-acquisition-timeout="5" instance-acquisition-timeout-unit="MINUTES"/>

                                    <strict-max-pool name="mdb-strict-max-pool" derive-size="from-cpu-count" instance-acquisition-timeout="5" instance-acquisition-timeout-unit="MINUTES"/>

                                </bean-instance-pools>

                            </pools>

                            <caches>

                                <cache name="simple"/>

                                <cache name="distributable" passivation-store-ref="infinispan" aliases="passivating clustered"/>

                            </caches>

                            <passivation-stores>

                                <passivation-store name="infinispan" cache-container="ejb" max-size="10000"/>

                            </passivation-stores>

                            <async thread-pool-name="default"/>

                            <timer-service thread-pool-name="default" default-data-store="default-file-store">

                                <data-stores>

                                    <file-data-store name="default-file-store" path="timer-service-data" relative-to="jboss.server.data.dir"/>

                                </data-stores>

                            </timer-service>

                            <remote connector-ref="http-remoting-connector" thread-pool-name="default"/>

                            <thread-pools>

                                <thread-pool name="default">

                                    <max-threads count="10"/>

                                    <keepalive-time time="100" unit="milliseconds"/>

                                </thread-pool>

                            </thread-pools>

                            <iiop enable-by-default="false" use-qualified-name="false"/>

                            <default-security-domain value="other"/>

                            <default-missing-method-permissions-deny-access value="true"/>

                            <log-system-exceptions value="true"/>

                        </subsystem>

                        <subsystem xmlns="urn:jboss:domain:io:1.1">

                            <worker name="default"/>

                            <buffer-pool name="default"/>

                        </subsystem>

                        <subsystem xmlns="urn:jboss:domain:infinispan:4.0">

                            <cache-container name="server" default-cache="default" module="org.wildfly.clustering.server">

                                <local-cache name="default">

                                    <transaction mode="BATCH"/>

                                </local-cache>

                            </cache-container>

                            <cache-container name="web" default-cache="passivation" module="org.wildfly.clustering.web.infinispan">

                                <local-cache name="passivation">

                                    <locking isolation="REPEATABLE_READ"/>

                                    <transaction mode="BATCH"/>

                                    <file-store passivation="true" purge="false"/>

                                </local-cache>

                                <local-cache name="persistent">

                                    <locking isolation="REPEATABLE_READ"/>

                                    <transaction mode="BATCH"/>

                                    <file-store passivation="false" purge="false"/>

                                </local-cache>

                                <local-cache name="concurrent">

                                    <file-store passivation="true" purge="false"/>

                                </local-cache>

                            </cache-container>

                            <cache-container name="ejb" aliases="sfsb" default-cache="passivation" module="org.wildfly.clustering.ejb.infinispan">

                                <local-cache name="passivation">

                                    <locking isolation="REPEATABLE_READ"/>

                                    <transaction mode="BATCH"/>

                                    <file-store passivation="true" purge="false"/>

                                </local-cache>

                                <local-cache name="persistent">

                                    <locking isolation="REPEATABLE_READ"/>

                                    <transaction mode="BATCH"/>

                                    <file-store passivation="false" purge="false"/>

                                </local-cache>

                            </cache-container>

                            <cache-container name="hibernate" default-cache="local-query" module="org.hibernate.infinispan">

                                <local-cache name="entity">

                                    <transaction mode="NON_XA"/>

                                    <eviction strategy="LRU" max-entries="10000"/>

                                    <expiration max-idle="100000"/>

                                </local-cache>

                                <local-cache name="local-query">

                                    <eviction strategy="LRU" max-entries="10000"/>

                                    <expiration max-idle="100000"/>

                                </local-cache>

                                <local-cache name="timestamps"/>

                            </cache-container>

                        </subsystem>

                        <subsystem xmlns="urn:jboss:domain:iiop-openjdk:1.0">

                            <orb socket-binding="iiop" ssl-socket-binding="iiop-ssl"/>

                            <initializers security="identity" transactions="spec"/>

                        </subsystem>

                        <subsystem xmlns="urn:jboss:domain:jaxrs:1.0"/>

                        <subsystem xmlns="urn:jboss:domain:jca:4.0">

                            <archive-validation enabled="true" fail-on-error="true" fail-on-warn="false"/>

                            <bean-validation enabled="true"/>

                            <default-workmanager>

                                <short-running-threads>

                                    <core-threads count="50"/>

                                    <queue-length count="50"/>

                                    <max-threads count="50"/>

                                    <keepalive-time time="10" unit="seconds"/>

                                </short-running-threads>

                                <long-running-threads>

                                    <core-threads count="50"/>

                                    <queue-length count="50"/>

                                    <max-threads count="50"/>

                                    <keepalive-time time="10" unit="seconds"/>

                                </long-running-threads>

                            </default-workmanager>

                            <cached-connection-manager/>

                        </subsystem>

                        <subsystem xmlns="urn:jboss:domain:jdr:1.0"/>

                        <subsystem xmlns="urn:jboss:domain:jmx:1.3">

                            <expose-resolved-model/>

                            <expose-expression-model/>

                            <remoting-connector/>

                        </subsystem>

                        <subsystem xmlns="urn:jboss:domain:jpa:1.1">

                            <jpa default-datasource="" default-extended-persistence-inheritance="DEEP"/>

                        </subsystem>

                        <subsystem xmlns="urn:jboss:domain:jsf:1.0"/>

                        <subsystem xmlns="urn:jboss:domain:jsr77:1.0"/>

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

                            <mail-session name="default" jndi-name="java:jboss/mail/Default">

                                <smtp-server outbound-socket-binding-ref="mail-smtp"/>

                            </mail-session>

                        </subsystem>

                        <subsystem xmlns="urn:jboss:domain:messaging-activemq:1.0">

                            <server name="default">

                                <security-setting name="#">

                                    <role name="guest" send="true" consume="true" create-non-durable-queue="true" delete-non-durable-queue="true"/>

                                </security-setting>

                                <address-setting name="#" dead-letter-address="jms.queue.DLQ" expiry-address="jms.queue.ExpiryQueue" max-size-bytes="10485760" page-size-bytes="2097152" message-counter-history-day-limit="10"/>

                                <http-connector name="http-connector" socket-binding="http" endpoint="http-acceptor"/>

                                <http-connector name="http-connector-throughput" socket-binding="http" endpoint="http-acceptor-throughput">

                                    <param name="batch-delay" value="50"/>

                                </http-connector>

                                <in-vm-connector name="in-vm" server-id="0"/>

                                <http-acceptor name="http-acceptor" http-listener="default"/>

                                <http-acceptor name="http-acceptor-throughput" http-listener="default">

                                    <param name="batch-delay" value="50"/>

                                    <param name="direct-deliver" value="false"/>

                                </http-acceptor>

                                <in-vm-acceptor name="in-vm" server-id="0"/>

                                <jms-queue name="ExpiryQueue" entries="java:/jms/queue/ExpiryQueue"/>

                                <jms-queue name="DLQ" entries="java:/jms/queue/DLQ"/>

                               

                 

                <connection-factory

                  name="InVmConnectionFactory"

                  entries="java:/ConnectionFactory"

                  connectors="in-vm"

                />

                               

                <connection-factory

                  name="RemoteConnectionFactory"

                  entries="java:jboss/exported/jms/RemoteConnectionFactory"

                  connectors="http-connector"/>

                    <pooled-connection-factory

                      name="activemq-ra" entries="java:/JmsXA

                      java:jboss/DefaultJMSConnectionFactory"

                      connectors="in-vm"

                      transaction="xa"

                  />

                 

                </server>

                 

                        </subsystem>

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

                            <remote-naming/>

                        </subsystem>

                        <subsystem xmlns="urn:jboss:domain:pojo:1.0"/>

                        <subsystem xmlns="urn:jboss:domain:remoting:3.0">

                            <endpoint/>

                            <http-connector name="http-remoting-connector" connector-ref="default" security-realm="ApplicationRealm"/>

                        </subsystem>

                        <subsystem xmlns="urn:jboss:domain:resource-adapters:4.0"/>

                        <subsystem xmlns="urn:jboss:domain:request-controller:1.0"/>

                        <subsystem xmlns="urn:jboss:domain:sar:1.0"/>

                        <subsystem xmlns="urn:jboss:domain:security-manager:1.0">

                            <deployment-permissions>

                                <maximum-set>

                                    <permission class="java.security.AllPermission"/>

                                </maximum-set>

                            </deployment-permissions>

                        </subsystem>

                        <subsystem xmlns="urn:jboss:domain:security:1.2">

                            <security-domains>

                                <security-domain name="other" cache-type="default">

                                    <authentication>

                                        <login-module code="Remoting" flag="optional">

                                            <module-option name="password-stacking" value="useFirstPass"/>

                                        </login-module>

                                        <login-module code="RealmDirect" flag="required">

                                            <module-option name="password-stacking" value="useFirstPass"/>

                                        </login-module>

                                    </authentication>

                                </security-domain>

                                <security-domain name="jboss-web-policy" cache-type="default">

                                    <authorization>

                                        <policy-module code="Delegating" flag="required"/>

                                    </authorization>

                                </security-domain>

                                <security-domain name="jboss-ejb-policy" cache-type="default">

                                    <authorization>

                                        <policy-module code="Delegating" flag="required"/>

                                    </authorization>

                                </security-domain>

                                <security-domain name="jaspitest" cache-type="default">

                                    <authentication-jaspi>

                                        <login-module-stack name="dummy">

                                            <login-module code="Dummy" flag="optional"/>

                                        </login-module-stack>

                                        <auth-module code="Dummy"/>

                                    </authentication-jaspi>

                                </security-domain>

                            </security-domains>

                        </subsystem>

                        <subsystem xmlns="urn:jboss:domain:transactions:3.0">

                            <core-environment>

                                <process-id>

                                    <uuid/>

                                </process-id>

                            </core-environment>

                            <recovery-environment socket-binding="txn-recovery-environment" status-socket-binding="txn-status-manager"/>

                        </subsystem>

                        <subsystem xmlns="urn:jboss:domain:undertow:3.1">

                            <buffer-cache name="default"/>

                            <server name="default-server">

                                <http-listener name="default" socket-binding="http" redirect-socket="https" enable-http2="true"/>

                                <https-listener name="https" socket-binding="https" security-realm="ApplicationRealm" enable-http2="true"/>

                                <host name="default-host" alias="localhost">

                                    <location name="/" handler="welcome-content"/>

                                    <filter-ref name="server-header"/>

                                    <filter-ref name="x-powered-by-header"/>

                                </host>

                            </server>

                            <servlet-container name="default">

                                <jsp-config/>

                                <websockets/>

                            </servlet-container>

                            <handlers>

                                <file name="welcome-content" path="${jboss.home.dir}/welcome-content"/>

                            </handlers>

                            <filters>

                                <response-header name="server-header" header-name="Server" header-value="WildFly/10"/>

                                <response-header name="x-powered-by-header" header-name="X-Powered-By" header-value="Undertow/1"/>

                            </filters>

                        </subsystem>

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

                            <wsdl-host>${jboss.bind.address:127.0.0.1}</wsdl-host>

                            <endpoint-config name="Standard-Endpoint-Config"/>

                            <endpoint-config name="Recording-Endpoint-Config">

                                <pre-handler-chain name="recording-handlers" protocol-bindings="##SOAP11_HTTP ##SOAP11_HTTP_MTOM ##SOAP12_HTTP ##SOAP12_HTTP_MTOM">

                                    <handler name="RecordingHandler" class="org.jboss.ws.common.invocation.RecordingServerHandler"/>

                                </pre-handler-chain>

                            </endpoint-config>

                            <client-config name="Standard-Client-Config"/>

                        </subsystem>

                        <subsystem xmlns="urn:jboss:domain:weld:3.0"/>

                    </profile>

                 

                    <interfaces>

                        <interface name="management">

                            <inet-address value="${jboss.bind.address.management:127.0.0.1}"/>

                        </interface>

                        <interface name="public">

                            <inet-address value="${jboss.bind.address:127.0.0.1}"/>

                        </interface>

                        <interface name="unsecure">

                            <inet-address value="${jboss.bind.address.unsecure:127.0.0.1}"/>

                        </interface>

                    </interfaces>

                 

                    <socket-binding-group name="standard-sockets" default-interface="public" port-offset="${jboss.socket.binding.port-offset:0}">

                        <socket-binding name="management-http" interface="management" port="${jboss.management.http.port:9990}"/>

                        <socket-binding name="management-https" interface="management" port="${jboss.management.https.port:9993}"/>

                        <socket-binding name="ajp" port="${jboss.ajp.port:8009}"/>

                        <socket-binding name="http" port="${jboss.http.port:8080}"/>

                        <socket-binding name="https" port="${jboss.https.port:8443}"/>

                        <socket-binding name="iiop" interface="unsecure" port="3528"/>

                        <socket-binding name="iiop-ssl" interface="unsecure" port="3529"/>

                        <socket-binding name="txn-recovery-environment" port="4712"/>

                        <socket-binding name="txn-status-manager" port="4713"/>

                        <outbound-socket-binding name="mail-smtp">

                            <remote-destination host="localhost" port="25"/>

                        </outbound-socket-binding>

                    </socket-binding-group>

                 

                </server>

                • 6. Re: Why Won't This Code Obtain a JMS ConnectionFactory?
                  Miroslav Novak Master

                  I took your config and code and everything worked like a charm. I did not even need to add user "jmsUser" as local user does not need to authenticate against remoting:

                  main(): 
                  InitialContext not null: javax.naming.InitialContext@f5f2bb7
                  listCtx(): A. Listing InitialContext NameClassPair Enumeration:
                  
                  listCtx(): B. Enumerator: org.jboss.naming.remote.client.ClientUtil$1@3f49dace
                  listCtx(): D. map.size(): 1
                  ...
                  main(): ConnectionFactory not null: ActiveMQConnectionFactory [serverLocator=ServerLocatorImpl [initialConnectors=[TransportConfiguration(name=null, factory=org-apache-activemq-artemis-core-remoting-impl-netty-NettyConnectorFactory) ?httpUpgradeEnabled=true&port=8080&httpPpgradeEndpoint=http-acceptor&host=localhost], discoveryGroupConfiguration=null], clientID=null, consumerWindowSize = 1048576, dupsOKBatchSize=1048576, transactionBatchSize=1048576, readOnly=false]

                   

                  Still I can see that you're having authentication problem. Can you try to modify remoting subsystem like (remove security-realm="ApplicationRealm"):

                  <subsystem xmlns="urn:jboss:domain:remoting:3.0">

                  ...

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

                  </subsystem>

                   

                  Restart server and try again. If it works then you really have authentication problem. Maybe you just did not add user to your original configuration:

                  ~/tmp/wildfly-10.1.0.Final/bin $ sh add-user.sh -a -u jmsUser -p jmsPW123!
                  

                   

                  Thanks,

                  Mirek

                  • 7. Re: Why Won't This Code Obtain a JMS ConnectionFactory?
                    George Berish Novice

                    Hi Mirek,

                     

                    I tried commenting out the Application Realm, but nothing is ever that easy.

                    I have some other applications deployed as .ear packages on the WF Server. They caused WF to throw a mess of  Exceptions related to unsatisfied dependencies. 

                     

                    And I really did not want to mess with undeploying them.

                     

                    So instead I added a new Application User and Management User to be sure I had valid ID/PWs.

                     

                    I don't  know the difference but add-user.bat asked which I wanted so I added one of each

                    appUser     appUser9#, and

                    mgtUser     mgtUser9#

                    But only used the Application User pair.

                     

                    Used these properties. So looks like even though the admin console listens to 9990 JNDI connections need to use 8080.

                    And even though both Eclipse and WF are on same computer still used "http-remoting". I guess remote means outside WF's container

                     

                     

                         Context.INITIAL_CONTEXT_FACTORY,   "org.jboss.naming.remote.client.InitialContextFactory");

                         Context.PROVIDER_URL,                         "http-remoting://localhost:8080");

                         Context.SECURITY_PRINCIPAL,               "appUser");

                         Context.SECURITY_CREDENTIALS,        "appUser9#");

                     

                    Now they threw ClassNotFound Exceptions that eventually required

                     

                    jboss-marshalling-1.3.15.GA.jar

                    jboss-marshalling-river-1.3.14.GA.jar

                    artemis-commons-2.2.0.jar

                    artemis-core-client-2.2.0.jar

                    artemis-jms-client-2.2.0.jar

                    commons-beanutils-1.9.2.jar

                    commons-collections-3.2.1.jar

                    commons-logging-1.1.1.jar

                    javax.json-1.0.2.jar

                    netty-all-4.1.9.Final.jar

                     

                    Suffixes like "river" and "GA" always leave me feeling I've strayed out of core java, jboss, etc.

                     

                    But non the less

                    My code now reproduces the output you received.

                     

                    So I now have a ConnectionFactory.

                    Thank you.

                     

                    Here's hoping it can actually get's be a JMS connect me to Queues I need to set up in WF..

                    But that's a different problem.

                     

                    Hope this helps others.

                    • 8. Re: Why Won't This Code Obtain a JMS ConnectionFactory?
                      Miroslav Novak Master

                      Hi George,

                       

                      on the client side you can use ~/tmp/wildfly-10.1.0.Final/bin/client/jboss-client.jar or use jms-client bom:

                      <dependencies>

                              <dependency>

                                  <groupId>org.wildfly</groupId>

                                  <artifactId>wildfly-jms-client-bom</artifactId>

                                  <type>pom</type>

                              </dependency>

                      </dependencies>

                       

                      It's not necessary to manually find all the jars.

                       

                      Otherwise great that you've managed to make it work :-)

                       

                      Mirek

                      • 9. Re: Why Won't This Code Obtain a JMS ConnectionFactory?
                        George Berish Novice

                        Hi Mirek,

                         

                        Thank you.

                         

                        I don't what to drag this thread off topic, but

                        ... for those of us who haven't lived in Jboss' world as it morphed into WildFly

                        Am I correct in assuming that "use jms-client-bom" means adding the snippet you provided to standalone-full.xml?

                         

                        I'm afraid experts like you don't remember how difficult it is to set roots for a knowledge tree when first confronting WF. I.e. someplace to being hanging new stuff on.

                         

                        For example, I was half way through this battle when I finally figured out that Hornet is gone ... and activeMQ was in.  (As mentioned somewhere up above, I started with an old WF-8/Eclipse-Mars project where I remember previously fighting with the reverse).

                         

                        None the less. Thank you.

                         

                        Grin ... now on to the next battle I may have too post separately.

                        WHY

                         

                        With an Initial Context that allows me to get a valid Connection and Session.

                         

                        And this from my CLI

                         

                        standalone@localhost:9990 /] /subsystem=messaging-activemq/server=default/jms-queue=goSendToClientQueue:add(entries=[java:/jms/qu

                        eue/goSendToClientQueue])

                        {"outcome" => "success"}

                        [standalone@localhost:9990 /]

                         

                        And this in my standalone-full.xml

                         

                        <jms-queue name="ExpiryQueue" entries="java:/jms/queue/ExpiryQueue"/>

                        <jms-queue name="DLQ" entries="java:/jms/queue/DLQ"/>

                        <jms-queue name="goSendToClientQueue" entries="java:/jms/queue/goSendToClientQueue"/>

                         

                        This line in my client throws:    javax.naming.NameNotFoundException

                        Queue jmsReceiveFmQueue = (Queue) ctx.lookup("java:/jms/queue/goSendToClientQueue");

                         

                        Grin ... if that defeats me it will be for another thread.

                        • 10. Re: Why Won't This Code Obtain a JMS ConnectionFactory?
                          Miroslav Novak Master

                          Most of the issues can be googled or found WF10 doc. For example last issue is just that you need to register queue to JNDI like:

                          java:jboss/exported/jms/queue/goSendToClientQueue

                           

                          Then you can look it up like (remove java:jboss/exported prefix):

                          Queue jmsReceiveFmQueue = (Queue) ctx.lookup("jms/queue/goSendToClientQueue");