无法连接到 spark scala 中的 RabbitMQ
Unable to connect to RabbitMQ in spark scala
下面是在spark scala中测试Rabbitmq连接的代码。
import com.rabbitmq.client.ConnectionFactory
def getRabbitMQConnection()={
val factory = new ConnectionFactory()
factory.setUsername("****")
factory.setPassword("****")
factory.setHost("***")
factory.setVirtualHost("5672")
val connection = factory.newConnection()
}
当我尝试连接时,出现以下错误。
Caused by: com.rabbitmq.client.ShutdownSignalException: connection error; protocol method: #method<connection.close>(reply-code=530, reply-text=NOT_ALLOWED - access to vhost '5672' refused for user '****', class-id=10, method-id=40)
有人可以帮忙吗。
谢谢。
access to vhost '5672' refused for user '****'
我认为您混淆了 TCP 端口和虚拟主机。
试试:
factory.setVirtualHost("/")
下面是在spark scala中测试Rabbitmq连接的代码。
import com.rabbitmq.client.ConnectionFactory
def getRabbitMQConnection()={
val factory = new ConnectionFactory()
factory.setUsername("****")
factory.setPassword("****")
factory.setHost("***")
factory.setVirtualHost("5672")
val connection = factory.newConnection()
}
当我尝试连接时,出现以下错误。
Caused by: com.rabbitmq.client.ShutdownSignalException: connection error; protocol method: #method<connection.close>(reply-code=530, reply-text=NOT_ALLOWED - access to vhost '5672' refused for user '****', class-id=10, method-id=40)
有人可以帮忙吗。
谢谢。
access to vhost '5672' refused for user '****'
我认为您混淆了 TCP 端口和虚拟主机。
试试:
factory.setVirtualHost("/")