1 2 Previous Next 15 Replies Latest reply on May 9, 2013 6:19 PM by mautner.adam

    Message Driven Bean cannot publish messages to Standalone HornetQ after HornetQ Failover

    mautner.adam

      Hi All,

       

      I am evaluating JBoss and HornetQ for building production systems. Both of them looks like a good product with nice feature set.

       

      I am experimenting with a simple HA setup for Message Driven Beans (MDBs), I have a Standalone Live/Backup HornetQ pair in a cluster (using UDP Server Discovery).

       

      MDB is deployed to a JBoss AS 7 (with no queues). When I start JBoss it starts consuming the messages from a queue and starts publishing to a topic.

       

      When I stop the live HornetQ, MDB fails over to the backup and continues message consumption, but message publish fails with the following exceptions:

       

      10:52:18,464 ERROR [org.hornetq.ra.HornetQRASessionFactoryImpl] (Thread-19 (HornetQ-client-global-threads-578093986)) Could not create session:

       

      javax.resource.ResourceException: IJ000453: Unable to get managed connection for java:/ConnectionFactory1Mgmt

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

          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:837)

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

          at org.jboss.as.quickstarts.mdb.HelloWorldQueueMDB.onMessage(HelloWorldQueueMDB.java:98) [classes:]

          at sun.reflect.GeneratedMethodAccessor5.invoke(Unknown Source) [:1.7.0_17]

          at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) [rt.jar:1.7.0_17]

          at java.lang.reflect.Method.invoke(Unknown Source) [rt.jar:1.7.0_17]

          at org.jboss.as.ee.component.ManagedReferenceMethodInterceptorFactory$ManagedReferenceMethodInterceptor.processInvocation

       

      (ManagedReferenceMethodInterceptorFactory.java:72) [jboss-as-ee-7.1.1.Final.jar:7.1.1.Final]

          at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]

          at org.jboss.invocation.WeavedInterceptor.processInvocation(WeavedInterceptor.java:53) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]

          at org.jboss.as.ee.component.interceptors.UserInterceptorFactory$1.processInvocation(UserInterceptorFactory.java:36) [jboss-as-ee-7.1.1.Final.jar:7.1.1.Final]

          at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]

          at org.jboss.invocation.InitialInterceptor.processInvocation(InitialInterceptor.java:21) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]

          at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]

          at org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]

          at org.jboss.as.ee.component.interceptors.ComponentDispatcherInterceptor.processInvocation(ComponentDispatcherInterceptor.java:53) [jboss-as-ee-

       

      7.1.1.Final.jar:7.1.1.Final]

          at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]

          at org.jboss.as.ejb3.component.pool.PooledInstanceInterceptor.processInvocation(PooledInstanceInterceptor.java:51) [jboss-as-ejb3-7.1.1.Final.jar:7.1.1.Final]

          at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]

          at org.jboss.as.ejb3.tx.CMTTxInterceptor.invokeInCallerTx(CMTTxInterceptor.java:202) [jboss-as-ejb3-7.1.1.Final.jar:7.1.1.Final]

          at org.jboss.as.ejb3.tx.CMTTxInterceptor.required(CMTTxInterceptor.java:306) [jboss-as-ejb3-7.1.1.Final.jar:7.1.1.Final]

          at org.jboss.as.ejb3.tx.CMTTxInterceptor.processInvocation(CMTTxInterceptor.java:190) [jboss-as-ejb3-7.1.1.Final.jar:7.1.1.Final]

          at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]

          at org.jboss.as.ejb3.component.interceptors.CurrentInvocationContextInterceptor.processInvocation(CurrentInvocationContextInterceptor.java:41) [jboss-as-ejb3-

       

      7.1.1.Final.jar:7.1.1.Final]

          at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]

          at org.jboss.as.ejb3.component.interceptors.LoggingInterceptor.processInvocation(LoggingInterceptor.java:59) [jboss-as-ejb3-7.1.1.Final.jar:7.1.1.Final]

          at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]

          at org.jboss.as.ee.component.NamespaceContextInterceptor.processInvocation(NamespaceContextInterceptor.java:50) [jboss-as-ee-7.1.1.Final.jar:7.1.1.Final]

          at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]

          at org.jboss.as.ejb3.component.interceptors.AdditionalSetupInterceptor.processInvocation(AdditionalSetupInterceptor.java:43) [jboss-as-ejb3-

       

      7.1.1.Final.jar:7.1.1.Final]

          at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]

          at org.jboss.as.ejb3.component.messagedriven.MessageDrivenComponentDescription$5$1.processInvocation(MessageDrivenComponentDescription.java:184) [jboss-as-

       

      ejb3-7.1.1.Final.jar:7.1.1.Final]

          at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]

          at org.jboss.as.ee.component.TCCLInterceptor.processInvocation(TCCLInterceptor.java:45) [jboss-as-ee-7.1.1.Final.jar:7.1.1.Final]

          at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]

          at org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]

          at org.jboss.as.ee.component.ViewService$View.invoke(ViewService.java:165) [jboss-as-ee-7.1.1.Final.jar:7.1.1.Final]

          at org.jboss.as.ee.component.ViewDescription$1.processInvocation(ViewDescription.java:173) [jboss-as-ee-7.1.1.Final.jar:7.1.1.Final]

          at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]

          at org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]

          at org.jboss.as.ee.component.ProxyInvocationHandler.invoke(ProxyInvocationHandler.java:72) [jboss-as-ee-7.1.1.Final.jar:7.1.1.Final]

          at javax.jms.MessageListener$$$view1.onMessage(Unknown Source) [jboss-jms-api_1.1_spec-1.0.0.Final.jar:1.0.0.Final]

          at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source) [:1.7.0_17]

          at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) [rt.jar:1.7.0_17]

          at java.lang.reflect.Method.invoke(Unknown Source) [rt.jar:1.7.0_17]

          at org.jboss.as.ejb3.inflow.MessageEndpointInvocationHandler.doInvoke(MessageEndpointInvocationHandler.java:140) [jboss-as-ejb3-7.1.1.Final.jar:7.1.1.Final]

          at org.jboss.as.ejb3.inflow.AbstractInvocationHandler.invoke(AbstractInvocationHandler.java:73) [jboss-as-ejb3-7.1.1.Final.jar:7.1.1.Final]

          at com.sun.proxy.$Proxy13.onMessage(Unknown Source)

          at org.hornetq.ra.inflow.HornetQMessageHandler.onMessage(HornetQMessageHandler.java:278)

          at org.hornetq.core.client.impl.ClientConsumerImpl.callOnMessage(ClientConsumerImpl.java:983)

          at org.hornetq.core.client.impl.ClientConsumerImpl.access$400(ClientConsumerImpl.java:48)

          at org.hornetq.core.client.impl.ClientConsumerImpl$Runner.run(ClientConsumerImpl.java:1113)

          at org.hornetq.utils.OrderedExecutorFactory$OrderedExecutor$1.run(OrderedExecutorFactory.java:100)

          at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) [rt.jar:1.7.0_17]

          at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) [rt.jar:1.7.0_17]

          at java.lang.Thread.run(Unknown Source) [rt.jar:1.7.0_17]

      Caused by: javax.resource.ResourceException: IJ000658: Unexpected throwable while trying to create a connection: null

          at org.jboss.jca.core.connectionmanager.pool.mcp.SemaphoreArrayListManagedConnectionPool.getConnection(SemaphoreArrayListManagedConnectionPool.java:371)

          at org.jboss.jca.core.connectionmanager.pool.AbstractPool.getTransactionNewConnection(AbstractPool.java:495)

          at org.jboss.jca.core.connectionmanager.pool.AbstractPool.getConnection(AbstractPool.java:374)

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

          ... 57 more

      Caused by: javax.resource.ResourceException: Error during setup

          at org.hornetq.ra.HornetQRAManagedConnection.<init>(HornetQRAManagedConnection.java:152)

          at org.hornetq.ra.HornetQRAManagedConnectionFactory.createManagedConnection(HornetQRAManagedConnectionFactory.java:180)

          at org.jboss.jca.core.connectionmanager.pool.mcp.SemaphoreArrayListManagedConnectionPool.createConnectionEventListener

       

      (SemaphoreArrayListManagedConnectionPool.java:761)

          at org.jboss.jca.core.connectionmanager.pool.mcp.SemaphoreArrayListManagedConnectionPool.getConnection(SemaphoreArrayListManagedConnectionPool.java:343)

          ... 60 more

      Caused by: javax.resource.ResourceException: Failed to create session factory

          at org.hornetq.ra.HornetQRAManagedConnection.setup(HornetQRAManagedConnection.java:821)

          at org.hornetq.ra.HornetQRAManagedConnection.<init>(HornetQRAManagedConnection.java:141)

          ... 63 more

      Caused by: javax.jms.JMSException: Failed to create session factory

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

          at org.hornetq.jms.client.HornetQConnectionFactory.createXAConnection(HornetQConnectionFactory.java:155)

          at org.hornetq.jms.client.HornetQConnectionFactory.createXAConnection(HornetQConnectionFactory.java:150)

          at org.hornetq.ra.HornetQRAManagedConnection.setup(HornetQRAManagedConnection.java:810)

          ... 64 more

      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)

          ... 67 more

       

      10:52:18,507 ERROR [org.jboss.as.ejb3.tx.CMTTxInterceptor] (Thread-19 (HornetQ-client-global-threads-578093986)) javax.ejb.EJBTransactionRolledbackException:

       

      javax.jms.JMSException: Could not create a session: IJ000453: Unable to get managed connection for java:/ConnectionFactory1Mgmt

      10:52:18,508 ERROR [org.jboss.ejb3.invocation] (Thread-19 (HornetQ-client-global-threads-578093986)) JBAS014134: EJB Invocation failed on component HelloWorldQueueMDB

       

      for method public abstract void javax.jms.MessageListener.onMessage(javax.jms.Message): javax.ejb.EJBTransactionRolledbackException: javax.jms.JMSException: Could not

       

      create a session: IJ000453: Unable to get managed connection for java:/ConnectionFactory1Mgmt

          at org.jboss.as.ejb3.tx.CMTTxInterceptor.handleInCallerTx(CMTTxInterceptor.java:139) [jboss-as-ejb3-7.1.1.Final.jar:7.1.1.Final]

          at org.jboss.as.ejb3.tx.CMTTxInterceptor.invokeInCallerTx(CMTTxInterceptor.java:204) [jboss-as-ejb3-7.1.1.Final.jar:7.1.1.Final]

          at org.jboss.as.ejb3.tx.CMTTxInterceptor.required(CMTTxInterceptor.java:306) [jboss-as-ejb3-7.1.1.Final.jar:7.1.1.Final]

          at org.jboss.as.ejb3.tx.CMTTxInterceptor.processInvocation(CMTTxInterceptor.java:190) [jboss-as-ejb3-7.1.1.Final.jar:7.1.1.Final]

          at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]

          at org.jboss.as.ejb3.component.interceptors.CurrentInvocationContextInterceptor.processInvocation(CurrentInvocationContextInterceptor.java:41) [jboss-as-ejb3-

       

      7.1.1.Final.jar:7.1.1.Final]

          at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]

          at org.jboss.as.ejb3.component.interceptors.LoggingInterceptor.processInvocation(LoggingInterceptor.java:59) [jboss-as-ejb3-7.1.1.Final.jar:7.1.1.Final]

          at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]

          at org.jboss.as.ee.component.NamespaceContextInterceptor.processInvocation(NamespaceContextInterceptor.java:50) [jboss-as-ee-7.1.1.Final.jar:7.1.1.Final]

          at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]

          at org.jboss.as.ejb3.component.interceptors.AdditionalSetupInterceptor.processInvocation(AdditionalSetupInterceptor.java:43) [jboss-as-ejb3-

       

      7.1.1.Final.jar:7.1.1.Final]

          at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]

          at org.jboss.as.ejb3.component.messagedriven.MessageDrivenComponentDescription$5$1.processInvocation(MessageDrivenComponentDescription.java:184) [jboss-as-

       

      ejb3-7.1.1.Final.jar:7.1.1.Final]

          at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]

          at org.jboss.as.ee.component.TCCLInterceptor.processInvocation(TCCLInterceptor.java:45) [jboss-as-ee-7.1.1.Final.jar:7.1.1.Final]

          at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]

          at org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]

          at org.jboss.as.ee.component.ViewService$View.invoke(ViewService.java:165) [jboss-as-ee-7.1.1.Final.jar:7.1.1.Final]

          at org.jboss.as.ee.component.ViewDescription$1.processInvocation(ViewDescription.java:173) [jboss-as-ee-7.1.1.Final.jar:7.1.1.Final]

          at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]

          at org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]

          at org.jboss.as.ee.component.ProxyInvocationHandler.invoke(ProxyInvocationHandler.java:72) [jboss-as-ee-7.1.1.Final.jar:7.1.1.Final]

          at javax.jms.MessageListener$$$view1.onMessage(Unknown Source) [jboss-jms-api_1.1_spec-1.0.0.Final.jar:1.0.0.Final]

          at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source) [:1.7.0_17]

          at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) [rt.jar:1.7.0_17]

          at java.lang.reflect.Method.invoke(Unknown Source) [rt.jar:1.7.0_17]

          at org.jboss.as.ejb3.inflow.MessageEndpointInvocationHandler.doInvoke(MessageEndpointInvocationHandler.java:140) [jboss-as-ejb3-7.1.1.Final.jar:7.1.1.Final]

          at org.jboss.as.ejb3.inflow.AbstractInvocationHandler.invoke(AbstractInvocationHandler.java:73) [jboss-as-ejb3-7.1.1.Final.jar:7.1.1.Final]

          at com.sun.proxy.$Proxy13.onMessage(Unknown Source)

          at org.hornetq.ra.inflow.HornetQMessageHandler.onMessage(HornetQMessageHandler.java:278)

          at org.hornetq.core.client.impl.ClientConsumerImpl.callOnMessage(ClientConsumerImpl.java:983)

          at org.hornetq.core.client.impl.ClientConsumerImpl.access$400(ClientConsumerImpl.java:48)

          at org.hornetq.core.client.impl.ClientConsumerImpl$Runner.run(ClientConsumerImpl.java:1113)

          at org.hornetq.utils.OrderedExecutorFactory$OrderedExecutor$1.run(OrderedExecutorFactory.java:100)

          at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) [rt.jar:1.7.0_17]

          at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) [rt.jar:1.7.0_17]

          at java.lang.Thread.run(Unknown Source) [rt.jar:1.7.0_17]

      Caused by: java.lang.RuntimeException: javax.jms.JMSException: Could not create a session: IJ000453: Unable to get managed connection for java:/ConnectionFactory1Mgmt

          at org.jboss.as.quickstarts.mdb.HelloWorldQueueMDB.onMessage(HelloWorldQueueMDB.java:112) [classes:]

          at sun.reflect.GeneratedMethodAccessor5.invoke(Unknown Source) [:1.7.0_17]

          at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) [rt.jar:1.7.0_17]

          at java.lang.reflect.Method.invoke(Unknown Source) [rt.jar:1.7.0_17]

          at org.jboss.as.ee.component.ManagedReferenceMethodInterceptorFactory$ManagedReferenceMethodInterceptor.processInvocation

       

      (ManagedReferenceMethodInterceptorFactory.java:72) [jboss-as-ee-7.1.1.Final.jar:7.1.1.Final]

          at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]

          at org.jboss.invocation.WeavedInterceptor.processInvocation(WeavedInterceptor.java:53) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]

          at org.jboss.as.ee.component.interceptors.UserInterceptorFactory$1.processInvocation(UserInterceptorFactory.java:36) [jboss-as-ee-7.1.1.Final.jar:7.1.1.Final]

          at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]

          at org.jboss.invocation.InitialInterceptor.processInvocation(InitialInterceptor.java:21) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]

          at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]

          at org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]

          at org.jboss.as.ee.component.interceptors.ComponentDispatcherInterceptor.processInvocation(ComponentDispatcherInterceptor.java:53) [jboss-as-ee-

       

      7.1.1.Final.jar:7.1.1.Final]

          at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]

          at org.jboss.as.ejb3.component.pool.PooledInstanceInterceptor.processInvocation(PooledInstanceInterceptor.java:51) [jboss-as-ejb3-7.1.1.Final.jar:7.1.1.Final]

          at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]

          at org.jboss.as.ejb3.tx.CMTTxInterceptor.invokeInCallerTx(CMTTxInterceptor.java:202) [jboss-as-ejb3-7.1.1.Final.jar:7.1.1.Final]

          ... 36 more

      Caused by: javax.jms.JMSException: Could not create a session: IJ000453: Unable to get managed connection for java:/ConnectionFactory1Mgmt

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

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

          at org.jboss.as.quickstarts.mdb.HelloWorldQueueMDB.onMessage(HelloWorldQueueMDB.java:98) [classes:]

          ... 52 more

       

       

       

      I have also tried the failover with a persistent queue, but I got the same result. 

       

      I am using hornetq-2.3.0.CR2 and jboss-as-7.1.1.Final. Standalone HornetQ is configured to use replicated HA failover. I am running JBoss from Eclipse in standalone mode.

       

      I have the following messaging config in JBoss standalone config:

       

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

                  <hornetq-server>

       

                      <discovery-groups>

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

                              <group-address>231.7.7.7</group-address>

                              <group-port>9876</group-port>

                              <refresh-timeout>10000</refresh-timeout>

                          </discovery-group>

                      </discovery-groups>

       

                      <jms-connection-factories>

                          <connection-factory name="ConnectionFactory1NonMgmt">

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

                              <entries>

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

                              </entries>

                              <ha>true</ha>

                              <reconnect-attempts>-1</reconnect-attempts>

                          </connection-factory>

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

                              <transaction mode="xa"/>

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

                              <entries>

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

                              </entries>

                              <ha>true</ha>

                              <reconnect-attempts>-1</reconnect-attempts>

                          </pooled-connection-factory>

                      </jms-connection-factories>

              </hornetq-server>

              </subsystem>

       

      My MDB is annotated with:

       

      @ResourceAdapter("ConnectionFactory1Mgmt")

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

              @ActivationConfigProperty(propertyName = "reconnectAttempts", propertyValue = "-1"),

              @ActivationConfigProperty(propertyName = "hA", propertyValue = "true"),

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

              @ActivationConfigProperty(propertyName = "destination", propertyValue = "/queue/exampleQueue"),

              @ActivationConfigProperty(propertyName = "acknowledgeMode", propertyValue = "Auto-acknowledge") })

       

      Messages are received transactionally using:

       

          @TransactionAttribute(TransactionAttributeType.REQUIRED)

          public void onMessage(Message rcvMessage) { ...

       

      Messages are sent using the following code:

       

                  try {

       

                      Destination destination;

       

                      // InitialContext ic = new InitialContext();

                      // ConnectionFactory connectionFactory =

                      // (ConnectionFactory)ic.lookup("java:/ConnectionFactory1Mgmt");

       

                      connection = connectionFactory.createConnection();

                      session = connection.createSession(false,

                              Session.AUTO_ACKNOWLEDGE);

                      destination = session.createTopic("exampleTopic");

       

                      messageProducer = session.createProducer(destination);

                      connection.start();

                      TextMessage message = session.createTextMessage();

       

                      message.setText(text);

                      messageProducer.send(message);

       

                      LOGGER.warning("Message PUBLISHED: " + text);

       

                  } catch (Exception e) {

                      throw new RuntimeException(e);

                  } finally {

       

                      if (connection != null) {

                          try {

                              connection.close();

                          } catch (JMSException e) {

                              throw new RuntimeException(e);

                          }

                      }

                  }

       

      I have attached all the configuration and the Eclipse project.

       

      What do I do wrong? I have been searching forums for the solution, but I could not find anything. Please help.

       

      Best regards,

       

      Adam

        • 1. Re: Message Driven Bean cannot publish messages to Standalone HornetQ after HornetQ Failover
          mautner.adam

          Hi All,

           

          Can somebody please reply to this question? Possibly from the HornetQ team. I am really stuck with this.

           

          Any comment or help would be appreciated.

           

          Thanks.

           

          Regards,

           

          Adam

          • 2. Re: Message Driven Bean cannot publish messages to Standalone HornetQ after HornetQ Failover
            ataylor

            the config looks ok

             

            Any chance you could write an arquillian test to demonstrate the issue. you could base it on the mdb-remote-failover javaee example we have.

            • 3. Re: Message Driven Bean cannot publish messages to Standalone HornetQ after HornetQ Failover
              mautner.adam

              Hi Andy,

               

              Thank you for getting back to me.

               

              I'm not sure, if  I can create an arquillian for reproducing the issue (I don't have too much experience with arquillian + test involves stopping remote HornetQ, not sure how to do it from the test). I can provide a manual process to repoduce the issue, I hope that will help (I have attached the configs and codes in the first message).

               

              1. start a standalone HornetQ (using replicated-server-1-Live.zip)

              2. start a second standalone HornetQ (using replicated-server-1-Backup.zip) - wait for the backup to fully syncronize

              3. start HelloWorldJMSClient as java application (from helloworld-jms-remote-ha-hornetq.zip - forgot to attach in the first message, I will attach now) - this will put messages onto the queue

              4. start JBoss 7 (using standalone-jms-ejb-mysql-standalone-replicated-hornetq-ha.xml, the rest of the configs are the default ones) - I did it from Eclipse

              5. deploy helloworld-mdb-remote-ha-hornetq (from helloworld-mdb-remote-ha-hornetq.zip)

              6. see messages received and published correctly

              7. kill HornetQ with replicated-server-1-Live config

              8. messages will continue be received (after a few failed transactions), but send will not work anymore

               

              Please let mw know, if you need more information.

               

              Thank you,

               

              Adam

              • 4. Re: Message Driven Bean cannot publish messages to Standalone HornetQ after HornetQ Failover
                mautner.adam

                I have also created a config with no MySQL in it (standalone-jms-ejb-standalone-replicated-hornetq-ha.xml) attacheched to the original message.

                 

                Adam

                • 5. Re: Message Driven Bean cannot publish messages to Standalone HornetQ after HornetQ Failover
                  ataylor

                  I'll try and look at this towards the end of the week

                  • 6. Re: Message Driven Bean cannot publish messages to Standalone HornetQ after HornetQ Failover
                    mautner.adam

                    Hi Andy,

                     

                    Thank you. I have also tried hornetq-2.3.0.Final version, I got the same errors.

                     

                    Regards,

                     

                    Adam

                    • 7. Re: Message Driven Bean cannot publish messages to Standalone HornetQ after HornetQ Failover
                      clebert.suconic

                      our QE department also found the same error ... and I'm fully on it now... and your example here is being quite handy.... 

                       

                       

                      I will keep you informed.. thanks a lot for the help so far... I will keep you posted here.

                      • 8. Re: Message Driven Bean cannot publish messages to Standalone HornetQ after HornetQ Failover
                        mautner.adam

                        Hi Clebert,

                         

                        Thank you. Good to hear, that you are working on the issue and also that you can use the example.

                         

                        Looking forward to hear back from you.

                         

                        Regards,

                         

                        Adam

                        • 9. Re: Message Driven Bean cannot publish messages to Standalone HornetQ after HornetQ Failover
                          clebert.suconic

                          I could make a failover fine after 2.3.1. You just need to define HA at the pooled connection factory and it works fine.

                           

                          2.3.0.CR2 would work fine. 2.3.0.Final had a problem, and 2.3.1 had it fixed which will be included on Wildfly.

                          • 10. Re: Message Driven Bean cannot publish messages to Standalone HornetQ after HornetQ Failover
                            mautner.adam

                            Hi Clebert,

                             

                            I was trying the failover with 2.3.0.CR1, 2.3.0.CR2 and 2.3.0.Final. Failover on the MDB worked fine, when it comes to receiving the messages, but publish/send from the MDB was not working after failover with any of these versions.

                             

                            I have set up the HA pooled connection in the config and on the MDB as well.

                             

                            JBoss Config:

                             

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

                                                    <transaction mode="xa"/>

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

                                                    <entries>

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

                                                    </entries>

                                                    <ha>true</ha>

                                                    <reconnect-attempts>-1</reconnect-attempts>

                                                </pooled-connection-factory>

                             

                            MDB Annotations:

                             

                            @ResourceAdapter("ConnectionFactory1Mgmt")

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

                                    @ActivationConfigProperty(propertyName = "reconnectAttempts", propertyValue = "-1"),

                                    @ActivationConfigProperty(propertyName = "hA", propertyValue = "true"),

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

                                    @ActivationConfigProperty(propertyName = "destination", propertyValue = "/queue/exampleQueue"),

                                    @ActivationConfigProperty(propertyName = "acknowledgeMode", propertyValue = "Auto-acknowledge") })

                             

                            Is there any other place I can/need to set up HA?

                             

                            How can I get 2.3.1 version?

                             

                            Regards,

                             

                            Adam

                            • 11. Re: Message Driven Bean cannot publish messages to Standalone HornetQ after HornetQ Failover
                              mautner.adam

                              Hi Clebert,

                               

                              Do you have any update on this? Is there anything I can try out? Do you need more infomation for reproducing the problem?

                               

                              Regards,

                               

                              Adam

                              • 12. Re: Message Driven Bean cannot publish messages to Standalone HornetQ after HornetQ Failover
                                clebert.suconic

                                you can get the 2.3.1 by checking out on git, or setting 2.3.1 on maven case you're using maven.

                                 

                                Another way is to get Wildfly's snapshot which has 2.3.1... or maybe get the next EAP to be released soon.

                                 

                                 

                                 

                                I just tried a case similar to yours and it worked well.

                                • 13. Re: Message Driven Bean cannot publish messages to Standalone HornetQ after HornetQ Failover
                                  mautner.adam

                                  Hi Clebert,

                                   

                                  Thank you for the quick reply.

                                   

                                  Just for me to understand, where the issue is. In HornetQ (I am using HornetQ standalone hornetq-2.3.0.Final) or in JBoss AS 7 (jboss-as-7.1.1.Final)? Will upgrade of JBoss AS (to next EAP or Wildfly) solve the issue (even if I keep current version of HornetQ)? Or should I upgrade my standalone HornetQ to the next version?

                                   

                                  Regards,

                                   

                                  Adam

                                  • 14. Re: Message Driven Bean cannot publish messages to Standalone HornetQ after HornetQ Failover
                                    clebert.suconic

                                    The issue was on the resource adapter on 2.3.0. So, that should be fine.

                                     

                                    If you keep your client aligned with 2.3.1 it's probably best. There's an issue though with replacing client libraries with JBoss7/wildfly as you need to unpack and redo the jboss-all-client.

                                     

                                    There's a script I use here when I'm debugging my own releases:

                                     

                                     

                                    # Set this to the version your pom is built on hornetq/master or the tag you have

                                    export VERSION="2.3.2-SNAPSHOT"

                                    #replace jars

                                    cp ./hornetq-core-client/target/hornetq-core-client-$VERSION.jar $JBOSS_HOME/modules/system/layers/base/org/hornetq/main/hornetq-core-client*.jar

                                    cp ./hornetq-server/target/hornetq-server-$VERSION.jar $JBOSS_HOME/modules/system/layers/base/org/hornetq/main/hornetq-server*.jar

                                    cp .//hornetq-commons/target/hornetq-commons-$VERSION.jar $JBOSS_HOME/modules/system/layers/base/org/hornetq/main/hornetq-commons*.jar

                                    cp .//hornetq-journal/target/hornetq-journal-$VERSION.jar $JBOSS_HOME/modules/system/layers/base/org/hornetq/main/hornetq-journal*.jar

                                    cp .//hornetq-jms-client/target/hornetq-jms-client-$VERSION.jar $JBOSS_HOME/modules/system/layers/base/org/hornetq/main/hornetq-jms-client*.jar

                                    cp .//hornetq-jms-server/target/hornetq-jms-server-$VERSION.jar $JBOSS_HOME/modules/system/layers/base/org/hornetq/main/hornetq-jms-server*.jar

                                    cp ./-server/target/hornetq-server-$VERSION.jar $JBOSS_HOME/modules/system/layers/base/org/hornetq/ra/main/hornetq-ra*.jar

                                     

                                     

                                    #update jboss-client.jar

                                    rm -rf tmp

                                    mkdir ./tmp

                                    cd ./tmp

                                    unzip $JBOSS_HOME/bin/client/jboss-client.jar

                                    rm -rf ./org/hornetq

                                    unzip -o ../hornetq-jms-client/target/hornetq-jms-client-$VERSION.jar  -x META-INF\*

                                    unzip -o ../hornetq-core-client/target/hornetq-core-client-$VERSION.jar -x \*META-INF\*

                                    unzip -o ../hornetq-commons/target/hornetq-commons-$VERSION.jar -x \*META-INF\*

                                    zip -r jboss-client.jar *

                                    cp jboss-client.jar $JBOSS_HOME/bin/client/jboss-client.jar

                                     

                                     

                                    cd ..

                                    1 2 Previous Next