Javax.jms.InvalidClientIDException: Broker: localhost - Client: FS_Proceduer is already connected from / 127.0.0.1: port

How do you resolve this JMSException? Thank you!

Broker: localhost - Client: FS_Proceduer is already connected

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

      

It is caused by this method:

private void connectAndInitActiveMQ() throws JMSException{
        logger.debug("It 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);
    }

      

Is this a factory problem? Or some other source?

+3


source to share


2 answers


You will get this error if you configure your connections to the same client ID. The JMS spec is explicit that only one connection can connect to a remote device with the same client id at any given time, resolve your configuration and everything should work fine.



+6


source


@ Tim-Bish it looks like this is still a problem.

We see this when the client does not start for some reason. Then the connection doesn't close and of course throws an exception when trying to start again with the same clientId.



Is there a way to reuse existing connections? Should we make the client IDs semi-random. What happens to the lost connections in this case?

There's a codebase for OpenWire ( https://git-wip-us.apache.org/repos/asf?p=activemq-nms-openwire.git ) seems to be abandoned, so I'm asking right here.

0


source







All Articles