Java – connection error RabbitMQ on STS4

connection error RabbitMQ on STS4… here is a solution to the problem.

connection error RabbitMQ on STS4

I tried to connect to RabbitMQ on local port 15672 but got a connection error. I’m not sure what caused it because I’m trying to learn RabbitMQ… This is tutorial 1 and I can’t even run it. ( )

Below is the code and error. The only changes I made to the tutorial were to specify the port and username/password. Any ideas?


import com.rabbitmq.client.ConnectionFactory;
import com.rabbitmq.client.Connection;
import com.rabbitmq.client.Channel;

public class Send {
    private final static String QUEUE_NAME = "hello";
    public static void main(String[] argv) throws Exception{
        ConnectionFactory factory = new ConnectionFactory();
        try (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 + "'");



Exception in thread "main"
    at com.rabbitmq.client.impl.AMQChannel.wrap(
    at com.rabbitmq.client.impl.AMQChannel.wrap(
    at com.rabbitmq.client.impl.AMQConnection.start(
    at com.rabbitmq.client.impl.recovery.RecoveryAwareAMQConnectionFactory.newConnection(
    at com.rabbitmq.client.impl.recovery.AutorecoveringConnection.init(
    at com.rabbitmq.client.ConnectionFactory.newConnection(
    at com.rabbitmq.client.ConnectionFactory.newConnection(
    at com.rabbitmq.client.ConnectionFactory.newConnection(
    at com.rabbitmq.client.ConnectionFactory.newConnection(
Caused by: com.rabbitmq.client.ShutdownSignalException: connection error
    at com.rabbitmq.utility.ValueOrException.getValue(
    at com.rabbitmq.utility.BlockingValueOrException.uninterruptibleGetValue(
    at com.rabbitmq.client.impl.AMQChannel$BlockingRpcContinuation.getReply(
    at com.rabbitmq.client.impl.AMQConnection.start(
    ... 7 more
Caused by:
    at java.base/
    at com.rabbitmq.client.impl.Frame.readFrom(
    at com.rabbitmq.client.impl.SocketFrameHandler.readFrame(
    at com.rabbitmq.client.impl.AMQConnection$
    at java.base/


Port 15672 is the (default) HTTP port for the Management (Management Plug-in) UI.

The default AMQP port is 5672.

Related Problems and Solutions