<div dir="ltr"><div><div><div>when I run this code :<br>package rabbitmqproject;<br>import com.rabbitmq.client.Connection;<br>import com.rabbitmq.client.Channel;<br>import com.rabbitmq.client.*;<br><br><br>public class Main {<br>
     <br> private final static String QUEUE_NAME = &quot;hello&quot;;<br><br>    public static void main(String[] argv) throws java.io.IOException {<br>        ConnectionFactory factory = new ConnectionFactory();<br>        factory.setHost(&quot;localhost&quot;);<br>
        Connection connection = factory.newConnection();<br>        Channel channel = connection.createChannel();<br><br>        channel.queueDeclare(QUEUE_NAME, false, false, false, null);<br>        String message = &quot;Hello World!&quot;;<br>
        channel.basicPublish(&quot;&quot;, QUEUE_NAME, null, message.getBytes());<br><br>        System.out.println(&quot; [x] Sent &#39;&quot; + message + &quot;&#39;&quot;);<br>        channel.close();<br>        connection.close();<br>
<br>}<br>}<br><br></div>i got some exception in &quot; Connection connection = factory.newConnection();&quot; line <br></div>   my out put is: Exception in thread &quot;main&quot; java.io.IOException<br>        at com.rabbitmq.client.impl.AMQChannel.wrap(AMQChannel.java:107)<br>
        at com.rabbitmq.client.impl.AMQConnection.start(AMQConnection.java:265)<br>        at com.rabbitmq.client.ConnectionFactory.newConnection(ConnectionFactory.java:403)<br>        at com.rabbitmq.client.ConnectionFactory.newConnection(ConnectionFactory.java:423)<br>
        at rabbitmqproject.Main.main(Main.java:22)<br><br><br></div>please help me what is the reason<br></div>