天天看点

Caused by: java.net.BindException: Address already in use: JVM_Bind(ActiveMq已经启动)

1.本地启动项目开启两个启动类出错。

Error creating bean with name 'brokerService' defined in class path resource
[com/dfocus/meeting/framework/config/mq/ActiveMQConfig.class]: 
Bean instantiation via factory method failed; 
nested exception is org.springframework.beans.BeanInstantiationException: 
Failed to instantiate [org.apache.activemq.broker.BrokerService]: 
Factory method 'brokerService' threw exception; 
nested exception is java.io.IOException: Failed to bind to server socket:
tcp://localhost:61616 due to: java.net.BindException: Address already in use: JVM_Bind
           

由于项目使用了内置的ActiveMq,第一个启动类启动成功,内置ActiveMq也启动了。启动第二个启动类时,ActiveMq正在启动中,所以报错。

2.解决方法

1.在第二个启动类修改ActiveMq端口号,启动一个新的内置ActiveMq。

2.使用外部部署的ActiveMq服务器。