1 Reply Latest reply on Mar 1, 2013 10:13 AM by fbernardi

    Embedded HornetQ server re-deploying queues/topics indefinitely

    fbernardi

      Hi there. I'm trying to run a embedded HornetQ server inside my application. Im using xml files to define the configuration. The problem is that after the server started succesfully, it left a thread that re-deploy the queues over and over.

       

      Environment: Jboss 4.0.5GA/ HornetQ 2.2.14

       

      Snippet:

      server = new EmbeddedJMS();

      server.setJmsConfigResourcePath("META-INF/hornetq-jms.xml");

      server.setConfigResourcePath("META-INF/hornetq-configuration.xml");

      server.start();

       

      hornetq-configuration.xml:

      <configuration xmlns="urn:hornetq"

                     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

                     xsi:schemaLocation="urn:hornetq /schema/hornetq-configuration.xsd">

         <name>HornetQ.main.config</name>

         <bindings-directory>${jboss.server.data.dir}/hornetq/bindings</bindings-directory>

         <journal-directory>${jboss.server.data.dir}/hornetq/journal</journal-directory>

         <journal-min-files>10</journal-min-files>

         <large-messages-directory>${jboss.server.data.dir}/hornetq/largemessages</large-messages-directory>

         <paging-directory>${jboss.server.data.dir}/hornetq/paging</paging-directory>

         <security-enabled>false</security-enabled>

         <connectors>

            <connector name="netty">

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

               <param key="host"  value="${jboss.bind.address:localhost}"/>

               <param key="port"  value="${hornetq.remoting.netty.port:5445}"/>

            </connector>

         </connectors>

         <acceptors>  

            <acceptor name="netty">

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

               <param key="host"  value="${jboss.bind.address:localhost}"/>

               <param key="port"  value="${hornetq.remoting.netty.port:5445}"/>

            </acceptor>

         </acceptors>

         <address-settings>

            <!--default for catch all-->

            <address-setting match="#">

               <dead-letter-address>jms.queue.HornetQDLQ</dead-letter-address>

               <expiry-address>jms.queue.HornetQExpiryQueue</expiry-address>

               <redelivery-delay>0</redelivery-delay>

               <max-size-bytes>10485760</max-size-bytes>      

               <message-counter-history-day-limit>10</message-counter-history-day-limit>

               <address-full-policy>BLOCK</address-full-policy>

            </address-setting>

         </address-settings>

      </configuration>

       

      hornetq-jms.xml:

      <configuration xmlns="urn:hornetq"

                  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

                  xsi:schemaLocation="urn:hornetq /schema/hornetq-jms.xsd">

         <connection-factory name="NettyConnectionFactory">

            <xa>true</xa>

            <connectors>

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

            </connectors>

            <entries>

               <entry name="/XAHornetQConnectionFactory"/>

            </entries>

         </connection-factory>

        

         <connection-factory name="NettyConnectionFactory">

            <xa>false</xa>

            <connectors>

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

            </connectors>

            <entries>

               <entry name="/HornetQConnectionFactory"/>

            </entries>

         </connection-factory>

       

         <queue name="HornetQDLQ">

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

         </queue>

          <queue name="HornetQoutputQueue">

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

         </queue>

         <queue name="HornetQExpiryQueue">

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

         </queue>

      </configuration>

       

      Log Snippet:

       

      INFO: HornetQ Server version 2.2.14.Final (HQ_2_2_14_FINAL, 122) [193994d9-8273-11e2-bd2c-391cf6eea8be]) started

      INFO: trying to deploy queue jms.queue.HornetQDLQ

      11:02:19,024 ERROR [STDERR] Mar 1, 2013 11:02:19 AM org.hornetq.core.logging.impl.JULLogDelegate info

      INFO: trying to deploy queue jms.queue.HornetQoutputQueue

      11:02:19,051 ERROR [STDERR] Mar 1, 2013 11:02:19 AM org.hornetq.core.logging.impl.JULLogDelegate info

      INFO: trying to deploy queue jms.queue.HornetQExpiryQueue

      11:02:24,075 ERROR [STDERR] Mar 1, 2013 11:02:24 AM org.hornetq.core.logging.impl.JULLogDelegate info

      INFO: trying to deploy queue jms.queue.HornetQDLQ

      11:02:24,082 ERROR [STDERR] Mar 1, 2013 11:02:24 AM org.hornetq.core.logging.impl.JULLogDelegate info

      INFO: trying to deploy queue jms.queue.HornetQoutputQueue

      11:02:24,090 ERROR [STDERR] Mar 1, 2013 11:02:24 AM org.hornetq.core.logging.impl.JULLogDelegate info

      INFO: trying to deploy queue jms.queue.HornetQExpiryQueue

      (and so on each 5 seconds)

        • 1. Re: Embedded HornetQ server re-deploying queues/topics indefinitely
          fbernardi

          Ok, i found the issue!. The problem was that i had all my configuration files in META-INF/ and org.hornetq.core.deployers.impl.FileDeploymentManager.fileExists(final URL resourceURL) was trying to find them doing the following:

          File f = getFileFromURL(resourceURL);

          Enumeration<URL> resources = Thread.currentThread().getContextClassLoader().getResources(f.getName()); //It is trying to find hornetq-jms.xml instead of META-INF/hornetq-jms.xml !

           

          Solution: Move the configuration files to the root folder.

           

          Thanks!