javax.jms.InvalidClientIDException:Broker:localhost - 客户端:已从/127.0.0.1:port连接的FS_Proceduer

时间:2015-07-29 12:10:45

标签: activemq

如何解决此JMSException?谢谢!

代理:localhost - 客户端:已连接FS_Proceduer

javax.jms.InvalidClientIDException: Broker: localhost - Client: FS_Proceduer already connected from /127.0.0.1:56556

这是由此方法触发的:

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);
    }

是工厂问题吗?还是其他一些来源?

1 个答案:

答案 0 :(得分:6)

如果您将连接配置为具有相同的客户端ID,则会出现此错误。 JMS规范明确指出,在任何给定时间,只有一个连接可以使用相同的客户端ID连接到远程,解决您的配置并且事情应该正常工作。