sprint数据流流中的Rabbitmq连接被拒绝

时间:2018-12-02 06:23:00

标签: spring rabbitmq spring-cloud

我正在使用以下参数运行spring-cloud-dataflow-server-local:

java -jar spring-cloud-dataflow-server-local-1.5.1.RELEASE.jar --spring.datasource.url=jdbc:mysql://192.168.0.103:3306/scdf --spring.datasource.username=root --spring.datasource.password=12345 --spring.datasource.driver-class-name=org.mariadb.jdbc.Driver --spring.rabbitmq.host=192.168.0.103 --spring.rabbitmq.port=5672 --spring.rabbitmq.username=admin --spring.rabbitmq.password=admin

服务器正在运行,但是当我创建流并部署流时,它显示了从Rabbitmq服务器拒绝的连接。我已经在docker容器中创建了rabbitmq服务器,并且工作正常,因为我已经使用以下代码对其进行了测试:

package org.niklas.tutorial;

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

import java.io.IOException;
import java.net.URISyntaxException;
import java.security.KeyManagementException;
import java.security.NoSuchAlgorithmException;

public class Publisher {

    public static void main(String[] args) throws NoSuchAlgorithmException, KeyManagementException, URISyntaxException, IOException, InterruptedException {
        ConnectionFactory factory = new ConnectionFactory();
        factory.setUri("amqp://admin:admin@192.168.0.103");
        factory.setConnectionTimeout(300000);
        Connection connection = factory.newConnection();
        Channel channel = connection.createChannel();

        channel.queueDeclare("my-queue", true, false, false, null);

        int count = 0;

        while (count < 5000) {
            String message = "Message number " + count;

            channel.basicPublish("", "my-queue", null, message.getBytes());
            count++;
            System.out.println("Published message: " + message);

            Thread.sleep(5000);
        }
    }
}

上面的代码按预期方式工作,并且通过管理控制,我可以轻松访问我的Rabbitmq服务器。不幸的是,当我尝试使用spring-cloud-dataflow-server-local部署任何流时,会在控制台上显示

的连接被拒绝的错误。
start if the connection factory supports it. Exception summary: org.springframework.amqp.AmqpConnectException: java.net.ConnectException: Connection refused (Connection refused)
2018-12-02 11:47:56.250  INFO 1343 --- [N.toll-stream-1] o.s.a.r.l.SimpleMessageListenerContainer : Restarting Consumer@49a71302: tags=[{}], channel=null, acknowledgeMode=AUTO local queue size=0
2018-12-02 11:48:01.322  WARN 1343 --- [N.toll-stream-2] o.s.a.r.l.SimpleMessageListenerContainer : Consumer raised exception, processing can restart if the connection factory supports it. Exception summary: org.springframework.amqp.AmqpConnectException: java.net.ConnectException: Connection refused (Connection refused)
2018-12-02 11:48:01.322  INFO 1343 --- [N.toll-stream-2] o.s.a.r.l.SimpleMessageListenerContainer : Restarting Consumer@3f73c8e6: tags=[{}], channel=null, acknowledgeMode=AUTO local queue size=0
2018-12-02 11:48:06.399  WARN 1343 --- [N.toll-stream-3] o.s.a.r.l.SimpleMessageListenerContainer : Consumer raised exception, processing can restart if the connection factory supports it. Exception summary: org.springframework.amqp.AmqpConnectException: java.net.ConnectException: Connection refused (Connection refused)
2018-12-02 11:48:06.399  INFO 1343 --- [N.toll-stream-3] o.s.a.r.l.SimpleMessageListenerContainer : Restarting Consumer@59562a94: tags=[{}], channel=null, acknowledgeMode=AUTO local queue size=0
2018-12-02 11:48:11.478  WARN 1343 --- [N.toll-stream-4] o.s.a.r.l.SimpleMessageListenerContainer : Consumer raised exception, processing can restart if the connection factory supports it. Exception summary: org.springframework.amqp.AmqpConnectException: java.net.ConnectException: Connection refused (Connection refused)
2018-12-02 11:48:11.479  INFO 1343 --- [N.toll-stream-4] o.s.a.r.l.SimpleMessageListenerContainer : Restarting Consumer@773d1ebe: tags=[{}], channel=null, acknowledgeMode=AUTO local queue size=0
2018-12-02 11:48:16.569  WARN 1343 --- [N.toll-stream-5] o.s.a.r.l.SimpleMessageListenerContainer : Consumer raised exception, processing can restart if the connection factory supports it. Exception summary: org.springframework.amqp.AmqpConnectException: java.net.ConnectException: Connection refused (Connection refused)
2018-12-02 11:48:16.569  INFO 1343 --- [N.toll-stream-5] o.s.a.r.l.SimpleMessageListenerContainer : Restarting Consumer@152e6b97: tags=[{}], channel=null, acknowledgeMode=AUTO local queue size=0
2018-12-02 11:48:21.653  WARN 1343 --- [N.toll-stream-6] o.s.a.r.l.SimpleMessageListenerContainer : Consumer raised exception, processing can restart if the connection factory supports it. Exception summary: org.springframework.amqp.AmqpConnectException: java.net.ConnectException: Connection refused (Connection refused)
2018-12-02 11:48:21.653  INFO 1343 --- [N.toll-stream-6] o.s.a.r.l.SimpleMessageListenerContainer : Restarting Consumer@7c11dc5a: tags=[{}], channel=null, acknowledgeMode=AUTO local queue size=0
2018-12-02 11:48:26.744  WARN 1343 --- [N.toll-stream-7] o.s.a.r.l.SimpleMessageListenerContainer : Consumer raised exception, processing can restart if the connection factory supports it. Exception summary: org.springframework.amqp.AmqpConnectException: java.net.ConnectException: Connection refused (Connection refused)
2018-12-02 11:48:26.744  INFO 1343 --- [N.toll-stream-7] o.s.a.r.l.SimpleMessageListenerContainer : Restarting Consumer@a9dd22f: tags=[{}], channel=null, acknowledgeMode=AUTO local queue size=0
2018-12-02 11:48:31.831  WARN 1343 --- [N.toll-stream-8] o.s.a.r.l.SimpleMessageListenerContainer : Consumer raised exception, processing can restart if the connection factory supports it. Exception summary: org.springframework.amqp.AmqpConnectException: java.net.ConnectException: Connection refused (Connection refused)

需要帮助。还有没有人可以从spring-cloud-dataflow-server的控制台中看到正在使用哪个Rabbitmq服务器IP?

0 个答案:

没有答案