Cannot configure a UDP based cluster for a JBoss embedded HornetQ.
swapnonil.mukherjee May 3, 2010 5:55 AMHi Everybody,
I am trying to set up a hornetq cluster. I am running hornetq 2.0 GA inside JBoss5.1.I am using hornetq's JMS API.
I have learnt that IP Multicasting is enabled on the RHEL servers on our network. Based on the directions given in the HorentQ Manual Chapter 38, I am trying to form a cluster using two servers located on 10.1.0.74 and 10.1.0.39.
However after doing all that I get the following error.
javax.jms.JMSException: Timed out waiting to receive initial broadcast from discovery group
I am providing the configuration details for the server located at 10.1.0.74. The configuration for the other server is almost identical expect for the connector and acceptor IP addresses.
The following is the hornetq-configuration.xml
<configuration xmlns="urn:hornetq" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:hornetq /schema/hornetq-configuration.xsd"> <clustered>true</clustered> <log-delegate-factory-class-name>org.hornetq.integration.logging.Log4jLogDelegateFactory</log-delegate-factory-class-name> <bindings-directory>${jboss.server.data.dir}/hornetq/bindings</bindings-directory> <journal-directory>${jboss.server.data.dir}/hornetq/journal</journal-directory> <large-messages-directory>${jboss.server.data.dir}/hornetq/largemessages</large-messages-directory> <paging-directory>${jboss.server.data.dir}/hornetq/paging</paging-directory> <connectors> <connector name="netty"> <factory-class>org.hornetq.integration.transports.netty.NettyConnectorFactory</factory-class> <param key="host" value="10.1.0.74"/> <param key="port" value="5445"/> </connector> <connector name="in-vm"> <factory-class>org.hornetq.core.remoting.impl.invm.InVMConnectorFactory</factory-class> </connector> </connectors> <acceptors> <acceptor name="netty"> <factory-class>org.hornetq.integration.transports.netty.NettyAcceptorFactory</factory-class> <param key="host" value="10.1.0.74"/> <param key="port" value="5445"/> </acceptor> <acceptor name="in-vm"> <factory-class>org.hornetq.core.remoting.impl.invm.InVMAcceptorFactory</factory-class> <param key="server-id" value="0"/> </acceptor> </acceptors> <broadcast-groups> <broadcast-group name="bg-group1"> <group-address>224.0.0.1</group-address> <group-port>9876</group-port> <broadcast-period>500</broadcast-period> <connector-ref connector-name="netty"/> </broadcast-group> </broadcast-groups> <discovery-groups> <discovery-group name="dg-group1"> <group-address>224.0.0.1</group-address> <group-port>9876</group-port> <refresh-timeout>10000</refresh-timeout> </discovery-group> </discovery-groups> <cluster-connections> <cluster-connection name="my-cluster"> <address>jms</address> <discovery-group-ref discovery-group-name="dg-group1"/> </cluster-connection> </cluster-connections> <security-settings> <security-setting match="#"> <permission type="createTempQueue" roles="guest"/> <permission type="deleteTempQueue" 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>-1</max-size-bytes> <page-size-bytes>10485760</page-size-bytes> <message-counter-history-day-limit>10</message-counter-history-day-limit> </address-setting> </address-settings> </configuration>
The following is 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"> <connectors> <connector-ref connector-name="netty"/> </connectors> <entries> <entry name="/ConnectionFactory"/> <entry name="/XAConnectionFactory"/> </entries> </connection-factory> <connection-factory name="ClusteredConnectionFactory"> <discovery-group-ref discovery-group-name="dg-group1"/> <entries> <entry name="/ClusteredConnectionFactory"/> </entries> </connection-factory> <connection-factory name="InVMConnectionFactory"> <connectors> <connector-ref connector-name="in-vm"/> </connectors> <entries> <entry name="java:/ConnectionFactory"/> <entry name="java:/XAConnectionFactory"/> </entries> </connection-factory> <queue name="DLQ"> <entry name="/queue/DLQ"/> </queue> <queue name="ExpiryQueue"> <entry name="/queue/ExpiryQueue"/> </queue> <queue name="testQueue"> <entry name="/queue/testQueue"/> </queue> </configuration>
I use JNDI to look up the Connection Factory named ClusteredConnectionFactory
public static Context getInitialContext()throws javax.naming.NamingException { Properties p = new Properties(); p.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory"); p.put(Context.URL_PKG_PREFIXES, " org.jboss.naming:org.jnp.interfaces"); p.put(Context.PROVIDER_URL, "jnp://10.1.0.74:1099"); return new javax.naming.InitialContext(p); }
And finally the Connection Creation code is the following.
ConnectionFactory cf = (ConnectionFactory) ic.lookup("/ClusteredConnectionFactory");
What am I doing wrong? I know that multicasting is enabled , but I don't know if the
<group-address>224.0.0.1</group-address>
IP for configuring broadcast and discovery groups is correct or not?
Any Help would be Appreciated.