[rabbitmq-discuss] Exception in Creating Rabbit MQ Connection

Sagar Varpe sagar131 at gmail.com
Thu Feb 24 17:15:40 GMT 2011


Hi guys...

       I am using rabbitmq server 2.3 .and java client 2.3.1
        My application is in Scala.
       There are  about 8-9 Actors each has its own RabbitMQ QueueManager.
and every actor in checking for message in each queue for every 1 minute


   in each Queue Manager the getting connection method is like

   1. private def getConnection {
   2.     try {
   3.       conn = FACTORY.newConnection
   4.       if (conn == null) {
   5.         logger.info(" FAILED TO CREATE CONNECTION WITH RABBITMQ ON  "
   + FACTORY.getHost + ":" + FACTORY.getPort)
   6.       }
   7.       channel = conn.createChannel
   8.       if (channel == null) {
   9.         logger.info(" FAILED TO CREATE CHANNEL WITH RABBITMQ ON  " +
   FACTORY.getHost + ":" + FACTORY.getPort)
   10.       }
   11.       if (conn != null) {
   12.         val durable = true
   13.         channel.exchangeDeclare(EXCHANGE, "direct", durable)
   14.         channel.queueDeclare(QUEUE, durable, false, false, null)
   15.         channel queueBind (QUEUE, EXCHANGE, ROUTING_KEY)
   16.       }
   17.     } catch {
   18.       case e: Exception => logger.error("Exception In Getting
   Connection to RabbitMQ ", e)
   19.     }
   20.
   21.   }



  while publishing message on rabbitMQ Server . i am checking for null
connection .if it is null then creating new connection
  same for Getmessage .........

  I never close channel and connection for Rabbitmq .

 this work ............But afet some couple of hours it gives me exception


  Exception in Creating Rabbit MQ Connection
java.net.ConnectException: Connection timed out
       at java.net.PlainSocketImpl.socketConnect(Native Method)
       at
java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:310)
       at
java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:176)
       at
java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:163)
       at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:384)
       at java.net.Socket.connect(Socket.java:546)
       at java.net.Socket.connect(Socket.java:495)
       at
com.rabbitmq.client.ConnectionFactory.createFrameHandler(ConnectionFactory.java:338)
       at
com.rabbitmq.client.ConnectionFactory.newConnection(ConnectionFactory.java:376)
       at
com.rabbitmq.client.ConnectionFactory.newConnection(ConnectionFactory.java:399)


Is there any possible solution for this type of exception



-- 
Best Regards,
Sagar Varpe
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/attachments/20110224/b66d6a09/attachment.htm>


More information about the rabbitmq-discuss mailing list