8 Replies Latest reply on Feb 28, 2013 8:04 AM by borges

    Error while configuring HornetQ

    raymanf Newbie

      Hi,

       

      I am using HornetQ 2.1.1 integrated inside Spring3.1.

       

      I created two seperate Spring applications having diffrent HornetQ servers.

       

       

       

      I am starting to configure the first HornetQ node.

       

      I added 3 new blocks to hornetq-configuration.xml: in order to configure the cluster:

       

       

      <broadcast-groups>
               <broadcast-group name="bg-group1">
                  <group-address>231.7.7.7</group-address>
                  <group-port>9876</group-port>
                  <broadcast-period>1000</broadcast-period>
                  <connector-ref>netty</connector-ref>
               </broadcast-group>
            </broadcast-groups>
      
              <discovery-groups>
               <discovery-group name="dg-group1">
                  <group-address>231.7.7.7</group-address>
                  <group-port>9876</group-port>
                  <refresh-timeout>60000</refresh-timeout>
                  </discovery-group>
            </discovery-groups>
      
             <cluster-connections>
               <cluster-connection name="my-cluster">
                  <address>jms</address>
                  <connector-ref>netty</connector-ref>
                  <discovery-group-ref discovery-group-name="dg-group1"/>
                  <!--max hops defines how messages are redistributed, the default is 1 meaning only distribute to directly
                  connected nodes, to disable set to 0-->
                  <!--<max-hops>0</max-hops>-->
               </cluster-connection>
            </cluster-connections>
      

       

       

      and as soon as I added them I get exception from hornetQ (will be detailed below)

      (without this this change the server works as individual perefctly fine).

       

      this how my configurations files looks like:

       

       

       

      <configuration xmlns="urn:hornetq"
                xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                xsi:schemaLocation="urn:hornetq /schema/hornetq-configuration.xsd">
      
      
                <paging-directory>${data.dir:./data}/paging</paging-directory>
      
      
                <bindings-directory>${data.dir:./data}/bindings</bindings-directory>
      
      
                <journal-directory>${data.dir:./data}/journal</journal-directory>
      
      
                <journal-min-files>10</journal-min-files>
      
      
                <large-messages-directory>${data.dir:./data}/large-messages
                </large-messages-directory>
      
      
      
      
      
                <clustered>true</clustered>
      
                      <allow-failback>true</allow-failback>
      
      
                <connectors>
                          <connector name="netty">
                                    <factory-class>org.hornetq.core.remoting.impl.netty.NettyConnectorFactory
                                    </factory-class>
                                    <param key="host" value="${hornetq.remoting.netty.host: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="${hornetq.remoting.netty.host:localhost}" />
                                    <param key="port" value="${hornetq.remoting.netty.port:5445}" />
                          </acceptor>
                </acceptors>
      
      
      
      
                 <broadcast-groups>
               <broadcast-group name="bg-group1">
                  <group-address>231.7.7.7</group-address>
                  <group-port>9876</group-port>
                  <broadcast-period>1000</broadcast-period>
                  <connector-ref>netty</connector-ref>
               </broadcast-group>
            </broadcast-groups>
      
              <discovery-groups>
               <discovery-group name="dg-group1">
                  <group-address>231.7.7.7</group-address>
                  <group-port>9876</group-port>
                  <refresh-timeout>60000</refresh-timeout>
                  </discovery-group>
            </discovery-groups>
      
             <cluster-connections>
               <cluster-connection name="my-cluster">
                  <address>jms</address>
                  <connector-ref>netty</connector-ref>
                  <discovery-group-ref discovery-group-name="dg-group1"/>
                  <!--max hops defines how messages are redistributed, the default is 1 meaning only distribute to directly
                  connected nodes, to disable set to 0-->
                  <!--<max-hops>0</max-hops>-->
               </cluster-connection>
            </cluster-connections>
      
      
                <security-settings>
                          <security-setting match="#">
                                    <permission type="createNonDurableQueue" roles="guest" />
                                    <permission type="deleteNonDurableQueue" roles="guest" />
                                    <permission type="consume" roles="guest" />
                                    <permission type="send" roles="guest" />
                          </security-setting>
                </security-settings>
      
      
                <address-settings>
                          <!--default for catch all-->
                          <address-setting match="#">
                                    <dead-letter-address>jms.queue.DLQ</dead-letter-address>
                                    <expiry-address>jms.queue.ExpiryQueue</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="/XAConnectionFactory" />
                          </entries>
                </connection-factory>
      
      
                <connection-factory name="NettyConnectionFactory">
                          <xa>false</xa>
                          <discovery-group-ref discovery-group-name="sfp-rnd" />
                          <connectors>
                                    <connector-ref connector-name="netty" />
                          </connectors>
                          <entries>
                                    <entry name="ConnectionFactory" />
                          </entries>
                          <retry-interval>1000</retry-interval>
                          <retry-interval-multiplier>1.0</retry-interval-multiplier>
                          <reconnect-attempts>1</reconnect-attempts>
                </connection-factory>
      
      
      
      
                <connection-factory name="NettyThroughputConnectionFactory">
                          <xa>true</xa>
                          <connectors>
                                    <connector-ref connector-name="netty-throughput" />
                          </connectors>
                          <entries>
                                    <entry name="/XAThroughputConnectionFactory" />
                          </entries>
                </connection-factory>
      
      
                <connection-factory name="NettyThroughputConnectionFactory">
                          <xa>false</xa>
                          <connectors>
                                    <connector-ref connector-name="netty-throughput" />
                          </connectors>
                          <entries>
                                    <entry name="/ThroughputConnectionFactory" />
                          </entries>
                </connection-factory>
      
      
                <queue name="DLQ">
                          <entry name="/queue/DLQ" />
                </queue>
      
      
                <queue name="ExpiryQueue">
                          <entry name="/queue/ExpiryQueue" />
                </queue>
      
      
                <topic name="liquiditiyFeedTopic">
                          <entry name="/topic/liquiditiyFeedTopic" />
                </topic>
      
      
      
      
      </configuration>
      
      
      and my General HornetQ configurations: 
      
      <bean name="namingServerImpl" class="org.jnp.server.NamingBeanImpl"
                          init-method="start" destroy-method="stop" />
      
      
                <bean name="namingServer" class="org.jnp.server.Main" init-method="start"
                          destroy-method="stop">
                          <property name="namingInfo" ref="namingServerImpl" />
                          <property name="port" value="1099" />
                          <property name="bindAddress" value="localhost" />
                          <property name="rmiPort" value="3000" />
                          <property name="rmiBindAddress" value="localhost" />
                </bean>
      
      
      
      
                <bean id="cachedConnectionFactory"
                          class="org.springframework.jms.connection.CachingConnectionFactory"
                          p:targetConnectionFactory-ref="connectionFactory" p:sessionCacheSize="200" />
      
      
                <bean name="fileConfiguration" class="org.hornetq.core.config.impl.FileConfiguration"
                          init-method="start" destroy-method="stop" />
      
      
                <bean name="hornetQSecurityManagerImpl"
                          class="org.hornetq.spi.core.security.HornetQSecurityManagerImpl" />
      
      
                <!-- The core server -->
                <bean name="hornetQServerImpl" class="org.hornetq.core.server.impl.HornetQServerImpl">
                          <constructor-arg ref="fileConfiguration" />
                          <constructor-arg ref="mbeanServer" />
                          <constructor-arg ref="hornetQSecurityManagerImpl" />
                </bean>
      
      
                <!-- The JMS server -->
                <bean name="jmsServerManagerImpl" class="org.hornetq.jms.server.impl.JMSServerManagerImpl"
                          init-method="start" destroy-method="stop" depends-on="namingServer">
                          <constructor-arg ref="hornetQServerImpl" />
                </bean>
      
      
                <bean name="connectionFactory" class="org.hornetq.jms.client.HornetQJMSConnectionFactory">
                          <constructor-arg name="ha" value="false" />
                          <constructor-arg>
                                    <bean class="org.hornetq.api.core.TransportConfiguration">
                                              <constructor-arg
                                                        value="org.hornetq.core.remoting.impl.netty.NettyConnectorFactory" />
                                              <constructor-arg>
                                                        <map key-type="java.lang.String" value-type="java.lang.Object">
                                                                  <entry key="port" value="5445"></entry>
                                                        </map>
                                              </constructor-arg>
                                    </bean>
                          </constructor-arg>
                </bean>
      
      
      
      
      Now this is the wierd Exception that I get:
      
      Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'fileConfiguration' defined in class path resource [applicationContext.xml]: Invocation of init method failed; nested exception is java.lang.NumberFormatException: For input string: "10
                                    "
                at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1455)
                at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)
                at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
                at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:294)
                at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:225)
                at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:291)
                at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:193)
                at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:322)
                ... 43 more
      Caused by: java.lang.NumberFormatException: For input string: "10
                                    "
                at java.lang.NumberFormatException.forInputString(Unknown Source)
      
      
      any idea ?
      
      thanks.