Below is the code used for testing the Rabbitmq connection in spark scala.
import com.rabbitmq.client.ConnectionFactory
def getRabbitMQConnection()={
val factory = new ConnectionFactory()
factory.setUsername("****")
factory.setPassword("****")
factory.setHost("***")
factory.setVirtualHost("5672")
val connection = factory.newConnection()
}
When I tried to connect, I get the below error.
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)
Could someone please assist.
Thank you.
CodePudding user response:
access to vhost '5672' refused for user '****'
I think you are confusing the TCP port with the Virtual host.
try with:
factory.setVirtualHost("/")
