Hi,
Yeah, it's same case when use multiple jaxrs:server which refer same
serviceBeans.
For an instance
<bean id="hello" class="com.example.service.RouterRestService"/>
<bean id="goodbye" class="com.example.service.RouterRestService"/>
<jaxrs:server id="helloServer" address="/hello">
<jaxrs:serviceBeans>
<ref component-id="hello" />
</jaxrs:serviceBeans>
</jaxrs:server>
<jaxrs:server id="goodbyeServer" address="/goodbye">
<jaxrs:serviceBeans>
<ref component-id="goodbye" />
</jaxrs:serviceBeans>
</jaxrs:server>
Then we can see exceptions like
javax.management.InstanceAlreadyExistsException:
org.apache.cxf:bus.id=ex-
cxf984165123,type=Bus.Service.Endpoint,service="{http://service.example.com/
}RouterRestService",port="RouterRestService"
at com.sun.jmx.mbeanserver.Repository.addMBean(Repository.java:453):
1.6.0_33
at
com
.sun
.jmx
.interceptor
.DefaultMBeanServerInterceptor
.internal_addObject(DefaultMBeanServerInterceptor.java:1484):1.6.0_33
at
com
.sun
.jmx
.interceptor
.DefaultMBeanServerInterceptor
.registerDynamicMBean(DefaultMBeanServerInterceptor.java:963):1.6.0_33
at
com
.sun
.jmx
.interceptor
.DefaultMBeanServerInterceptor
.registerObject(DefaultMBeanServerInterceptor.java:917):1.6.0_33
at
com
.sun
.jmx
.interceptor
.DefaultMBeanServerInterceptor
.registerMBean(DefaultMBeanServerInterceptor.java:312):1.6.0_33
at
com
.sun.jmx.mbeanserver.JmxMBeanServer.registerMBean(JmxMBeanServer.java:
482):1.6.0_33
at
Freeman
On 2012-6-29, at 下午7:53, Willem Jiang wrote:
Let's take the ManagedEndpoint as an example.
If the user create two jaxws endpoint with same SEI like this.
<jaxws:endpoint id="endpoint1"
serviceClass="com.example.SEI"
address="http://localhost:9000/service1" />
<jaxws:endpoint id="endpoint2"
serviceClass="com.example.SEI"
address="http://localhost:9000/service2" />
It ends up with javax.management.InstanceAlreadyExistsException.
As CXF build up the ObjectName for the ManagedEndpoint with the same
bus id, service name and endpoint name.
On Fri Jun 29 18:42:47 2012, Aki Yoshida wrote:
Hi Willem,
I am not sure exactly what you mean by this "instance.id".
Currently, if no id attribute is set, the bus.id is generated by the
bundle id plus cxf and a random number.
When the id attribute is set, it is used as the bus.id shown in JMX.
I am not sure how this "instance.id" is supposed to be used in your
use case.
Could you give some examples?
Thanks.
regards, aki
2012/6/29 Willem Jiang <[email protected]>:
Hi,
As you know CXF management provides a lots MBeans out of box. It
works
perfect if it run as stand alone.
If we deploy the CXF endpoints into container like Apache Karaf,
we may hit
the issue that Object is already registered. That is because we
don't build
up unique Object name for JMX to use. And there could be more than
one Bus
which id is CXF.
To resolve this issue I suggest we add the "instance.id" on the
ObjectName.
As JMX supports to look up the object with a query string, I don't
think
this change will effect much on the user CXF management codes.
Any thoughts?
--
Willem
----------------------------------
FuseSource
Web: http://www.fusesource.com
Blog: http://willemjiang.blogspot.com (English)
http://jnn.javaeye.com (Chinese)
Twitter: willemjiang
Weibo: willemjiang
--
Willem
----------------------------------
FuseSource
Web: http://www.fusesource.com
Blog: http://willemjiang.blogspot.com (English)
http://jnn.javaeye.com (Chinese)
Twitter: willemjiang
Weibo: willemjiang
---------------------------------------------
Freeman Fang
FuseSource
Email:[email protected]
Web: fusesource.com
Twitter: freemanfang
Blog: http://freemanfang.blogspot.com
http://blog.sina.com.cn/u/1473905042
weibo: http://weibo.com/u/1473905042