[rabbitmq-discuss] connection is not creating

U D MISHRA upendramishra4 at gmail.com
Mon Apr 29 07:24:23 BST 2013


when I run this code :
package rabbitmqproject;
import com.rabbitmq.client.Connection;
import com.rabbitmq.client.Channel;
import com.rabbitmq.client.*;


public class Main {

 private final static String QUEUE_NAME = "hello";

    public static void main(String[] argv) throws java.io.IOException {
        ConnectionFactory factory = new ConnectionFactory();
        factory.setHost("localhost");
        Connection connection = factory.newConnection();
        Channel channel = connection.createChannel();

        channel.queueDeclare(QUEUE_NAME, false, false, false, null);
        String message = "Hello World!";
        channel.basicPublish("", QUEUE_NAME, null, message.getBytes());

        System.out.println(" [x] Sent '" + message + "'");
        channel.close();
        connection.close();

}
}

i got some exception in " Connection connection = factory.newConnection();"
line
   my out put is: Exception in thread "main" java.io.IOException
        at com.rabbitmq.client.impl.AMQChannel.wrap(AMQChannel.java:107)
        at
com.rabbitmq.client.impl.AMQConnection.start(AMQConnection.java:265)
        at
com.rabbitmq.client.ConnectionFactory.newConnection(ConnectionFactory.java:403)
        at
com.rabbitmq.client.ConnectionFactory.newConnection(ConnectionFactory.java:423)
        at rabbitmqproject.Main.main(Main.java:22)


please help me what is the reason
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/attachments/20130429/bb4589ca/attachment.htm>


More information about the rabbitmq-discuss mailing list