6 Replies Latest reply on May 31, 2010 5:50 AM by Ronny Schuetz

    JBossAS 4.2.1 and standalone HornetQ 2.0.0GA - MDBs do not consume messages

    Ronny Schuetz Newbie

      Hi,

       

      I need to connect a JBossAS 4.2.1 instance to a HornetQ 2.0.0GA standalone server over the network. The JBossAS is connected to another JMS server (SwiftMQ) as well and is running some EJB 2.1 MDBs. Some of the MDBs need to use SwiftMQ, some others HornetQ for migration reasons.

       

      JBossAS is clearly connecting to HornetQ during startup while deploying the MDBs. It continues without Exception if the queues are there and fails if they've been deleted manually for testing purposes. The debugger shows the physical queue names in JBoss, retrieved from HornetQ. So I assume the connectivity part is fine.

       

      However, the MDBs do not consume any messages in the queues; JConsole does not show any consumers.

       

      I stepped thru the JBoss startup and saw, that JBoss' org.jboss.ejb.plugins.jms.JMSContainerInvoker tries to create a ConnectionConsumer in innerStartDelivery(), which calls a method in HornetQ, that is just returning null. Therefore I assume this is the reason for not getting any messages.

       

      Does somebody know if JBossAS 4.2.1 is in general supported as client for HornetQ? Or is the installation just incomplete? Any help is appreciated.

       

      Installation steps done:

       

      1. JBoss: copied hornetq-transports.jar and netty.jar to <jboss>/server/<config>/lib/ and the (original & unmodified) hornetq-ra.rar to <jboss>/server/<config>/deploy/jms/

       

      2. JBoss: changed <jboss>/server/<config>/deploy/jms/jms-ds.xml and included

       

        <!-- HornetQ JMS provider configuration -->

       

        <mbean code="org.jboss.jms.jndi.JMSProviderLoader" name="hornetq:service=JMSProviderLoader,name=JMSProvider">
          <attribute name="ProviderName">HornetQJMSProvider</attribute>
          <attribute name="ProviderAdapterClass">org.jboss.jms.jndi.JNDIProviderAdapter</attribute>
          <attribute name="FactoryRef">XAConnectionFactory</attribute>
          <attribute name="QueueFactoryRef">XAConnectionFactory</attribute>
          <attribute name="TopicFactoryRef">XAConnectionFactory</attribute>
          <attribute name="Properties">
              java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
              java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces
              java.naming.provider.url=jnp://localhost:5099
          </attribute>
        </mbean>

       

        <tx-connection-factory>
         <jndi-name>HornetQJmsXA</jndi-name>
         <rar-name>hornetq-ra.rar</rar-name>
         <xa-transaction/>
         <connection-definition>org.hornetq.ra.HornetQRAConnectionFactory</connection-definition>
         <config-property name="SessionDefaultType" type="java.lang.String">javax.jms.Topic</config-property>
         <config-property name="JmsProviderAdapterJNDI" type="java.lang.String">java:/HornetQJMSProvider</config-property>
         <config-property name="ConnectorClassName" type="java.lang.String">org.hornetq.integration.transports.netty.NettyConnectorFactory</config-property>
         <config-property name="ConnectionParameters" type="java.lang.String">host=localhost;port=5445</config-property>
        </tx-connection-factory>

       

       

      3. JBoss: changed <jboss>/server/<config>/conf/standardjboss.xml and included

       

            <!-- Invoker proxy for HornetQ MDBs -->
            <invoker-proxy-binding>
               <name>message-driven-bean-hornetq</name>
               <invoker-mbean>default</invoker-mbean>
               <proxy-factory>org.jboss.ejb.plugins.jms.JMSContainerInvoker</proxy-factory>
               <proxy-factory-config>
                  <JMSProviderAdapterJNDI>HornetQJMSProvider</JMSProviderAdapterJNDI>
                  <ServerSessionPoolFactoryJNDI>StdJMSPool</ServerSessionPoolFactoryJNDI>           
                  <MinimumSize>1</MinimumSize>
                  <MaximumSize>15</MaximumSize>
                  <MDBConfig/>
               </proxy-factory-config>
            </invoker-proxy-binding>

       

          <!-- HornetQ Standard MDB -->
          <container-configuration>
           <container-name>HornetQ Message Driven Bean</container-name>
           <call-logging>false</call-logging>
           <invoker-proxy-binding-name>message-driven-bean-hornetq</invoker-proxy-binding-name>
           <container-interceptors>
             <interceptor>org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor</interceptor>
             <interceptor>org.jboss.ejb.plugins.LogInterceptor</interceptor>
             <interceptor>org.jboss.ejb.plugins.RunAsSecurityInterceptor</interceptor>
             <!-- CMT -->
             <interceptor transaction="Container">org.jboss.ejb.plugins.TxInterceptorCMT</interceptor>
             <interceptor transaction="Container">org.jboss.ejb.plugins.CallValidationInterceptor</interceptor>
             <interceptor transaction="Container">org.jboss.ejb.plugins.MessageDrivenInstanceInterceptor</interceptor>
             <!-- BMT -->
             <interceptor transaction="Bean">org.jboss.ejb.plugins.MessageDrivenInstanceInterceptor</interceptor>
             <interceptor transaction="Bean">org.jboss.ejb.plugins.MessageDrivenTxInterceptorBMT</interceptor>
             <interceptor transaction="Bean">org.jboss.ejb.plugins.CallValidationInterceptor</interceptor>
             <interceptor>org.jboss.resource.connectionmanager.CachedConnectionInterceptor</interceptor>
           </container-interceptors>
           <instance-pool>org.jboss.ejb.plugins.MessageDrivenInstancePool</instance-pool>
           <instance-cache></instance-cache>
           <persistence-manager></persistence-manager>
           <container-pool-conf>
             <MaximumSize>100</MaximumSize>
           </container-pool-conf>
          </container-configuration>

       

      4. HornetQ: Changed port configuration of JNDI/RMI ports to 5099 resp. 5098.

       

      5. HornetQ:Added queues, required by the application, to hornetq-jms.xml

       

      6. Application: Extended ejb-jar.xml to specify the new HornetQ MDB container for the MDBs.

       

              <message-driven>
                    <ejb-name>QueueListener1</ejb-name>                      
                    <destination-jndi-name>queue/QueueListener1</destination-jndi-name>
                    <configuration-name>HornetQ Message Driven Bean</configuration-name>
                              <resource-adapter-name>hornetq-ra.rar</resource-adapter-name>
              </message-driven>

       

              <message-driven>
                    <ejb-name>QueueListener2</ejb-name>                      
                    <destination-jndi-name>queue/QueueListener2</destination-jndi-name>
                   <configuration-name>HornetQ Message Driven Bean</configuration-name>
                              <resource-adapter-name>hornetq-ra.rar</resource-adapter-name>
              </message-driven>

       

      Thanks,
      Ronny