Hi,

When adding a network connector, the first one goes OK:
// create network connector over JMX
            ObjectName brokerObjectName = new
ObjectName("org.apache.activemq:type=Broker,brokerName=" + broker1Name);

            BrokerViewMBean proxyBroker = (BrokerViewMBean)
broker.getManagementContext().newProxyInstance(brokerObjectName,
BrokerViewMBean.class, true);
            // add the NC
            proxyBroker.addNetworkConnector("static://"+urlBroker2);

Sometime after I try to add another one:

brokerObjectName = new
ObjectName("org.apache.activemq:type=Broker,brokerName=" + broker1Name);
            proxyBroker = (BrokerViewMBean)
broker.getManagementContext().newProxyInstance(brokerObjectName,
BrokerViewMBean.class, true);
            // let's add the NC
            networkConnectorName =
proxyBroker.addNetworkConnector("static://"+urlBroker3);

This time it fails.

Caused by: javax.management.InstanceAlreadyExistsException:
org.apache.activemq:type=Broker,brokerName=ig2-1,connector=networkConnectors,networkConnectorName=NC
        at com.sun.jmx.mbeanserver.Repository.addMBean(Repository.java:437)

I understand that it fails on InstanceAlreadyExistsException, but I don't
know
how to overcome it.

A workaround is to remove the fist network connector 
proxyBroker.removeNetworkConnector("NC");

and then add both network connectors:
proxyBroker.addNetworkConnector("static://"+urlBroker2+","+urlBroker3);

Any help will be appreciated.

Thanks,
Maor




--
Sent from: http://activemq.2283324.n4.nabble.com/ActiveMQ-User-f2341805.html

Reply via email to