RabbitMQ connection exception
<p>I tried using the rabbitMQ and while creating the connection I got the below given exception with output, I am not sure what went wrong.
The factory is working fine and the hostname,port , username and password are setting correctly, but the connection is failing each time.</p>

<pre><code>In main 
 parametres setted , now creating the connection
The host name and other params are localhost
The host name and other params are admin
The host name and other params are admin
The host name and other params are 5672
 setted all the params


*Exception in thread "main" java.io.IOException
    at com.rabbitmq.client.impl.AMQChannel.wrap(AMQChannel.java:106)
    at com.rabbitmq.client.impl.AMQChannel.wrap(AMQChannel.java:102)
    at com.rabbitmq.client.impl.AMQConnection.start(AMQConnection.java:347)
    at com.rabbitmq.client.ConnectionFactory.newConnection(ConnectionFactory.java:516)
    at com.rabbitmq.client.ConnectionFactory.newConnection(ConnectionFactory.java:533)
    at com.TestSend.main(TestSend.java:39)
Caused by: com.rabbitmq.client.ShutdownSignalException: connection error; reason: java.lang.NoClassDefFoundError: org/apache/commons/io/input/ProxyInputStream
    at com.rabbitmq.utility.ValueOrException.getValue(ValueOrException.java:67)
    at com.rabbitmq.utility.BlockingValueOrException.uninterruptibleGetValue(BlockingValueOrException.java:33)
    at com.rabbitmq.client.impl.AMQChannel$BlockingRpcContinuation.getReply(AMQChannel.java:343)
    at com.rabbitmq.client.impl.AMQConnection.start(AMQConnection.java:300)
    ... 3 more
Caused by: java.lang.NoClassDefFoundError: org/apache/commons/io/input/ProxyInputStream
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:760)
    at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
    at java.net.URLClassLoader.defineClass(URLClassLoader.java:467)
    at java.net.URLClassLoader.access$100(URLClassLoader.java:73)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:368)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:362)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:361)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    at com.rabbitmq.client.impl.AMQImpl.readMethodFrom(AMQImpl.java:3205)
    at com.rabbitmq.client.impl.CommandAssembler.consumeMethodFrame(CommandAssembler.java:93)
    at com.rabbitmq.client.impl.CommandAssembler.handleFrame(CommandAssembler.java:158)
    at com.rabbitmq.client.impl.AMQCommand.handleFrame(AMQCommand.java:87)
    at com.rabbitmq.client.impl.AMQChannel.handleFrame(AMQChannel.java:89)
    at com.rabbitmq.client.impl.AMQConnection$MainLoop.run(AMQConnection.java:500)
Caused by: java.lang.ClassNotFoundException: org.apache.commons.io.input.ProxyInputStream
    at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    ... 18 more*
</code></pre>

<p>The code I wrote was </p>

<pre><code> package com;

    import com.rabbitmq.client.Channel;
    import com.rabbitmq.client.Connection;
    import java.io.IOException;
    import java.util.HashMap;
    import java.util.Map;
    import com.rabbitmq.client.ConnectionFactory;

    public class TestSend {

        public static void main(String[] args) throws IOException {

            System.out.println("In main ");

            // Setting up connection
            ConnectionFactory factory;
            factory = new ConnectionFactory();
            String host = "localhost";
            String password = "admin";
            String user = "admin";
            String port = "5672";

            System.out.println(" parametres setted , now creating the connection");

            factory.setHost(host);
            factory.setPassword(password);
            factory.setUsername(user);
            factory.setPort(Integer.parseInt(port));
            factory.setRequestedHeartbeat(30);

            System.out.println("The host name and other params are " + factory.getHost());

            System.out.println("The host name and other params are " + factory.getUsername());
            System.out.println("The host name and other params are " + factory.getPassword());
            System.out.println("The host name and other params are " + factory.getPort());
            System.out.println("Setted all the params");
            Connection connection;


            connection = factory.newConnection();

            System.out.println("Establishing the connection " + host);





            String s = "Hello";

            Channel channel; // This channel sends the file
            channel = connection.createChannel();
            System.out.println("declaring Queue now");
            channel.queueDeclare("nav", true, false, false, null);
            channel.basicPublish("", "nav", null, s.getBytes());

            System.out.println(" seems like everything has been sent to the queue ");
            System.out.println("Closing the connection");
            channel.close();
            connection.close();

        }
    }
</code></pre>