there may well be an ordering problem here but also consider BrokerService broker = ... broker.getManagementContext().setCreateConnector(false);
to see the call in context, check out a unit test that configures multiple brokers, eg: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/network/NetworkLoadTest.java?view=markup 2008/9/9 Thomas R. Corbin <[EMAIL PROTECTED]>: > > It seems like I have to create the NetworkConnector first or it messes up the > ManagementContext. > > But if I do create the NetworkConnector first, it *seems* like it creates a > ManagementContext on it's own and it uses the default port (1099). But I > already have another broker on the machine using 1099 for the jmx port. > > I'm kind of confused at how I get these two objects constructed in the right > way, since they both *seem* to depend on each other. > > Or maybe it's not the port, maybe it's the broker name? > > java.rmi.server.ExportException: internal error: ObjID already in use > at sun.rmi.transport.ObjectTable.putTarget(ObjectTable.java:169) > at sun.rmi.transport.Transport.exportObject(Transport.java:74) > at > sun.rmi.transport.tcp.TCPTransport.exportObject(TCPTransport.java:229) > at > sun.rmi.transport.tcp.TCPEndpoint.exportObject(TCPEndpoint.java:393) > at sun.rmi.transport.LiveRef.exportObject(LiveRef.java:129) > at > sun.rmi.server.UnicastServerRef.exportObject(UnicastServerRef.java:190) > at sun.rmi.registry.RegistryImpl.setup(RegistryImpl.java:92) > at sun.rmi.registry.RegistryImpl.<init>(RegistryImpl.java:78) > at > java.rmi.registry.LocateRegistry.createRegistry(LocateRegistry.java:186) > at > org.apache.activemq.broker.jmx.ManagementContext.createConnector(ManagementContext.java:365) > at > org.apache.activemq.broker.jmx.ManagementContext.findMBeanServer(ManagementContext.java:293) > at > org.apache.activemq.broker.jmx.ManagementContext.getMBeanServer(ManagementContext.java:148) > at > org.apache.activemq.broker.BrokerService.registerNetworkConnectorMBean(BrokerService.java:1442) > at > org.apache.activemq.broker.BrokerService.addNetworkConnector(BrokerService.java:328) > at > org.apache.activemq.broker.BrokerService.addNetworkConnector(BrokerService.java:280) > at > org.apache.activemq.broker.BrokerService.addNetworkConnector(BrokerService.java:256) > > -- > Card #1. Uncle Bob's Three Laws > > • Write no production code except to pass a failing test. > • Write only enough of a test to demonstrate a failure. > • Write only enough production code to pass the test. > >