8 Replies Latest reply on Jul 29, 2010 4:04 AM by Tim Fox

    Error in HornetQ integration with JBoss 4.x

    reza g Newbie

      Hi,

       

      I am sure the similar question has come up before but I write this after reading all the related topics!

       

      My JBoss 4.x is JEE 5 compliant. I went through the quick-start guide and added HornetQ to my own profile (not default) changing jbossas.profile.source and target. It completes fine. This is what i have:

       

      My MDB:

       

      @MessageDriven(activationConfig = { 
      @ActivationConfigProperty(propertyName = "destination", propertyValue = "queue/ExampleQueue"),
      @ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Queue")
      })
      @ResourceAdapter("hornetq-ra.rar")
      public class MDB implements MessageDrivenBean, MessageListener {
      

       

       

      I see all the changes for HornetQ in deploy directory but I get hornetq.sar in my deploy directory but expected hornetq.rar according to the manual.
      I have one jms-ds.xml in the delopy folder and one in hornetq.sar directory. The one in deploy dir contains:

       

       

       

      ....  
       <!-- JMS XA Resource adapter, use this to get transacted JMS in beans -->
        <tx-connection-factory>
          <jndi-name>JmsXA</jndi-name>
          <xa-transaction/>
          <rar-name>jms-ra.rar</rar-name>
          <connection-definition>org.jboss.resource.adapter.jms.JmsConnectionFactory</connection-definition>
          <config-property name="SessionDefaultType" type="java.lang.String">javax.jms.Topic</config-property>
          <config-property name="JmsProviderAdapterJNDI" type="java.lang.String">java:/DefaultJMSProvider</config-property>
          <security-domain-and-application>JmsXARealm</security-domain-and-application>
          <max-pool-size>20</max-pool-size>
        </tx-connection-factory>
      ...
      
      
      and the one in hornetq.sar contains:
         <tx-connection-factory>
            <jndi-name>JmsXA</jndi-name>
            <xa-transaction/>
            <rar-name>jms-ra.rar</rar-name>
            <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:/DefaultJMSProvider</config-property>
            <max-pool-size>20</max-pool-size>
            <security-domain-and-application>JmsXARealm</security-domain-and-application>
         </tx-connection-factory>
      </connection-factories>
      
      And when I deploy i get different exceptions:

       

      [org.jboss.system.ServiceController] Problem starting service jboss.jca:service=RARDeployment,name='jms-ra.rar'
      org.jboss.deployment.DeploymentException: Error for resource adapter class org.hornetq.ra.HornetQResourceAdapter accessing property setter ConfigPropertyMetaData@10dbef1[name=TransactionManagerLocatorMethod type=java.lang.String value=getTm descriptions=[DescriptionMetaData@ce41cc[language=en description=The method to use for locate the transactionmanager]]]; - nested throwable: (java.lang.NoSuchMethodException: org.hornetq.ra.HornetQResourceAdapter.setTransactionManagerLocatorMethod(java.lang.String))
           at org.jboss.deployment.DeploymentException.rethrowAsDeploymentException(DeploymentException.java:53)
           at org.jboss.resource.deployment.ResourceAdapterFactory.createResourceAdapter(ResourceAdapterFactory.java:100)
      
           ..
      [org.jboss.messaging.util.ExceptionUtil] Queue[/queue/DLQ] startService
      javax.jms.InvalidDestinationException: Destination DLQ already exists
      ..
      [org.jboss.messaging.util.ExceptionUtil] Queue[/queue/ExpiryQueue] startService
      javax.jms.InvalidDestinationException: Destination ExpiryQueue already exists
      ..
      [org.jboss.deployment.MainDeployer] Could not create deployment: file:/D:/dev/jboss-server/bp-jboss/jboss-developer/server/bopc-with-hq/deploy/jms-ds.xml
      org.jboss.deployment.DeploymentException: Trying to install an already registered mbean: jboss.jca:service=TxCM,name=JmsXA
           at org.jboss.system.ServiceCreator.install(ServiceCreator.java:103)
      ..
           [org.jboss.system.ServiceController] Problem starting service jboss.j2ee:ear=Services-ProductCatalogue.ear,jar=Services-ProductCatalogue.jar,name=MDB,service=EJB3
      org.jboss.deployment.DeploymentException: Unable to create activation spec ra=jboss.jca:service=RARDeployment,name='hornetq-ra.rar' messaging-type=javax.jms.MessageListener properties={destinationType=ActivationConfigProperty(destinationType=javax.jms.Queue), destination=ActivationConfigProperty(destination=queue/ExampleQueue)}; - nested throwable: (javax.management.InstanceNotFoundException: jboss.jca:service=RARDeployment,name='hornetq-ra.rar' is not registered.)
           at org.jboss.deployment.DeploymentException.rethrowAsDeploymentException(DeploymentException.java:53)
       
      ...
      org.jboss.deployment.DeploymentException: Trying to install an already registered mbean: jboss.jca:service=TxCM,name=JmsXA
      
      ...
      org.jboss.deployment.DeploymentException: Unable to create activation spec ra=jboss.jca:service=RARDeployment,name='hornetq-ra.rar' messaging-type=javax.jms.MessageListener properties={destinationType=ActivationConfigProperty(destinationType=javax.jms.Queue), destination=ActivationConfigProperty(destination=queue/ExampleQueue)}; - nested throwable: (javax.management.InstanceNotFoundException: jboss.jca:service=RARDeployment,name='hornetq-ra.rar' is not registered.)
           at org.jboss.deployment.DeploymentException.rethrowAsDeploymentException(DeploymentException.java:53)
      
      ...
      [org.jboss.security.auth.spi.UsersRolesLoginModule] Failed to load users/passwords/role files
      java.io.IOException: No properties file: users.properties or defaults: defaultUsers.properties found
           at org.jboss.security.auth.spi.Util.loadProperties(Util.java:315)
      
      ...
       
      [org.jboss.messaging.util.ExceptionUtil] ConnectionFactoryEndpoint[jboss.messaging.connectionfactory:service=ConnectionFactory] createFailoverConnectionDelegate [d-wtx084cg-1-i2zz74cg-nhvdja-f28a34]
      javax.jms.JMSSecurityException: User null is NOT authenticated
      
       
      ...
      

       

       

       

       

      Any Idea?

       

      Thanks

        • 1. Re: Error in HornetQ integration with JBoss 4.x
          Tim Fox Master

          Reza, Andy has added a chapter in the user manual explaining exactly what you have to do to allow JBoss 4.x to consume from a remote HornetQ instance (assuming that is what you want to do, you didn't explain it)

          • 2. Re: Error in HornetQ integration with JBoss 4.x
            reza g Newbie

            Thanks Tim,

             

            Basically I was trying to embed HornetQ with JBoss and my question was regarding this.

            But using a remote standalone HornetQ instance could be another option if i can't make it. Which chapter you are refering to?

             

            Reza

            • 3. Re: Error in HornetQ integration with JBoss 4.x
              Tim Fox Master

              By "embed" I assume you mean "make HornetQ the default JMS provider in AS 4.x".

               

              If so, you can do this by running the script as explained in the quick start guide. No manually steps should be necessary. Then take a look at the MDB chapters in the user manual to see how you configure them.

               

              There are also working examples in the distro if you want to copy the config.

              • 4. Re: Error in HornetQ integration with JBoss 4.x
                reza g Newbie

                Just to clarify, do we need to run the quick start guide steps in section 5.4 for both the following cases ? I think the answer is yes.

                 

                1- Deploy HornetQ in JBoss as the default JMS provider.

                2- To enable JBoss to connect to a remove standalone HornetQ server and consume messages in AS.

                 

                I am trying the first case above and running a customized version of JBoss 4.3.0.GA_CP07. Might need to go for the second case later and from the manual i understand it involves changes to RA as per section 32.4.4.

                 

                So far I have progressed and done the following changes:

                 

                1. Did the changes in quick start section 5.4 and applied hornetq to JBoss. As I said above I am getting heaps of errors and needed to do some other changes that follow.
                2. There was a jms-ds.xml in the root of deploy folder that i removed.
                3. removed \jboss.messaging.sar folder in deploy folder
                4. changed \jms-ra.rar\ra.xml and removed two configurations related to transaction which was giving errors.
                5. added @ResourceAdapter("jms-ra.rar") to my MDB instead of @ResourceAdapter("hornetq-ra.rar") as i only have hornetq.sar and jms-ra.rar folders in my deploy folder. jms.ra-rar folder contains hornetq jar files.

                 

                 

                 

                AS deploys fine now ...almost...!

                 

                 

                Thanks,

                Reza

                • 5. Re: Error in HornetQ integration with JBoss 4.x
                  Tim Fox Master

                  The quickstart guide instructions are for installing HornetQ as local default JMS provider in JBoss AS 4 or JBoss 5, the script must be run on a *clean* (i.e unmodified AS installation). I beleive this is what you want to do?

                   

                  http://hornetq.sourceforge.net/docs/hornetq-2.1.1.Final/quickstart-guide/en/html/installation.html#installation.jboss.as4

                   

                  If you are getting errors it's probably because your JBoss installation has already been modified - the script won't know about any modifications you have done.

                   

                  For enable MDBs in another JBoss to consume from a remote HornetQ instance the local JMS provider does not need to be HornetQ.

                  1 of 1 people found this helpful
                  • 6. Re: Error in HornetQ integration with JBoss 4.x
                    Vadim Kopichenko Newbie

                    JBoss 4.3.0.GA_CP07 uses JBM while HornetQ's install script tries to delete JBossMQ.

                    So you have to manually remove JBM remainings after all.

                     

                    Also, take a look at our JBoss 4.x integration experience.

                    • 7. Re: Error in HornetQ integration with JBoss 4.x
                      reza g Newbie

                      Yes I figured it out. thanks.

                       

                      But user manual is not clear on how to consume messages on a remote HornetQ server from any application server specially JB4. It is assuming your MDB is on a JBoss with HornetQ already installed (chap 32.4.4). It can better explain how to incorporate hornetQ resource adapter and use it.

                       

                      Reza

                      • 8. Re: Error in HornetQ integration with JBoss 4.x
                        Tim Fox Master

                        reza g wrote:

                         

                        Yes I figured it out. thanks.

                         

                        But user manual is not clear on how to consume messages on a remote HornetQ server from any application server specially JB4. It is assuming your MDB is on a JBoss with HornetQ already installed (chap 32.4.4). It can better explain how to incorporate hornetQ resource adapter and use it.

                         

                        Reza

                        I've been bugging Andy for *months* to add these instructions to the user manual, in fact I thought he had already done it, but it's not all there.

                         

                        Andy assures me he will add it ASAP. It's only a few paragraphs.