2 Replies Latest reply on Feb 26, 2013 7:33 AM by vsvsbr

    JMS Client failed to create session Factory.

    pannu

      Hi,

       

      I am new to JMS, JBoss and this community too.

       

      I was trying to create a sample chat application, in which I made my machine as server (Jboss as 7.1 is installed and configured) , have one JMS client code (Say Client A ) (Producer and Consumer) in my machine itself and one more client code (Say Client B )in my colleague's machine (Both JMS client programs are just standalone (have main method)). When I start my Jboss with Standalone-Full profile Client A  in machine is able to run but the Client B code is not able to create session factory and throwing below exception.  Both Client A and Client B codes are able to message each other when they are run in my machine (using my ip address and local host as well).

       

      ERROR: Channel end notification received, closing channel Channel ID c936a3f7 (outbound) of Remoting connection 0064f6cd to /X.X.X.X:4447   Note : (X.X.X.X) is my ip address.

       

      javax.jms.JMSException: Failed to create session factory

       

          at org.hornetq.jms.client.HornetQConnectionFactory.createConnectionInternal(HornetQConnectionFactory.java:605)

       

          at org.hornetq.jms.client.HornetQConnectionFactory.createTopicConnection(HornetQConnectionFactory.java:143)

       

          at Client2.publish(Client2.java:50)

       

          at Client2.main(Client2.java:25)

       

      Caused by: HornetQException[errorCode=2 message=Cannot connect to server(s). Tried with all available servers.]

       

          at org.hornetq.core.client.impl.ServerLocatorImpl.createSessionFactory(ServerLocatorImpl.java:769)

       

          at org.hornetq.jms.client.HornetQConnectionFactory.createConnectionInternal(HornetQConnectionFactory.java:601)

       

          ... 3 more

       

      But when Client B is executed I am getting a notification in my Jboss Console notifies messages that the Client B is able to contact.

       

      Below are the JNDI properties in both Client codes.

       

                   Properties props = new Properties();

       

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

       

                   props.put(Context.PROVIDER_URL, "remote://X.X.X.X:5445");  Note : (X.X.X.X) is my machine's ip address.

       

                   props.put(Context.SECURITY_PRINCIPAL, "testuser");

       

                   props.put(Context.SECURITY_CREDENTIALS, "password");

       

       

       

       

      i guess it must be wrong with configuration side. Please suggest.

       

      Below is the standalone-full.xml configuration (Showing only <interfaces>, <socket-binding-group>, and <hornetq-server> tags and attached complete xml file.)

       

      <hornetq-server>

       

                      <persistence-enabled>true</persistence-enabled>

       

                      <journal-file-size>102400</journal-file-size>

       

                      <journal-min-files>2</journal-min-files>

       

                      <connectors>

       

       

       

                          <connector name="netty">

       

                          <factory-class>org.hornetq.core.remoting.impl.netty.NettyConnectorFactory</factory-class>

       

                          <param key="host"  value="${X.X.X.X}"/>  

       

                          <param key="port"  value="${hornetq.remoting.netty.port:5445}"/>

       

                          </connector>

       

       

       

       

       

                          <netty-connector name="netty" socket-binding="messaging"/>

       

                          <netty-connector name="netty-throughput" socket-binding="messaging-throughput">

       

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

       

                          </netty-connector>

       

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

       

                      </connectors>

       

                      <acceptors>

       

       

       

                      <acceptor name="netty">

       

       

       

                          <factory-class>org.hornetq.core.remoting.impl.netty.NettyAcceptorFactory</factory-class>

       

                          <param key="host"  value="${X.X.X.X}"/>  

       

                          <param key="port"  value="${hornetq.remoting.netty.port:5445}"/>

       

                          </acceptor>

       

       

       

                          <netty-acceptor name="netty" socket-binding="messaging"/>

       

                          <netty-acceptor name="netty-throughput" socket-binding="messaging-throughput">

       

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

       

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

       

                          </netty-acceptor>

       

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

       

                      </acceptors>

       

                      <security-settings>

       

                          <security-setting match="#">

       

                              <permission type="send" roles="guest"/>

       

                              <permission type="consume" roles="guest"/>

       

                              <permission type="createNonDurableQueue" roles="guest"/>

       

                              <permission type="deleteNonDurableQueue" roles="guest"/>

       

                          </security-setting>

       

                      </security-settings>

       

                      <address-settings>

       

                          <!--default for catch all-->

       

                          <address-setting match="#">

       

                              <dead-letter-address>jms.queue.DLQ</dead-letter-address>

       

                              <expiry-address>jms.queue.ExpiryQueue</expiry-address>

       

                              <redelivery-delay>0</redelivery-delay>

       

                              <max-size-bytes>10485760</max-size-bytes>

       

                              <address-full-policy>BLOCK</address-full-policy>

       

                              <message-counter-history-day-limit>10</message-counter-history-day-limit>

       

                          </address-setting>

       

                      </address-settings>

       

                      <jms-connection-factories>

       

                          <connection-factory name="InVmConnectionFactory">

       

                              <connectors>

       

                                  <connector-ref connector-name="in-vm"/>

       

                              </connectors>

       

                              <entries>

       

                                  <entry name="java:/ConnectionFactory"/>

       

                              </entries>

       

                          </connection-factory>

       

                          <connection-factory name="RemoteConnectionFactory">

       

                              <connectors>

       

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

       

                              </connectors>

       

                              <entries>

       

                                  <entry name="RemoteConnectionFactory"/>

       

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

       

                              </entries>

       

                          </connection-factory>

       

                          <pooled-connection-factory name="hornetq-ra">

       

                              <transaction mode="xa"/>

       

                              <connectors>

       

                                  <connector-ref connector-name="in-vm"/>

       

                              </connectors>

       

                              <entries>

       

                                  <entry name="java:/JmsXA"/>

       

                              </entries>

       

                          </pooled-connection-factory>

       

                      </jms-connection-factories>

       

                      <jms-destinations>

       

                          <jms-queue name="testQueue">

       

                              <entry name="queue/test"/>

       

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

       

                          </jms-queue>

       

                          <jms-topic name="testTopic">

       

                              <entry name="topic/test"/>

       

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

       

                          </jms-topic>

       

                      </jms-destinations>

       

                  </hornetq-server>

       

      <interfaces>

       

              <interface name="management">

       

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

       

              </interface>

       

              <interface name="public">

       

                  <any-address/>

       

              </interface>

       

              <interface name="specific-ip-interface">

       

                  <inet-address value="172.22.197.93"/>

       

              </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-native" interface="management" port="${jboss.management.native.port:9999}"/>

       

              <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:9443}"/>

       

              <socket-binding name="ajp" port="8009"/>

       

              <socket-binding name="http" port="8080"/>

       

              <socket-binding name="https" port="8443"/>

       

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

       

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

       

              <socket-binding name="messaging" port="5445"/>

       

              <socket-binding name="messaging-throughput" port="5455"/>

       

              <socket-binding name="osgi-http" interface="management" port="8090"/>

       

              <socket-binding name="remoting" port="4447"/>

       

              <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>

       

       

       

      Thanks,

      Pannu.