Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
None
-
None
Description
It looks like there is bug in CXF that it cannot register two different Endpoint to JMX if both has a same service bean (although we deploy both endpoint on different url.). Please see my example below, it will throw the exception javax.management.InstanceAlreadyExistsException. I think the issue is that cxf is using
I have two suggestions:
- Can we short the JMX namespace and its name for cxf endpoint? It likes okay in visualvm, however, it will become a really long name when we use command-line interface of jmx, e.g. jmxsh.
- Can CXF allow the user to customize the JMX name space and JMX endpoint name?
public static void main(String[] args) throws Throwable { InstrumentationManagerImpl im = new InstrumentationManagerImpl(); im.setBus(BusFactory.getDefaultBus()); im.setEnabled(true); im.setServer(ManagementFactory.getPlatformMBeanServer()); im.init(); im.register(); HelloWorldImpl helloworldImpl1 = new HelloWorldImpl(); ServerFactoryBean svrFactory = new ServerFactoryBean(); svrFactory.setAddress("http://localhost:9000/Hello"); svrFactory.setServiceBean(helloworldImpl1); svrFactory.create(); HelloWorldImpl helloworldImpl2 = new HelloWorldImpl(); ServerFactoryBean svrFactory2 = new ServerFactoryBean(); svrFactory2.setAddress("http://localhost:9000/Hello2"); svrFactory2.setServiceBean(helloworldImpl2); svrFactory2.create(); System.out.println("Server ready..."); Thread.sleep(5 * 60 * 1000); System.out.println("Server exiting"); System.exit(0); }