[ 
https://issues.apache.org/jira/browse/CXF-3398?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

David Liu updated CXF-3398:
---------------------------

    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?


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

  was:
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?


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


> JMX Naming issue - cannot register the mutil endpoints with same service bean
> -----------------------------------------------------------------------------
>
>                 Key: CXF-3398
>                 URL: https://issues.apache.org/jira/browse/CXF-3398
>             Project: CXF
>          Issue Type: Bug
>          Components: Core, Management
>            Reporter: David Liu
>
> 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?
> {code} 
>     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);
>     }
> {code} 

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to