CXF InstrumentationManagerImpl bean,容器中有超过1个CXF应用程序

时间:2011-01-18 19:25:18

标签: java spring cxf jmx

尝试在同一容器中部署2个或更多CXF应用时遇到问题。问题在于org.apache.cxf.management.jmx.InstrumentationManagerImpl ...因为有多个部署产生;

Jan 18, 2011 2:05:10 PM ...InstrumentationManagerImpl init SEVERE: START_CONNECTOR_FAILURE_MSG

bean配置如下所示:

App One

<bean id="OneInstrumentationManager" class="org.apache.cxf.management.jmx.InstrumentationManagerImpl">
    <property name="bus" ref="cxf" />
    <property name="enabled" value="true" />
    <property name="usePlatformMBeanServer" value="true" />
    <property name="persistentBusId" value="One" />
</bean>

App Two

<bean id="TwoInstrumentationManager" class="org.apache.cxf.management.jmx.InstrumentationManagerImpl">
    <property name="bus" ref="cxf" />
    <property name="enabled" value="true" />
    <property name="usePlatformMBeanServer" value="true" />
    <property name="persistentBusId" value="Two" />
</bean>

2 个答案:

答案 0 :(得分:1)

以下是我在同一个容器中使用2 [实际3]的工作... 再也没有了;

<bean id="MyCxfExampleInstrumentationManager" class="org.apache.cxf.management.jmx.InstrumentationManagerImpl">
    <property name="bus" ref="cxf" />
    <property name="enabled" value="true" />
    <property name="usePlatformMBeanServer" value="true" />
    <property name="createMBServerConnectorFactory" value="false" />
</bean>

<bean id="MyCxfExampleCounterRepository" class="org.apache.cxf.management.counters.CounterRepository">
    <property name="bus" ref="cxf" />
</bean>

答案 1 :(得分:1)

我们遇到了与CXF和EhCache相同的JMX ObjectName冲突问题。

我们找到的解决方案是将Web应用程序的上下文路径附加到MBeanServer中注册的每个ObjectName。这直接受到大型集群化JavaEE服务器(Websphere等)的联合MBeanServers的启发。

由于这个原因,cxf总线ObjectName是:

"org.apache.cxf:type=Bus,host=localhost,path=/my-application,bus.id=my-application-cxf-bus"

我们将这个“servlet context aware mbean server”打包在一个带有spring命名空间的库中,以简化配置:

<beans 
   xmlns:management="http://www.xebia.fr/schema/xebia-management-extras"
   ... >

   <management:servlet-context-aware-mbean-server id="mbeanServer" />

   <bean id="cxf" class="org.apache.cxf.bus.CXFBusImpl">
      <property name="id" value="production-ready-application-cxf-bus" />
   </bean>
   <bean id="org.apache.cxf.management.InstrumentationManager" class="org.apache.cxf.management.jmx.InstrumentationManagerImpl">
      <property name="server" ref="mbeanServer" />
      <property name="enabled" value="true" />
      <property name="createMBServerConnectorFactory" value="false" />
   </bean>
   ...
<beans>

&lt; servlet-context-aware-mbean-server /&gt; 与许多其他JMX附加程序一起打包,以便于监视常见组件(dbcp,util.concurrent,cxf,jms等)并在http://code.google.com/p/xebia-france/wiki/XebiaManagementExtras的商业友好型Apache软件许可证下提出。

希望这有帮助,

Cyrille(Xebia)