MainClass.url is what is important. What;s the url you're using to
connect to the brokers?


Cheers
--
Dejan Bosanac - http://twitter.com/dejanb

Open Source Integration - http://fusesource.com/
ActiveMQ in Action - http://www.manning.com/snyder/
Blog - http://www.nighttale.net



On Mon, Sep 13, 2010 at 2:47 PM, activeMqUser
<manoranjan.si...@connectm.com> wrote:
>
> Hi Dejan,
>
> Thanks for your quick reply. Connection url i didnt get it properly, but i
> am opening the JMS connection as following.
>
> public static Connection openJMSConnection()
>        {
>                isActiveMQRunning = false;
>                ActiveMQConnectionFactory connectionFactory = null;
>                Connection connection = null;
>                int count = 0;
>                // If unable to open the jmsConnection keep on trying untill 
> success.
>                while (!isActiveMQRunning)
>                {
>                        try
>                        {
>                                log.info("Connecting to URL : " + 
> MainClass.url + "\t" +
> MainClass.userId + "\t" + MainClass.password);
>                                // Create a ActiveMQConnectionFactory object.
>                                connectionFactory = new 
> ActiveMQConnectionFactory(MainClass.userId,
> MainClass.password, MainClass.url);
>                                // Create a logicalAlarmConnection.
>                                connection = 
> connectionFactory.createConnection();
>                                isActiveMQRunning = true;
>
>                        }
>                        catch (Exception e)
>                        {
>                                count++;
>                                InetAddress inet = null;
>                                if (count == 1)
>                                {
>                                        try
>                                        {
>                                                inet = 
> InetAddress.getLocalHost();
>                                        }
>                                        catch (Exception ex)
>                                        {
>                                                log.error("Error while getting 
> ip address of System.. " + ex);
>                                        }
>
>                                        log.fatal("ActiveMQ Server is down... 
> on " + inet + " machine");
>                                }
>                                else
>                                {
>                                        log.error("Unable to open Connection. 
> ActiveMQ Server is down... ");
>                                }
>                                isActiveMQRunning = false;
>                        }
>                }
>                return connection;
>        }
>
> If this is not enough to understand please let me know.
>
> Thanks
> --
> View this message in context: 
> http://activemq.2283324.n4.nabble.com/Failover-problem-tp2537292p2537354.html
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>

Reply via email to