9 Replies Latest reply: Nov 8, 2012 3:51 AM by Loic Vicqueray RSS

connecting a remote hornetQ server

Hans Steiner Newbie

Hi out there

 

I am trying to connect a jboss as 7.1.0 with another jboss that should only act as a hornetQ server (2.2.11).

 

I see that in the ejb subsystem

     <mdb>

                <resource-adapter-ref resource-adapter-name="hornetq-ra"/>

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

     </mdb>

is configured.

 

In the message subsystem I use a connector

               <connectors>

                    <connector name="netty">

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

                        <param key="host" value="xxxxx"/>

                        <param key="port" value="5745"/>

                    </connector>

                </connectors>

that is referenced from the connection pool

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

                        <transaction mode="xa"/>

                        <connectors>

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

                        </connectors>

                        <entries>

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

                        </entries>

                    </pooled-connection-factory>

 

All this works fine, except of an error/warning I receive a few seconds after I have started the server.

15:54:20,640 WARN  [org.hornetq.jms.server.recovery.HornetQXAResourceWrapper] Can't connect to any hornetq server on recovery [XARecoveryConfig [hornetQConnectionFactory=HornetQConnectionFactory [serverLocator=ServerLocatorImpl [initialConnectors=[org-hornetq-core-remoting-impl-netty-NettyConnectorFactory?port=5745&host=xxxxx], discoveryGroupConfiguration=null], clientID=null, dupsOKBatchSize=1048576, transactionBatchSize=1048576, readOnly=false], username=null, password=null]]

15:54:20,656 WARN  [com.arjuna.ats.jta] ARJUNA016027: Local XARecoveryModule.xaRecovery got XA exception XAException.XAER_RMERR: javax.transaction.xa.XAException: Error trying to connect to any providers for xa recovery

    at org.hornetq.jms.server.recovery.HornetQXAResourceWrapper.getDelegate(HornetQXAResourceWrapper.java:275) [hornetq-jms-2.2.11.Final.jar:]

    at org.hornetq.jms.server.recovery.HornetQXAResourceWrapper.recover(HornetQXAResourceWrapper.java:77) [hornetq-jms-2.2.11.Final.jar:]

    at com.arjuna.ats.internal.jta.recovery.arjunacore.XARecoveryModule.xaRecovery(XARecoveryModule.java:503) [jbossjts-4.16.2.Final.jar:]

    at com.arjuna.ats.internal.jta.recovery.arjunacore.XARecoveryModule.resourceInitiatedRecoveryForRecoveryHelpers(XARecoveryModule.java:471) [jbossjts-4.16.2.Final.jar:]

    at com.arjuna.ats.internal.jta.recovery.arjunacore.XARecoveryModule.bottomUpRecovery(XARecoveryModule.java:385) [jbossjts-4.16.2.Final.jar:]

    at com.arjuna.ats.internal.jta.recovery.arjunacore.XARecoveryModule.periodicWorkSecondPass(XARecoveryModule.java:166) [jbossjts-4.16.2.Final.jar:]

    at com.arjuna.ats.internal.arjuna.recovery.PeriodicRecovery.doWorkInternal(PeriodicRecovery.java:789) [jbossjts-4.16.2.Final.jar:]

    at com.arjuna.ats.internal.arjuna.recovery.PeriodicRecovery.run(PeriodicRecovery.java:371) [jbossjts-4.16.2.Final.jar:]

Caused by: HornetQException[errorCode=2 message=null]

    at org.hornetq.jms.server.recovery.HornetQXAResourceWrapper.connect(HornetQXAResourceWrapper.java:351) [hornetq-jms-2.2.11.Final.jar:]

    at org.hornetq.jms.server.recovery.HornetQXAResourceWrapper.getDelegate(HornetQXAResourceWrapper.java:251) [hornetq-jms-2.2.11.Final.jar:]

    ... 7 more

 

