1 Reply Latest reply on Aug 27, 2014 2:14 PM by jbertram

    standalone.xml configuration for remote connection factory.

    ebmmaxis2007

      Running EAP 6.2, AS 7.3 with HornetQ 2.3.x (latest)

       

      I have a live/backup pair that host several jms destinations.  The connection factories are all configured in the standalone.xml as such:

       

      <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="MedRx">

                              <connectors>

                                  <connector-ref connector-name="primary-mediation"/>

                              </connectors>

                              <entries>

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

                              </entries>

                          </connection-factory>

                          <pooled-connection-factory name="Med">

                              <transaction mode="xa"/>

                              <connectors>

                                  <connector-ref connector-name="primary-mediation"/>

                              </connectors>

                              <entries>

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

                              </entries>

                          </pooled-connection-factory>

                      </jms-connection-factories>

       

      The discovery groups and broadcast groups are defined with the default/example settings in the standalone-full-ha.xml

       

      So far so good.

       

      Now, I have a third jboss instance that I want to configure and use these same connection factories.

      I've tried the following:

                       <connection-factory name="remote-hornetq-ra2">

                              <discovery-group-ref discovery-group-name="dg-group1"/>

                              <entries>

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

                              </entries>

                          </connection-factory>

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

                              <transaction mode="xa"/>

                              <discovery-group-ref discovery-group-name="dg-group1"/>

                              <entries>

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

                              </entries>

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

       

      The third jboss instance has several jms destinations as well.  For each destination, I get this error:

       

      17:58:35,758 WARN  [org.apache.camel.component.jms.DefaultJmsMessageListenerContainer] (Camel (camel-1) thread #6 - JmsConsumer[destination]) Could not refresh JMS Connection for destination 'destination' - retrying in 5000 ms. Cause: Failed to create session factory; nested exception is HornetQException[errorType=NOT_CONNECTED message=HQ119007: Cannot connect to server(s). Tried with all available servers.]

       

      I get the following stack trace when trying to connect to the destinations on the live server:

       

      HQ154002: Could not create session: javax.resource.ResourceException: IJ000451: The connection manager is shutdown: java:/JmsXA

        at org.jboss.jca.core.connectionmanager.AbstractConnectionManager.getManagedConnection(AbstractConnectionManager.java:321)

        at org.jboss.jca.core.connectionmanager.tx.TxConnectionManagerImpl.getManagedConnection(TxConnectionManagerImpl.java:368)

        at org.jboss.jca.core.connectionmanager.AbstractConnectionManager.allocateConnection(AbstractConnectionManager.java:464)

        at org.hornetq.ra.HornetQRASessionFactoryImpl.allocateConnection(HornetQRASessionFactoryImpl.java:832)

        at org.hornetq.ra.HornetQRASessionFactoryImpl.createSession(HornetQRASessionFactoryImpl.java:465)

        at org.springframework.jms.support.JmsAccessor.createSession(JmsAccessor.java:196)

        at org.springframework.jms.listener.AbstractPollingMessageListenerContainer.access$1(AbstractPollingMessageListenerContainer.java:1)

        at org.springframework.jms.listener.AbstractPollingMessageListenerContainer$MessageListenerContainerResourceFactory.createSession(AbstractPollingMessageListenerContainer.java:530)

        at org.springframework.jms.connection.ConnectionFactoryUtils.doGetTransactionalSession(ConnectionFactoryUtils.java:300)

        at org.springframework.jms.listener.AbstractPollingMessageListenerContainer.doReceiveAndExecute(AbstractPollingMessageListenerContainer.java:288)

        at org.springframework.jms.listener.AbstractPollingMessageListenerContainer.receiveAndExecute(AbstractPollingMessageListenerContainer.java:243)

        at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.invokeListener(DefaultMessageListenerContainer.java:1058)

        at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.executeOngoingLoop(DefaultMessageListenerContainer.java:1050)

        at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.run(DefaultMessageListenerContainer.java:947)

        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [rt.jar:1.7.0_45]

        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_45]

        at java.lang.Thread.run(Thread.java:744) [rt.jar:1.7.0_45]

       

      I'm really at a loss here.  Any help would be greatly appreciated.

        • 1. Re: standalone.xml configuration for remote connection factory.
          jbertram

          Couple of points...

          1. Based on your description of the problem the connection factory definitions on the live/backup pair are irrelevant since the application on the 3rd server is using a locally configured connection factory (i.e. JmsXA).
          2. You appear to be using the JmsXA connection factory from your application on the 3rd server in an attempt to connect to the remote live/backup pair.  However, the JmsXA connection factory is configured with <connector-ref connector-name="in-vm"/> so it has no chance at connecting to the remote live/backup pair; it will only connect to the local broker.
          3. Based on the stack-trace you pasted you also appear to be using the JmsXA connection factory to consume messages (via org.springframework.jms.listener.DefaultMessageListenerContainer).  This is an invalid configuration.  Read up on what connection factories more here.
          4. As far as the "Cannot connect to server(s). Tried with all available servers." message(s) you are seeing please provide more information on the component that is trying to connect (e.g. what the component is trying to do, what connection factory it is using, etc.).