9 Replies Latest reply on Dec 9, 2010 7:44 AM by superdev

    hornetQ configuration in JBoss 6

    superdev

      I have an EE project that defines JMS service in application  scope, In Jboss 5. the JMS service and queue was defined in my-jms-servie.xml file under myApplication.ear

       

      <server>

       

          <!-- Version for Boss messaging, JBoss 5 GA -->
        
          <mbean code="org.jboss.jms.server.destination.QueueService" name="jboss.messaging.destination:service=Queue,name=myQueue"
              xmbean-dd="xmdesc/Queue-xmbean.xml">
             
              <depends optional-attribute-name="ServerPeer">jboss.messaging:service=ServerPeer</depends>
              <depends>jboss.messaging:service=PostOffice</depends>
             
              <attribute name="MessageCounterHistoryDayLimit">-1</attribute>
          </mbean>
        

       

      </server>

       

      and in myApplication.ear/META-INF/jboss-app.xml file, I add this as a module.

      <jboss-app>
      ...

         <module>
              <service>my-jms-servie.xml</service>
          </module>
      ...

      </jboss-app> 

       

      When I tried to deploy this project to JBoss 6.0, I could not succeed configuring JMS service for hornetQ.

       

      I changed the content of my-jms-service.xml to this:

      <configuration xmlns="urn:hornetq"
                  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                  xsi:schemaLocation="urn:hornetq /schema/hornetq-jms.xsd">

       

         <connection-factory name="ConnectionFactory">
            <connectors>
               <connector-ref connector-name="netty"/>
            </connectors>
         <entries>
               <entry name="ConnectionFactory"/>
            </entries>
         </connection-factory>

       


          <queue name="myQueue">
               <entry name="/queue/myQueue"/>
           </queue>

      </configuration>

       

      But I will get the following exceptions:

       

      RROR [org.jboss.profileservice.dependency.ProfileDeployAction] Failed to add deployment: myApplication.ear: org.jboss.deployers.spi.DeploymentException: Exception determining structure: AbstractVFSDeployment(myApplication.ear)
          at org.jboss.deployers.spi.DeploymentException.rethrowAsDeploymentException(DeploymentException.java:49) [:2.2.0.Alpha8]
          at org.jboss.deployers.structure.spi.helpers.AbstractStructuralDeployers.determineStructure(AbstractStructuralDeployers.java:85) [:2.2.0.Alpha8]

       

      I wonder if anyone knows how to do this. Thanks a lot in advance!

        • 1. Re: hornetQ configuration in JBoss 6
          jaikiran

          1) Don't include the connection-factory in your my-jms-service.xml

          2) Name that my-jms-service.xml file to my-hornetq-jms.xml.

          3) If that doesn't work out, post the full exception stacktrace.

          • 2. Re: hornetQ configuration in JBoss 6
            atijms

            jaikiran pai wrote:

             

            2) Name that my-jms-service.xml file to my-hornetq-jms.xml.

             

            Interesting. I take it "-hornetq-jms.xml" is the obligatory suffix for HornetQ files then? Just like in JBoss AS 5 -ds.xml was obligatory for files containing connection factory or datasources definitions in addition to MBeans.

            • 3. Re: hornetQ configuration in JBoss 6
              jaikiran

              Actually, I just checked the code. The file is expected to be named hornetq-jms.xml (no prefix or suffix).

              • 4. Re: hornetQ configuration in JBoss 6
                henk53

                Jaikiran, if the file needs to have a fixed name then this seems to preclude the possibility to have the definition of JMS destinations in multiple files, doesn't it?

                 

                Our app has divided the destinations that we use over a couple of logical files. It would be a shame if we needed to merge these into a single large file for JBoss AS 6/HornetQ, as the individual files make it a lot easier to understand and work with our system.

                • 5. Re: hornetQ configuration in JBoss 6
                  jaikiran

                  You can still have multiple files if those are packaged in different jars.

                  • 6. Re: hornetQ configuration in JBoss 6
                    superdev

                    Thanks a lot! It worked when I chnaged the fime name to "my-hornetq-jms.xml" and the content of the file is:

                     

                    <configuration xmlns="urn:hornetq"
                                xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                                xsi:schemaLocation="urn:hornetq /schema/hornetq-jms.xsd">

                     

                           <queue name="nsQueue">
                              <entry name="/queue/nsQueue"/>
                           </queue>
                    </configuration>

                     

                    I tried to rename the file to "my_hornetq-jms.xml" and "myhornetq-jms.xml", they also works.

                    So perhaps the file name can be "*hornetq-jms.xml" ?

                    • 7. Re: hornetQ configuration in JBoss 6
                      jaikiran

                      superDev superDev wrote:

                       


                      I tried to rename the file to "my_hornetq-jms.xml" and "myhornetq-jms.xml", they also works.

                      So perhaps the file name can be "*hornetq-jms.xml" ?

                      Turns out I was wrong then. I went by what the javadoc on a HornetQ deployer which said:

                       

                      /**
                       * This deployer will take a {@code hornetq-jms.xml} configuration file, parse it, create a {@code JMSConfiguration} object and
                       * attach it to the deployment unit.
                       * 
                       * Another deployer, {@code HornetQJMSRealDeployer}, which takes JMSConfiguration as an input will then take over and deploy the
                       * JMS resources.
                       * 
                       * @see HornetQJMSRealDeployer
                       * 
                       * 
                       * 
                       */
                      public class HornetQJMSParserDeployer extends AbstractVFSParsingDeployer<JMSConfiguration>
                      {

                       

                       

                      But looking at the code in that deployer, it appears to process any file which has hornetq-jms.xml as a suffix:

                       

                      public static final String FILENAME = "hornetq-jms.xml";
                      
                      ...
                      
                          public HornetQJMSParserDeployer()
                          {
                         ...     
                              setSuffix(FILENAME);
                          }
                      
                      • 8. Re: hornetQ configuration in JBoss 6
                        atijms

                        jaikiran pai wrote:

                        But looking at the code in that deployer, it appears to process any file which has hornetq-jms.xml as a suffix:

                         

                        That's great news! I already feared having to merge all my separate files into one. Thanks everyone for looking this up

                        • 9. Re: hornetQ configuration in JBoss 6
                          superdev

                          Thanks a lot!