About rabbitmq: factory Newconnection() reported an error com rabbitmq. client.ShutdownSignalException
exception information
Exception in thread "main" java.io.IOException
at com.rabbitmq.client.impl.AMQChannel.wrap(AMQChannel.java:129)
at com.rabbitmq.client.impl.AMQChannel.wrap(AMQChannel.java:125)
at com.rabbitmq.client.impl.AMQChannel.exnWrappingRpc(AMQChannel.java:147)
at com.rabbitmq.client.impl.AMQConnection.start(AMQConnection.java:439)
at com.rabbitmq.client.impl.recovery.RecoveryAwareAMQConnectionFactory.newConnection(RecoveryAwareAMQConnectionFactory.java:65)
at com.rabbitmq.client.impl.recovery.AutorecoveringConnection.init(AutorecoveringConnection.java:160)
at com.rabbitmq.client.ConnectionFactory.newConnection(ConnectionFactory.java:1216)
at com.rabbitmq.client.ConnectionFactory.newConnection(ConnectionFactory.java:1173)
at com.rabbitmq.client.ConnectionFactory.newConnection(ConnectionFactory.java:1131)
at com.rabbitmq.client.ConnectionFactory.newConnection(ConnectionFactory.java:1294)
at util.ConnectionUtil.getConnection(ConnectionUtil.java:40)
at Foundation_auto ACK.Send.main(Send.java:27)
Caused by: com.rabbitmq.client.ShutdownSignalException: connection error; protocol method: #method<connection.close>(reply-code=530, reply-text=NOT_ALLOWED - vhost /kavito not found, class-id=10, method-id=40)
at com.rabbitmq.utility.ValueOrException.getValue(ValueOrException.java:66)
at com.rabbitmq.utility.BlockingValueOrException.uninterruptibleGetValue(BlockingValueOrException.java:36)
at com.rabbitmq.client.impl.AMQChannel$BlockingRpcContinuation.getReply(AMQChannel.java:502)
at com.rabbitmq.client.impl.AMQChannel.privateRpc(AMQChannel.java:293)
at com.rabbitmq.client.impl.AMQChannel.exnWrappingRpc(AMQChannel.java:141)
... 9 more
tools
public class ConnectionUtil {
private static final String HOST = "127.0.0.1";
/**
* Here java access requires the use of 5672;
* web access uses 15672;
*/
private static final Integer PORT = 5672;
private static final String VIRTUAL_HOST = "/kavito";
private static final String USERNAME = "chen";
private static final String PASSWORD = "a123";
public static Connection getConnection() throws IOException, TimeoutException {
// Define the connection factory
ConnectionFactory factory = new ConnectionFactory();
// Service address
factory.setHost(HOST);
// Port
factory.setPort(PORT);
// set account information, username, password, vhost
// set virtual machine, one mq service can set multiple virtual machines, each virtual machine is equivalent to a separate mq
factory.setVirtualHost(VIRTUAL_HOST);
factory.setUsername(USERNAME);
factory.setPassword(PASSWORD);
// Get the connection through the factory
Connection connection = factory.newConnection();
return connection;
}
}
problem-solving: my solution is not to use the online setting permission
Reference commands for setting permissions
rabbitmqctl set_permissions -p "/" username ".*" ".*" ".*"
My problem is caused by setting the virtual machine
the default virtual machine on rabbitmq is
and the virtual machine set in my code is
Solution:
the first Change the virtual machine in the code to
the second Create a new virtual machine named/kavito in rabbitmq (PS: the name here depends on your actual situation)
and set permissions for the corresponding user
Read More:
- [Solved] rabbitmq Start service rabbitmq-server restart Error
- How to Solve Rabbitmq Error: Failed to start RabbitMQ broker
- RabbitMQ:address (cannot connect to host/port) [How to Solve]
- Rabbitmq: Erlang distribution failed solution
- Rabbitmq failed to stop normally: ERROR: node with name “rabbit” already running on “localhost”
- RabbitMQ Configuration File Error: publisher-confirms=true [Solved]
- Rabbitmq Install Error (You have already installed the higher version of Erlang)
- [Solved] Rabbitmq Server Error: unable to perform an operation on node ‘rabbit@nscczzms‘. P
- RabbitMQ:[error] Error when reading /Users/sixcandy/.erlang.cookie: eacces
- CentOS8 Run rabbitmq-server Error: epmd error for host 172: badarg (unknown POSIX error)
- [Solved] Error: failed to create deliver client: orderer client failed to connect to orderer.example.com:7050
- [Solved] org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘dataSource‘
- Kubernetes Error: Error in configuration: unable to read client-cert* unable to read client-key*
- org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘globalTransa
- PIKA trouble02 — (error) ERR Syntax error, try CLIENT (LIST [order by [addr|idle]| KILL ip:port)
- [Solved] Fabric Start Network Error: Error: error getting endorser client for channel: endorser client failed to connect to
- Springboot integrates redis factory method ‘redisconnectionfactory’ threw exception; nested exception is
- [Solved] Consul Error: github.com/boltdb/bolt github.com/boltdb/bolt github.com/hashicorp/raft-boltdb
- [Solved] Git Error: client_global_hostkeys_private_confirm: server gave bad signature for RSA key 0
- [Solved] Golang Error: main.go:5:2: package go_code/chapter10/factory/model is not in GOROOT