-
1. Re: HornetQ 2.3.0 Final Standalone multicast clustering on 2 seperate machines : getting error HQ119012: Timed out waiting to receive initial broadcast from cluster
jbertram Jun 3, 2013 10:33 AM (in response to poonamkamboj)Which JMS connection factory is your client using?
-
2. Re: HornetQ 2.3.0 Final Standalone multicast clustering on 2 seperate machines : getting error HQ119012: Timed out waiting to receive initial broadcast from cluster
poonamkamboj Jun 4, 2013 12:47 AM (in response to jbertram)its NettyConnectionFactory.. , also i have even given unique discovery group names in both of the servers configuration
Below is the entry in hornetq-jms.xml
-------------------------------------------------------------------------------------------------
<connection-factory name="NettyConnectionFactory">
<xa>false</xa>
<ha>true</ha>
<discovery-group-ref discovery-group-name="dg-group2"/>
<retry-interval>1000</retry-interval>
<retry-interval-multiplier>1.0</retry-interval-multiplier>
<reconnect-attempts>-1</reconnect-attempts>
<failover-on-server-shutdown>true</failover-on-server-shutdown>
<confirmation-window-size>1048576</confirmation-window-size>
<failover-on-server-shutdown>true</failover-on-server-shutdown>
<client-failure-check-period>100</client-failure-check-period>
<connectors>
<connector-ref connector-name="netty"/>
</connectors>
<entries>
<entry name="/ConnectionFactory"/>
</entries>
</connection-factory>
-------------------------------------------------------------------------------------------------
hornetq-configuration.xml
-------------------------------------------------------------------------------------------------
<broadcast-groups>
<broadcast-group name="bg-group1">
<!--local-bind-address>172.16.9.7</local-bind-address>
<local-bind-port>5432</local-bind-port-->
<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-group2">
<!--local-bind-address>172.16.9.7</local-bind-address-->
<group-address>231.7.7.7</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>
<connector-ref>netty</connector-ref>
<check-period>1000</check-period>
<connection-ttl>5000</connection-ttl>
<min-large-message-size>50000</min-large-message-size>
<call-timeout>5000</call-timeout>
<retry-interval>500</retry-interval>
<retry-interval-multiplier>1.0</retry-interval-multiplier>
<max-retry-interval>5000</max-retry-interval>
<reconnect-attempts>-1</reconnect-attempts>
<use-duplicate-detection>true</use-duplicate-detection>
<forward-when-no-consumers>false</forward-when-no-consumers>
<max-hops>1</max-hops>
<confirmation-window-size>32000</confirmation-window-size>
<call-failover-timeout>30000</call-failover-timeout>
<notification-interval>1000</notification-interval>
<notification-attempts>2</notification-attempts>
<discovery-group-ref discovery-group-name="dg-group2"/>
</cluster-connection>
</cluster-connections>
-------------------------------------------------------------------------------------------------
-
3. Re: HornetQ 2.3.0 Final Standalone multicast clustering on 2 seperate machines : getting error HQ119012: Timed out waiting to receive initial broadcast from cluster
ataylor Jun 4, 2013 1:09 AM (in response to poonamkamboj)This means the client isnt receiving the multicast, make sure your network allows this, your firewall doesn't block it and also if running the client on the same machine as the server that you have a loopback address configured
-
4. Re: HornetQ 2.3.0 Final Standalone multicast clustering on 2 seperate machines : getting error HQ119012: Timed out waiting to receive initial broadcast from cluster
poonamkamboj Jun 4, 2013 1:13 AM (in response to ataylor)yes i have disabled firewall on both of the machines, but its still the same error,
also hornetQ servers are on different machines, & client is on seperate windows machine, so how do i configure loop back address. can you please guide me
-
5. Re: HornetQ 2.3.0 Final Standalone multicast clustering on 2 seperate machines : getting error HQ119012: Timed out waiting to receive initial broadcast from cluster
ataylor Jun 4, 2013 1:16 AM (in response to poonamkamboj)yes i have disabled firewall on both of the machines, but its still the same error,
does your networl allow UDP?
also hornetQ servers are on different machines, & client is on seperate windows machine, so how do i configure loop back address. can you please guide me
you only need a loopback address if your servers or clients are on the same machine.
This is no doubt something in your env, i would write a simple program to make sure that UDP is working as you think.
-
6. Re: HornetQ 2.3.0 Final Standalone multicast clustering on 2 seperate machines : getting error HQ119012: Timed out waiting to receive initial broadcast from cluster
poonamkamboj Jun 4, 2013 1:28 AM (in response to poonamkamboj)I just checked using netstat where it shows IP address and port 9876.
Also i am connecting from JAVA client using JNDI to 1099 or 1299(port was conflicting so provided another port) port, I am attaching here the code, (Consumer.java) file and config properties. Please see if there is issue with program.
------------------------------------------------------------------------------------------------------------
Config.properties.
----------------------------------------------------------------------------------------------------------------
initialContextFactory=org.jnp.interfaces.NamingContextFactory
urlPkgPrefixes=org.jboss.naming:org.jnp.interfaces
username=guest
password=guest
requestQueue=/queue/requestQueue
message=Clustering with HornetQ
live_broker_url=10.xx.xxx.xxx:1299
backup_broker_url=10.xx.xxx.xxx:1299
numberOfMessages=20000
connectionFactory=/ConnectionFactory
reconnectingSleepDuration=10000
producerSleepDuration=10000
consumerSleepDuration=300000
----------------------------------------------------------------------------------------------------------------------
Consumer .java
----------------------------------------------------------------------------------------------------------------------
/*
* creates connection to standalone hornetq and
* consumes message from configured queue
*/
package consumer;
import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;
import javax.jms.JMSException;
import javax.jms.QueueConnectionFactory;
import javax.jms.QueueReceiver;
import javax.jms.QueueSession;
import javax.jms.Session;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import javax.jms.QueueConnection;
import exception.HornetQExceptionListenerImpl;
public class Consumer {
QueueConnection queueConnection = null;
QueueSession session = null;
HornetQExceptionListenerImpl exceptionLstImpl = null;
Properties prop = new Properties();
Properties configProp = new Properties();
final static String ERROR_CODE="DISCONNECT";
public static void main(String[] args) {
Consumer consumer = null;
try {
consumer = new Consumer();
consumer.initializeConfigProps();
consumer.initializeInitialContextProps();
consumer.addProviderURL(true);
consumer.setupConnection();
try {
Thread.sleep(consumer.getSleepDuration());
} catch (InterruptedException e) {
e.printStackTrace();
}
} catch (NamingException e) {
System.out.println(" NamingException occurred in consumer ");
e.printStackTrace();
} catch(JMSException e){
System.out.println(" exception occurred in consumer " + e.getErrorCode() + e.getMessage());
e.printStackTrace();
} finally{
consumer.closeConnection();
System.out.println(" All sessions and connections closed. ");
}
}
private void setupConnection() throws JMSException, NamingException {
InitialContext initialContext = new InitialContext(prop);
QueueConnectionFactory connectionFactory = (QueueConnectionFactory)
initialContext.lookup(configProp.getProperty("connectionFactory"));
System.out.println(" Connection Factory lookup successful ");
try {
Thread.sleep(20000);
} catch (InterruptedException e) {
e.printStackTrace();
}
queueConnection = connectionFactory.createQueueConnection(configProp.getProperty("username"),
configProp.getProperty("password"));
exceptionLstImpl = new HornetQExceptionListenerImpl();
queueConnection.setExceptionListener(exceptionLstImpl);
session = queueConnection.createQueueSession(true, Session.CLIENT_ACKNOWLEDGE);
javax.jms.Queue requestQueue = (javax.jms.Queue)initialContext.lookup(configProp.getProperty("requestQueue"));
System.out.println(" Queue lookup successul ");
QueueReceiver requestReceiver = session.createReceiver(requestQueue);
requestReceiver.setMessageListener(new RequestQueueMessageListener(session));
queueConnection.start();
}
private void closeConnection(){
try {
if (session != null){
session.close();
}
if (queueConnection != null){
queueConnection.close();
}
} catch (JMSException e) {
System.out.println(" exception occurred while closing connections ");
e.printStackTrace();
}
}
/*
* Initializing properties for Initial context
*/
private void initializeInitialContextProps(){
prop.put(Context.INITIAL_CONTEXT_FACTORY, configProp.getProperty("initialContextFactory"));
prop.put(Context.URL_PKG_PREFIXES, configProp.getProperty("urlPkgPrefixes"));
prop.put(Context.SECURITY_PRINCIPAL,configProp.getProperty("username"));
prop.put(Context.SECURITY_CREDENTIALS,configProp.getProperty("password"));
}
/*
* Adding provider url into initial context.
* isLiverServerURL - true means add liver server broker url else backup server url
*/
private void addProviderURL(boolean isLiveServerURL){
if (isLiveServerURL){
prop.put(Context.PROVIDER_URL, configProp.getProperty("live_broker_url"));
} else {
prop.put(Context.PROVIDER_URL, configProp.getProperty("backup_broker_url"));
}
}
private long getSleepDuration(){
return Long.parseLong(configProp.getProperty("consumerSleepDuration"));
}
/*
* loads configuration property file.
*/
private void initializeConfigProps(){
InputStream configStream =
Consumer.class.getClassLoader().getResourceAsStream("config.properties");
try {
configProp.load(configStream);
System.out.println(" Configuration file loaded successfully ");
} catch (IOException e) {
System.out.println(" Not able to load config.properties ");
e.printStackTrace();
}
}
}
----------------------------------------------------------------------------------------------------------------------
HornetQExceptionListenerImpl.java
----------------------------------------------------------------------------------------------------------------------
package exception;
import javax.jms.ExceptionListener;
import javax.jms.JMSException;
public class HornetQExceptionListenerImpl implements ExceptionListener {
private String errorCode;
private String errorMsg;
private Throwable causedBy;
public void onException(JMSException exp) {
System.out.println(" Error code is " + exp.getErrorCode() + " Error Message " + exp.getMessage() + " caused by " + exp.getCause());
setErrorCode(exp.getErrorCode());
setErrorMsg(exp.getMessage());
setCausedBy(exp.getCause());
}
public String getErrorCode() {
return errorCode;
}
public void setErrorCode(String errorCode) {
this.errorCode = errorCode;
}
public String getErrorMsg() {
return errorMsg;
}
public void setErrorMsg(String errorMsg) {
this.errorMsg = errorMsg;
}
public Throwable getCausedBy() {
return causedBy;
}
public void setCausedBy(Throwable causedBy) {
this.causedBy = causedBy;
}
}
-
7. Re: HornetQ 2.3.0 Final Standalone multicast clustering on 2 seperate machines : getting error HQ119012: Timed out waiting to receive initial broadcast from cluster
ataylor Jun 4, 2013 3:09 AM (in response to poonamkamboj)I just checked using netstat where it shows IP address and port 9876.
That only means the socket is bound to that address not that UDP is allowed on your network, I would check this first.
-
8. Re: HornetQ 2.3.0 Final Standalone multicast clustering on 2 seperate machines : getting error HQ119012: Timed out waiting to receive initial broadcast from cluster
poonamkamboj Jun 4, 2013 5:11 AM (in response to poonamkamboj)Hi Andy,
I tried using sample programs where it sends/recieves data to 9876 port, it works fine, i tried the client /server communication between 2 machines which i am using for HA config of HornetQ, as well as tried remotely from windows and linux machine to connect to server which listens to port 9876, in both cases it had worked fine. so UDP is allowed on the n/w.
Could you please look into the config files i attached in my 1st post, it seems to be broadcast issue. i am writing here my client and server program i used:
-----------------------------------------------------------------------------------------------------------------------------------------------
Client
-----------------------------------------------------------------------------------------------------------------------------------------------
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.DatagramPacket;
import java.net.DatagramSocket;
import java.net.InetAddress;
public class UDPClient {
public static void main(String args[]) throws Exception
{
// Check the arguments
if( args.length != 2 )
{
System.out.println( "usage: java UDPClient host port" ) ;
return ;
}
System.out.println("Please enter text: ");
BufferedReader inFromUser =
new BufferedReader(new InputStreamReader(System.in));
DatagramSocket clientSocket = new DatagramSocket();
//Client Socket is created
InetAddress IPAddress = InetAddress.getByName(args[0]);
int port = Integer.parseInt( args[1] ) ;
//Gets the IP Address
byte[] sendData = new byte[1024];
byte[] receiveData = new byte[1024];
String sentence = inFromUser.readLine();
sendData = sentence.getBytes();
//sends data
DatagramPacket sendPacket = new DatagramPacket(sendData, sendData.length, IPAddress, port);
clientSocket.send(sendPacket);
DatagramPacket receivePacket = new DatagramPacket(receiveData, receiveData.length);
clientSocket.receive(receivePacket);
String modifiedSentence = new String(receivePacket.getData());
System.out.println("FROM SERVER:" + modifiedSentence);
clientSocket.close();
}
}
-----------------------------------------------------------------------------------------------------------------------------------------------
Server
-----------------------------------------------------------------------------------------------------------------------------------------------
import java.net.DatagramPacket;
import java.net.DatagramSocket;
import java.net.InetAddress;
public class UDPServer {
public static void main(String args[]) throws Exception
{
// Check the arguments
if( args.length != 1 )
{
System.out.println( "usage: java UDPServer port" ) ;
return ;
}
int portNo = Integer.parseInt( args[0] ) ;
DatagramSocket serverSocket = new DatagramSocket(portNo);
//Server Socket Created
System.out.println( "Server Started :: " ) ;
byte[] receiveData = new byte[1024];
byte[] sendData = new byte[1024];
while(true)
{
DatagramPacket receivePacket = new DatagramPacket(receiveData, receiveData.length);
serverSocket.receive(receivePacket);
String sentence = new String( receivePacket.getData());
InetAddress ipAddress = receivePacket.getAddress();
int port = receivePacket.getPort();
System.out.println(receivePacket.getAddress().getHostAddress() + " : " + port +" :::: RECEIVED: " + sentence );
String capitalizedSentence = sentence.toUpperCase();
//Change sentence to Capital letter
sendData = capitalizedSentence.getBytes();
DatagramPacket sendPacket =
new DatagramPacket(sendData, sendData.length, ipAddress, port);
serverSocket.send(sendPacket);
//Send Capitalized data back to client
}
}
}
-
9. Re: HornetQ 2.3.0 Final Standalone multicast clustering on 2 seperate machines : getting error HQ119012: Timed out waiting to receive initial broadcast from cluster
ataylor Jun 4, 2013 5:32 AM (in response to poonamkamboj)your config looks ok, tho i do see that you have the client-failure-check-period set to 100 ms, this is far to small, maybe the connection is being closed before it is even open. If that doesn't work try debuging to make sure brodcast and receive is working correctly
-
10. Re: HornetQ 2.3.0 Final Standalone multicast clustering on 2 seperate machines : getting error HQ119012: Timed out waiting to receive initial broadcast from cluster
poonamkamboj Jun 4, 2013 5:33 AM (in response to poonamkamboj)or is there different way which i need to use to connect from Client program..
I am using JNDI to connect to HornetQ Server HA, the same way i used static connectors to use the HA config, i didnt find any issue that time related to client connecting to HQ servers. only thing i used the multicast configuration in hornetq-configuration.xml and hornetq-jms.xml files. client program is same.
-
11. Re: HornetQ 2.3.0 Final Standalone multicast clustering on 2 seperate machines : getting error HQ119012: Timed out waiting to receive initial broadcast from cluster
ataylor Jun 4, 2013 5:40 AM (in response to poonamkamboj)no you are doing it correctly, the factory uses the discovery group config to listen for UDP packets broadcast bu the broadcast group. debug Broadcast and discovery classes to make sure that its all working ok
-
12. Re: HornetQ 2.3.0 Final Standalone multicast clustering on 2 seperate machines : getting error HQ119012: Timed out waiting to receive initial broadcast from cluster
smnarayam Jun 26, 2013 4:58 PM (in response to ataylor)I am facing the same problem after upgrading from Hornetq 2.2.5 to 2.3.0 Final. I have one Linux server running the Live server. A second Linux server acts as the client, and uses HornetQXAConnectionFactory with the DiscoveryGroupConfiguration.
The Live server's clustering configuration is below
<broadcast-groups>
<broadcast-group name="tc-hq-queues-broadcast-group">
<local-bind-address>172.20.172.3</local-bind-address>
<local-bind-port>5432</local-bind-port>
<group-address>231.7.7.8</group-address>
<group-port>9877</group-port>
<connector-ref>netty-connector</connector-ref>
</broadcast-group>
</broadcast-groups>
<discovery-groups>
<discovery-group name="tc-hq-queues-discovery-group">
<local-bind-address>172.20.172.3</local-bind-address>
<group-address>231.7.7.8</group-address>
<group-port>9877</group-port>
<refresh-timeout>10000</refresh-timeout>
</discovery-group>
</discovery-groups>
<cluster-connections>
<cluster-connection name="tc-hq-queues-cluster">
<address>jms</address>
<connector-ref>netty-connector</connector-ref>
<retry-interval>500</retry-interval>
<use-duplicate-detection>true</use-duplicate-detection>
<forward-when-no-consumers>false</forward-when-no-consumers>
<max-hops>1</max-hops>
<discovery-group-ref discovery-group-name="tc-hq-queues-discovery-group"/>
</cluster-connection>
</cluster-connections>
On the client side, my code is
String groupAddress = "231.7.7.8";
int groupPort = 9877;
String groupName = "tc-hq-queues-discovery-group";
UDPBroadcastGroupConfiguration udpConf = new UDPBroadcastGroupConfiguration(groupAddress, groupPort, null, -1);
DiscoveryGroupConfiguration conf = new DiscoveryGroupConfiguration(groupName, 10000, 10000, udpConf);
XAConnectionFactory realXaConnFactory = new HornetQXAConnectionFactory(true, getDiscoveryGroupConfiguration());
The stacktrace is
Caused by: javax.jms.JMSException: Failed to create session factory
at org.hornetq.jms.client.HornetQConnectionFactory.createConnectionInternal(HornetQConnectionFactory.java:587)
at org.hornetq.jms.client.HornetQConnectionFactory.createXAConnection(HornetQConnectionFactory.java:143)
at org.hornetq.jms.client.HornetQConnectionFactory.createXAConnection(HornetQConnectionFactory.java:138)
at bitronix.tm.resource.jms.JndiXAConnectionFactory.createXAConnection(JndiXAConnectionFactory.java:230)
at bitronix.tm.resource.jms.PoolingConnectionFactory.createPooledConnection(PoolingConnectionFactory.java:229)
at bitronix.tm.resource.common.XAPool.createPooledObject(XAPool.java:291)
at bitronix.tm.resource.common.XAPool.grow(XAPool.java:408)
at bitronix.tm.resource.common.XAPool.getInPool(XAPool.java:387)
at bitronix.tm.resource.common.XAPool.getConnectionHandle(XAPool.java:129)
at bitronix.tm.resource.jms.PoolingConnectionFactory.startRecovery(PoolingConnectionFactory.java:160)
... 140 more
Caused by: HornetQException[errorType=CONNECTION_TIMEDOUT message=HQ119012: Timed out waiting to receive initial broadcast from cluster]
at org.hornetq.core.client.impl.ServerLocatorImpl.createSessionFactory(ServerLocatorImpl.java:786)
at org.hornetq.jms.client.HornetQConnectionFactory.createConnectionInternal(HornetQConnectionFactory.java:583)
... 149 more
Using static connectors, i.e., changing HornetQXAConnectionFactory to use the TransportConfiguration, there are no issues & the client is able to connect to the server.
Obviously I had to change my client code due to API changes. I am wondering if there's anything I might have missed on the client side?
Thanks
Mahesh
-
13. Re: HornetQ 2.3.0 Final Standalone multicast clustering on 2 seperate machines : getting error HQ119012: Timed out waiting to receive initial broadcast from cluster
ajinkya.bambal Jun 24, 2014 5:01 AM (in response to poonamkamboj)Hi Andy ,Poonam Kamboj, smnarayam,
I am also facing similar issue using UDP broadcasts and discovery group . My configuration is similar to Poonam's . So How did you people figure out the solution .Please help me out