你如何解决这个JMSException?谢谢!
代理:localhost - 客户端:FS_Proceduer已连接
javax.jms.InvalidClientIDException: Broker: localhost - Client: FS_Proceduer already connected from /127.0.0.1:56556
Run Code Online (Sandbox Code Playgroud)
这是由此方法触发的:
private void connectAndInitActiveMQ() throws JMSException{
logger.debug("It's ready to connect to jms service");
if(null != connection){
try{
logger.debug("Closing connection");
connection.close();
}catch(Exception e){
logger.error(e.getMessage(), e);
}
}
logger.debug("Creating a new connection");
logger.debug("Is queueConnectionFactory null? "+(queueConnectionFactory==null));
connection = queueConnectionFactory.createConnection();
logger.debug("Is the new connection null? "+(connection==null));
logger.debug("Starting the new connection");
connection.start();
logger.debug("Connected successfully: " + connection);
session = connection.createSession(true, Session.AUTO_ACKNOWLEDGE);
queue = session.createQueue(queueName);
messageProducer = session.createProducer(queue);
}
Run Code Online (Sandbox Code Playgroud)
这是工厂问题吗?还是其他一些来源?
如果您将连接配置为具有相同的客户端ID,则会出现此错误.JMS规范明确指出,在任何给定时间,只有一个连接可以使用相同的客户端ID连接到远程,解决您的配置,事情应该正常工作.
| 归档时间: |
|
| 查看次数: |
5765 次 |
| 最近记录: |