我正在尝试设置RabbitMQ服务器(版本3.7.4,通过macOS 10.13.4上的自制软件安装),以便我的同事可以通过内部网络使用它。我们使用的是官方Java客户端(com.rabbitmq:amqp-client:5.2.0
)。不幸的是,他们只收到ConnectException
消息Connection refused
:
java.net.ConnectException: Connection refused (Connection refused)
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)
at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
at java.net.Socket.connect(Socket.java:589)
at com.rabbitmq.client.impl.SocketFrameHandlerFactory.create(SocketFrameHandlerFactory.java:60)
at com.rabbitmq.client.impl.recovery.RecoveryAwareAMQConnectionFactory.newConnection(RecoveryAwareAMQConnectionFactory.java:62)
at com.rabbitmq.client.impl.recovery.AutorecoveringConnection.init(AutorecoveringConnection.java:134)
at com.rabbitmq.client.ConnectionFactory.newConnection(ConnectionFactory.java:997)
at com.rabbitmq.client.ConnectionFactory.newConnection(ConnectionFactory.java:956)
at com.rabbitmq.client.ConnectionFactory.newConnection(ConnectionFactory.java:914)
at com.rabbitmq.client.ConnectionFactory.newConnection(ConnectionFactory.java:1068)
at my.own.private.RabbitMqConnector.connect(RabbitMqConnector.java:29)
我们已经设置了另一个具有管理员权限的用户帐户(不是guest
)。使用几乎相同的Java代码,我可以在本地连接(将主机设置为localhost
),但如果我使用我的IP地址则不能。根据RabbitMQ文档,RabbitMQ服务器默认绑定到所有网络接口(否则我会说它是地址绑定的问题)。我禁用了我的防火墙,这应该不是问题。
以下是相应的代码:
final ConnectionFactory connectionFactory = new ConnectionFactory();
connectionFactory.setUsername("username");
connectionFactory.setPassword("password");
connectionFactory.setHost("10.10.33.12");
connectionFactory.setPort(5672);
connectionFactory.setVirtualHost("/");
try (final Connection connection = connectionFactory.newConnection()) {
// doo stuff with the connection
}
答案 0 :(得分:2)
我终于找到了实际问题,它与Java无关或我如何配置window.requestAnimFrame = (function(){
return window.requestAnimationFrame ||
window.webkitRequestAnimationFrame ||
window.mozRequestAnimationFrame ||
window.oRequestAnimationFrame ||
window.msRequestAnimationFrame ||
function( callback ){
window.setTimeout(callback, 1000 / 60);
};
})();
(function animloop(){
requestAnimFrame(animloop);
targetStep = Math.max( Math.round( getYOffset() / 30 ) , 1 ); // what frame to animate to
if(targetStep != step ) { step += (targetStep - step) / 5; } // increment the step until we arrive at the target step
changeFrame();
})();
function changeFrame() {
var thisStep = Math.round(step); // calculate the frame number
if(images.length > 0 && images[thisStep]) { // if the image exists in the array
if(images[thisStep].complete) { // if the image is downloaded and ready
$('#video').attr('src',images[thisStep].src); // change the source of our placeholder image
}
}
}
。如何配置自制的RabbitMQ包是一个问题。在ConnectionFactory
文件中,有以下设置
rabbitmq-env.conf
此设置导致RabbitMQ仅在127.0.0.1上侦听传入连接。删除设置并重新启动服务后,我也可以从其他计算机连接。
谢谢大家的帮助!
答案 1 :(得分:0)
问题不在于您的代码。我建议你检查一下这些事情:
其中一个应该是原因,希望它有所帮助!