15:54:20,703 WARN  [org.hornetq.jms.server.recovery.HornetQXAResourceWrapper] Can't connect to any hornetq server on recovery [XARecoveryConfig [hornetQConnectionFactory=HornetQConnectionFactory [serverLocator=ServerLocatorImpl [initialConnectors=[org-hornetq-core-remoting-impl-netty-NettyConnectorFactory?port=5745&host=xxxxx], discoveryGroupConfiguration=null], clientID=null, dupsOKBatchSize=1048576, transactionBatchSize=1048576, readOnly=false], username=null, password=null]]

 

The queue is found and I can send and receive messages. I use annotations like this

@MessageDriven(name="MyMDB", activationConfig = {

@ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Queue"),

@ActivationConfigProperty(propertyName = "destination", propertyValue = "global/myQueue"),

@ActivationConfigProperty(propertyName = "user", propertyValue = "guest"),

@ActivationConfigProperty(propertyName = "password", propertyValue = "guest")...

for the mdb.

 

Can anybody help me with the XA warning? I suppose all I have to do is to configure username and passwort in the right manner. I read something about ra.xml and the resource-adapters subsystem, but I could not find out how to set any properties.

Perhaps there is even a better way to combine a remote hornetQ server with the use of annotations. I am not happy having the messaging subsystem (not present in a standalone.xml without hornetq) in my configuration. Can I delete some portions just leaving the client-part of the jms configuration?

 

Thx very much for help.

 

hans

  • 1. Re: connecting a remote hornetQ server
    tc7 Newbie

    Hans, I have a similar problem. My configuration is effectly the same as yours,

    eg:

                    <jms-connection-factories>

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

                            <transaction mode="xa"/>

                            <connectors>

                                <connector-ref connector-name="remote-jms"/>

                            </connectors>

                            <entries>

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

                            </entries>

                        </pooled-connection-factory>

                    </jms-connection-factories>

     

                    ....

     

                    <connectors>

                        ...

                        <connector name="remote-jms">

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

                            <param key="host" value="localhost"/> <!-- replace with remote IP address-->

                            <param key="port" value="5445"/>

                        </connector>

                    </connectors>

     

    The JMS client JBoss server connects to JMS queues hosted on the remote JBoss server. Notes on the above config available here https://community.jboss.org/message/722711#722711.

     

    I find it all works fine until the remote JBoss server is restarted, then the recovery exceptions occur, eg:

     

    20120413 16:23:29,808 WARN  [com.arjuna.ats.jta] (Periodic Recovery) ARJUNA016027: Local XARecoveryModule.xaRecovery got XA exception XAException.XAER_RMERR: javax.transaction.xa.XAException: Error trying to connect to any providers for xa recovery

              at org.hornetq.jms.server.recovery.HornetQXAResourceWrapper.getDelegate(HornetQXAResourceWrapper.java:275) [hornetq-jms-2.2.13.Final.jar:]

              at org.hornetq.jms.server.recovery.HornetQXAResourceWrapper.recover(HornetQXAResourceWrapper.java:77) [hornetq-jms-2.2.13.Final.jar:]

              at com.arjuna.ats.internal.jta.recovery.arjunacore.XARecoveryModule.xaRecovery(XARecoveryModule.java:503) [jbossjts-4.16.2.Final.jar:]

              at com.arjuna.ats.internal.jta.recovery.arjunacore.XARecoveryModule.resourceInitiatedRecoveryForRecoveryHelpers(XARecoveryModule.java:471) [jbossjts-4.16.2.Final.jar:]

              at com.arjuna.ats.internal.jta.recovery.arjunacore.XARecoveryModule.bottomUpRecovery(XARecoveryModule.java:385) [jbossjts-4.16.2.Final.jar:]

              at com.arjuna.ats.internal.jta.recovery.arjunacore.XARecoveryModule.periodicWorkSecondPass(XARecoveryModule.java:166) [jbossjts-4.16.2.Final.jar:]

              at com.arjuna.ats.internal.arjuna.recovery.PeriodicRecovery.doWorkInternal(PeriodicRecovery.java:789) [jbossjts-4.16.2.Final.jar:]

              at com.arjuna.ats.internal.arjuna.recovery.PeriodicRecovery.run(PeriodicRecovery.java:371) [jbossjts-4.16.2.Final.jar:]

    Caused by: java.lang.IllegalStateException: Cannot create session factory, server locator is closed (maybe it has been garbage collected)

              at org.hornetq.core.client.impl.ServerLocatorImpl.assertOpen(ServerLocatorImpl.java:1823) [hornetq-core-2.2.13.Final.jar:]

              at org.hornetq.core.client.impl.ServerLocatorImpl.createSessionFactory(ServerLocatorImpl.java:699) [hornetq-core-2.2.13.Final.jar:]

              at org.hornetq.jms.server.recovery.HornetQXAResourceWrapper.connect(HornetQXAResourceWrapper.java:321) [hornetq-jms-2.2.13.Final.jar:]

              at org.hornetq.jms.server.recovery.HornetQXAResourceWrapper.getDelegate(HornetQXAResourceWrapper.java:251) [hornetq-jms-2.2.13.Final.jar:]

              ... 7 more

     

     

    20120413 16:25:39,835 WARN  [com.arjuna.ats.jta] (Periodic Recovery) ARJUNA016027: Local XARecoveryModule.xaRecovery got XA exception XAException.XAER_RMERR: javax.transaction.xa.XAException: Error trying to connect to any providers for xa recovery

              at org.hornetq.jms.server.recovery.HornetQXAResourceWrapper.getDelegate(HornetQXAResourceWrapper.java:275) [hornetq-jms-2.2.13.Final.jar:]

              at org.hornetq.jms.server.recovery.HornetQXAResourceWrapper.recover(HornetQXAResourceWrapper.java:77) [hornetq-jms-2.2.13.Final.jar:]

              at com.arjuna.ats.internal.jta.recovery.arjunacore.XARecoveryModule.xaRecovery(XARecoveryModule.java:503) [jbossjts-4.16.2.Final.jar:]

              at com.arjuna.ats.internal.jta.recovery.arjunacore.XARecoveryModule.resourceInitiatedRecoveryForRecoveryHelpers(XARecoveryModule.java:471) [jbossjts-4.16.2.Final.jar:]

              at com.arjuna.ats.internal.jta.recovery.arjunacore.XARecoveryModule.bottomUpRecovery(XARecoveryModule.java:385) [jbossjts-4.16.2.Final.jar:]

              at com.arjuna.ats.internal.jta.recovery.arjunacore.XARecoveryModule.periodicWorkSecondPass(XARecoveryModule.java:166) [jbossjts-4.16.2.Final.jar:]

              at com.arjuna.ats.internal.arjuna.recovery.PeriodicRecovery.doWorkInternal(PeriodicRecovery.java:789) [jbossjts-4.16.2.Final.jar:]

              at com.arjuna.ats.internal.arjuna.recovery.PeriodicRecovery.run(PeriodicRecovery.java:371) [jbossjts-4.16.2.Final.jar:]

    Caused by: java.lang.IllegalStateException: Cannot create session factory, server locator is closed (maybe it has been garbage collected)

              at org.hornetq.core.client.impl.ServerLocatorImpl.assertOpen(ServerLocatorImpl.java:1823) [hornetq-core-2.2.13.Final.jar:]

              at org.hornetq.core.client.impl.ServerLocatorImpl.createSessionFactory(ServerLocatorImpl.java:699) [hornetq-core-2.2.13.Final.jar:]

              at org.hornetq.jms.server.recovery.HornetQXAResourceWrapper.connect(HornetQXAResourceWrapper.java:321) [hornetq-jms-2.2.13.Final.jar:]

              at org.hornetq.jms.server.recovery.HornetQXAResourceWrapper.getDelegate(HornetQXAResourceWrapper.java:251) [hornetq-jms-2.2.13.Final.jar:]

              ... 7 more

     

     

    20120413 16:27:49,861 WARN  [com.arjuna.ats.jta] (Periodic Recovery) ARJUNA016027: Local XARecoveryModule.xaRecovery got XA exception XAException.XAER_RMERR: javax.transaction.xa.XAException: Error trying to connect to any providers for xa recovery

              at org.hornetq.jms.server.recovery.HornetQXAResourceWrapper.getDelegate(HornetQXAResourceWrapper.java:275) [hornetq-jms-2.2.13.Final.jar:]

              at org.hornetq.jms.server.recovery.HornetQXAResourceWrapper.recover(HornetQXAResourceWrapper.java:77) [hornetq-jms-2.2.13.Final.jar:]

              at com.arjuna.ats.internal.jta.recovery.arjunacore.XARecoveryModule.xaRecovery(XARecoveryModule.java:503) [jbossjts-4.16.2.Final.jar:]

              at com.arjuna.ats.internal.jta.recovery.arjunacore.XARecoveryModule.resourceInitiatedRecoveryForRecoveryHelpers(XARecoveryModule.java:471) [jbossjts-4.16.2.Final.jar:]

              at com.arjuna.ats.internal.jta.recovery.arjunacore.XARecoveryModule.bottomUpRecovery(XARecoveryModule.java:385) [jbossjts-4.16.2.Final.jar:]

              at com.arjuna.ats.internal.jta.recovery.arjunacore.XARecoveryModule.periodicWorkSecondPass(XARecoveryModule.java:166) [jbossjts-4.16.2.Final.jar:]

              at com.arjuna.ats.internal.arjuna.recovery.PeriodicRecovery.doWorkInternal(PeriodicRecovery.java:789) [jbossjts-4.16.2.Final.jar:]

              at com.arjuna.ats.internal.arjuna.recovery.PeriodicRecovery.run(PeriodicRecovery.java:371) [jbossjts-4.16.2.Final.jar:]

    Caused by: java.lang.IllegalStateException: Cannot create session factory, server locator is closed (maybe it has been garbage collected)

              at org.hornetq.core.client.impl.ServerLocatorImpl.assertOpen(ServerLocatorImpl.java:1823) [hornetq-core-2.2.13.Final.jar:]

              at org.hornetq.core.client.impl.ServerLocatorImpl.createSessionFactory(ServerLocatorImpl.java:699) [hornetq-core-2.2.13.Final.jar:]

              at org.hornetq.jms.server.recovery.HornetQXAResourceWrapper.connect(HornetQXAResourceWrapper.java:321) [hornetq-jms-2.2.13.Final.jar:]

              at org.hornetq.jms.server.recovery.HornetQXAResourceWrapper.getDelegate(HornetQXAResourceWrapper.java:251) [hornetq-jms-2.2.13.Final.jar:]

              ... 7 more

     

     

    It's worth pointing out that despite the above warnings new messages are still delivered successfully.

  • 2. Re: connecting a remote hornetQ server
    Hans Steiner Newbie

    Hello

     

    I found out, that adding a user and a password would solve the problem (no more warning)

     

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

    <transaction mode="xa"/>

    <user>guest</user>

    <password>guest</password>

    <connectors>

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

    </connectors>

    <entries>

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

    </entries>

    </pooled-connection-factory>

     

     

    Unfortunately these two options are getting deleted when the server is started. So after starting the server once I have the problem again. How can it be, that options are recognized but discared during the startup?

    Any ideas?

  • 3. Re: connecting a remote hornetQ server
    srinivaas venkat Novice

    Hi, I'm using JBoss 7.1.0 Final with Hornetq 2.2.13. Final

     

    Hi, I'm also getting the same exception on starting my remote host that has the MDB that connects to the cluster of jms nodes. The moment I start my mdb rempte host, I get the below exceptions in server console on mdb as well as on the jms nodes. I have also set the user and password for pooled-connection-factory but then the same gets deleted on server start.

     

    Otherwise everything works fine with mdb, able to consume messages from cluster and sending the reply messages, just that i get the below exception andI i have not tested the xa recovery yet.

     

    MDB console log

    -------------------------

     

    08:42:02,209 INFO  [org.jboss.as.server] (DeploymentScanner-threads - 2) JBAS018559: Deployed "mdb.jar"
    08:42:10,463 WARN  [org.hornetq.jms.server.recovery.HornetQXAResourceWrapper] (Periodic Recovery) Can't connect to any hornetq server on recovery [XARecoveryConfig [hornetQConnectionFactory=HornetQConnectionFactory [serverLocator=ServerLocatorImpl [initialConnectors=[org-hornetq-core-remoting-impl-netty-NettyConnectorFactory?port=5445&host=jms_node1, org-hornetq-core-remoting-impl-netty-NettyConnectorFactory?port=5445&host=jms_node2], discoveryGroupConfiguration=null], clientID=null, dupsOKBatchSize=1048576, transactionBatchSize=1048576,], username=null, password=null]]
    08:42:10,474 WARN  [com.arjuna.ats.jta] (Periodic Recovery) ARJUNA016027: Local XARecoveryModule.xaRecovery got XA exception XAException.XAER_RMERR: javax.transaction.xa.XAException: Error trying to connect to any providers for xa recovery
            at org.hornetq.jms.server.recovery.HornetQXAResourceWrapper.getDelegate(HornetQXAResourceWrapper.java:275) [hornetq-jms-2.2.13.Final.jar:]
            at org.hornetq.jms.server.recovery.HornetQXAResourceWrapper.recover(HornetQXAResourceWrapper.java:77) [hornetq-jms-2.2.13.Final.jar:]
            at com.arjuna.ats.internal.jta.recovery.arjunacore.XARecoveryModule.xaRecovery(XARecoveryModule.java:503) [jbossjts-4.16.2.Final.jar:]
            at com.arjuna.ats.internal.jta.recovery.arjunacore.XARecoveryModule.resourceInitiatedRecoveryForRecoveryHelpers(XARecoveryModule.java:471) [jbossjts-4.16.2.Final.jar:]
            at com.arjuna.ats.internal.jta.recovery.arjunacore.XARecoveryModule.bottomUpRecovery(XARecoveryModule.java:385) [jbossjts-4.16.2.Final.jar:]
            at com.arjuna.ats.internal.jta.recovery.arjunacore.XARecoveryModule.periodicWorkSecondPass(XARecoveryModule.java:166) [jbossjts-4.16.2.Final.jar:]
            at com.arjuna.ats.internal.arjuna.recovery.PeriodicRecovery.doWorkInternal(PeriodicRecovery.java:789) [jbossjts-4.16.2.Final.jar:]
            at com.arjuna.ats.internal.arjuna.recovery.PeriodicRecovery.run(PeriodicRecovery.java:371) [jbossjts-4.16.2.Final.jar:]
    Caused by: HornetQException[errorCode=2 message=null]
            at org.hornetq.jms.server.recovery.HornetQXAResourceWrapper.connect(HornetQXAResourceWrapper.java:351) [hornetq-jms-2.2.13.Final.jar:]
            at org.hornetq.jms.server.recovery.HornetQXAResourceWrapper.getDelegate(HornetQXAResourceWrapper.java:251) [hornetq-jms-2.2.13.Final.jar:]
            ... 7 more

    08:42:10,513 WARN  [org.hornetq.jms.server.recovery.HornetQXAResourceWrapper] (Periodic Recovery) Can't connect to any hornetq server on recovery [XARecoveryConfig [hornetQConnectionFactory=HornetQConnectionFactory [serverLocator=ServerLocatorImpl [initialConnectors=[org-hornetq-core-remoting-impl-netty-NettyConnectorFactory?port=5445&host=jms_node1, org-hornetq-core-remoting-impl-netty-NettyConnectorFactory?port=5445&host=jms_node2], discoveryGroupConfiguration=null], clientID=null, dupsOKBatchSize=1048576, transactionBatchSize=1048576,], username=null, password=null]]


    This message repeats every 2 mins

     

    JMS node log

    --------------------

    .09:17:12,889 ERROR [org.hornetq.core.protocol.core.impl.HornetQPacketHandler] (Old I/O server worker (parentId: 1705769926, [id: 0x65abfbc6, jms_node1/a.b.c.d:5445])) Failed to create session : HornetQException[errorCode=105 message=Unable to validate user: null]
            at org.hornetq.core.security.impl.SecurityStoreImpl.authenticate(SecurityStoreImpl.java:147) [hornetq-core-2.2.13.Final.jar:]
            at org.hornetq.core.server.impl.HornetQServerImpl.createSession(HornetQServerImpl.java:807) [hornetq-core-2.2.13.Final.jar:]
            at org.hornetq.core.protocol.core.impl.HornetQPacketHandler.handleCreateSession(HornetQPacketHandler.java:187) [hornetq-core-2.2.13.Final.jar:]
            at org.hornetq.core.protocol.core.impl.HornetQPacketHandler.handlePacket(HornetQPacketHandler.java:85) [hornetq-core-2.2.13.Final.jar:]
            at org.hornetq.core.protocol.core.impl.ChannelImpl.handlePacket(ChannelImpl.java:508) [hornetq-core-2.2.13.Final.jar:]

  • 4. Re: connecting a remote hornetQ server
    srinivaas venkat Novice

    One more observationn is that the mdb node console log shows the host name as JmsNode1-org-int and JmsNode2-org-int, Should it not be JmsNode1.org.int and JmsNode2.org.int as I've specified in the standalone-full-xa.xml? From where does it pick the value for host in the intialCconnectors spec using the hyphens I'm not sure..

     

    [initialConnectors=[org-hornetq-core-remoting-impl-netty-NettyConnectorFactory?port=5445&host=JmsNode1-org-int, org-hornetq-core-remoting-impl-netty-NettyConnectorFactory?port=5445&host=JmsNode2-org-int],

    .

  • 5. Re: connecting a remote hornetQ server
    Jeff Mesnil Master

      Unfortunately these two options are getting deleted when the server is started. So after starting the server once I have the problem again. How can it be, that options are recognized but discared during the startup?

    Any ideas?

    It was a bug that has been fixed in AS7 7.1.2 (https://issues.jboss.org/browse/AS7-4521)

  • 6. Re: connecting a remote hornetQ server
    andrzej sochal Newbie

    I have a similar problem. My scenario is as follows:

    Messages are being sent from jboss-4.2.1.GA to a remote stand alone hornetq-2.2.14.Final.

    There is an MDB deployed on jboss-7.1.1.Final node that listens to the remote stand alone hornetq-2.2.14.Final queue.

    Everything seems to be working fine up to the point where there is a disconnection

    between jboss 7 node and hornetq. For example, when hornetq is shut down and then brought back up, jboss

    jboss 7 is not able to reconnect to hornetq. Jboss 4 on the other hand is able to send messages to hornetq but messages are not

    being consumed by MDB.

     

     

    This warning happens every two minutes on jboss 7 node:

     

    2012-09-13 07:59:26,904 WARN  [com.arjuna.ats.jta] (Periodic Recovery:) ARJUNA016027: Local XARecoveryModule.xaRecovery got XA exception XAException.XAER_RMERR: javax.transaction.xa.XAException: Error

    trying to connect to any providers for xa recovery

            at org.hornetq.jms.server.recovery.HornetQXAResourceWrapper.getDelegate(HornetQXAResourceWrapper.java:275)

            at org.hornetq.jms.server.recovery.HornetQXAResourceWrapper.recover(HornetQXAResourceWrapper.java:77)

            at com.arjuna.ats.internal.jta.recovery.arjunacore.XARecoveryModule.xaRecovery(XARecoveryModule.java:503)

            at com.arjuna.ats.internal.jta.recovery.arjunacore.XARecoveryModule.resourceInitiatedRecoveryForRecoveryHelpers(XARecoveryModule.java:471)

            at com.arjuna.ats.internal.jta.recovery.arjunacore.XARecoveryModule.bottomUpRecovery(XARecoveryModule.java:385)

            at com.arjuna.ats.internal.jta.recovery.arjunacore.XARecoveryModule.periodicWorkSecondPass(XARecoveryModule.java:166)

            at com.arjuna.ats.internal.arjuna.recovery.PeriodicRecovery.doWorkInternal(PeriodicRecovery.java:789)

            at com.arjuna.ats.internal.arjuna.recovery.PeriodicRecovery.run(PeriodicRecovery.java:371)

    Caused by: java.lang.IllegalStateException: Cannot create session factory, server locator is closed (maybe it has been garbage collected)

            at org.hornetq.core.client.impl.ServerLocatorImpl.assertOpen(ServerLocatorImpl.java:1823)

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

            at org.hornetq.jms.server.recovery.HornetQXAResourceWrapper.connect(HornetQXAResourceWrapper.java:321)

            at org.hornetq.jms.server.recovery.HornetQXAResourceWrapper.getDelegate(HornetQXAResourceWrapper.java:251)

            ... 7 more

     

     

     

     

    After doing some research, I found that:

     

    HornetQXAResourceWrapper located in JBOSS_HOME\modules\org\hornetq\main\hornetq-jms-2.2.13.Final.jar

    is trying to connect to HornetQ in this method:

    public XAResource getDelegate(boolean retry){

      XAResource result = null;

         Exception error = null;

         try

         {

          result = connect();

         }

         catch (Exception e)

         {

           error = e;

         }

         ...

     

     

    The connect method is getting ServerLocatorImp object and calls createSessionFactory method on it

     

     

        ...

        this.serverLocator = xaRecoveryConfig.getHornetQConnectionFactory().getServerLocator();

        this.serverLocator.disableFinalizeCheck();

        this.csf = this.serverLocator.createSessionFactory();

        ...

     

     

    The createSessionFactory method of ServerLocatorImpl (hornetq-core-2.2.13.Final) is checking for ServerLocator state.

    If it is NOT null and NOT initialized then it throws this exception.

     

     

     

        if (state != null && state != STATE.INITIALIZED)

        {

             throw new IllegalStateException("Cannot create session factory, server locator is closed (maybe it has been garbage collected)");

        }

     

     

    When I manually change state to null, this exception is no longer thrown and the state gets initialized again.

     

     

     

    When there is a disconnection, it looks like state gets set to CLOSED which is triggering this exception.

    Instead, shouldn't state be set to NULL on disconnect to allow for reconnections.

    Is this a bug???

  • 7. Re: connecting a remote hornetQ server
    Loic Vicqueray Newbie

    Hi,

     

    We are working with 7.1.0 Final with Hornetq 2.2.11. Final and we have the same problem...

     

    if (state != null && state != STATE.INITIALIZED)

        {

             throw new IllegalStateException("Cannot create session factory, server locator is closed (maybe it has been garbage collected)");

        }

     

    The exception is throwed. Why the exception is throwed, have you any solutions to solve this problem.

     

    Thank for your response...

  • 9. Re: connecting a remote hornetQ server
    Loic Vicqueray Newbie

    Hi,

     

    I think the issue is resolved here : https://community.jboss.org/message/760905