Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
xml
xml
<bean id="org.apache.cxf.management.InstrumentationManager"
  class="org.apache.cxf.management.jmx.InstrumentationManagerImpl">
  <property name="bus" ref="cxf" />
  <property name="enabled" value="true" />
  <property name="JMXServiceURL " value="service:jmx:rmi:///jndi/rmi://localhost:9914/jmxrmi" />
</bean>

Starting from 2.5.2, an equivalent configuration of the above instrumentation manager can be directly made within the bus configuration using the corresponding property names having the "bus.jmx" prefix, as in

Code Block
xml
xml

<cxf:bus bus="cxf">
  <cxf:properties>
    <entry key="bus.jmx.enabled" value="true"/>
    <entry key="bus.jmx.JMXServiceURL" value="service:jmx:rmi:///jndi/rmi://localhost:9914/jmxrmi" />
  </cxf:properties>
</cxf:bus>

(warning)

Changes in CXF 2.5.x
Starting from 2.5.0, if a MBeanServer is available in the Spring context or as an OSGi server (when running in OSGi), the InstrumentationManger will be automatically enabled and will use that MBeanServer and the CXF MBeans will be registered. Therefore, the instrumentation manager configuration shown above is not needed in such cases.

To test the configuration start up your service and connect to it by using JConsole from the JDK.

 
Then you can browse to your endpoint:
 

 

...

Code Block
xml
xml
<!-- OSGi namespace and schemaLocation required -->
<beans ...
       xmlns:osgi="http://www.springframework.org/schema/osgi"
       ...      
       xsi:schemaLocation="...
       http://www.springframework.org/schema/osgi  http://www.springframework.org/schema/osgi/spring-osgi.xsd">

...

<!-- Grab a reference to the current MBeanServer -->
<osgi:reference id="mbeanServer" interface="javax.management.MBeanServer" cardinality="0..1"/>

<bean id="org.apache.cxf.management.InstrumentationManager"
  class="org.apache.cxf.management.jmx.InstrumentationManagerImpl">
  <property name="bus" ref="cxf" />
  <property name="enabled" value="true" />
  <!-- Unless you really want to open an additional connector, set this to false -->
  <property name="createMBServerConnectorFactory " value="false" />

  <!-- Inject the reference to the MBeanServer -->
  <property name="server" ref="mbeanServer" /> 
</bean>

Anchor
response_time
response_time

...

Code Block
xml
xml
    <!-- Wiring the counter repository --> 
    <bean id="CounterRepository" class="org.apache.cxf.management.counters.CounterRepository">
        <property name="bus" ref="cxf" />        
    </bean>

The CounterRepository collects the following metrics: invocations, checked application faults, unchecked application faults, runtime faults, logical runtime faults, total handling time, max handling time, and min handling time. Note a SOAP call will need to occur against the web service before you will see the MBean within your JMX monitoring software.