4

Tomcat サーバー内でCXFを使用して Web サービスを公開しています。ResponseTimeFeature で提案されているようなパフォーマンス情報を JMX で公開したいと考えています。

私の cxf-beans.xml ファイルは次のとおりです。

<cxf:bus bus="cxf" id="MyBus">
  <cxf:properties>
    <entry key="bus.jmx.enabled" value="true" />
  </cxf:properties>
</cxf:bus>

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

<jaxws:endpoint id="analyserEndpoint" implementor="#analyserImpl" address="/analyser">
  <jaxws:features>
    <bean class="org.apache.cxf.management.interceptor.ResponseTimeFeature" />
  </jaxws:features>
</jaxws:endpoint>

これは、 CXF JMX ページで説明されている内容と非常によく似ています。

問題は、[デフォルト アドレス (service:jmx:rmi:///jndi/rmi://localhost:9913/jmxrmi)] でjconsoleを使用して接続すると、パフォーマンス MBean が表示されないことです。MyBus の管理情報と内部のサービスがあります。ただし、ResponseTime については何もありません (サービスに対する SOAP-UI 負荷テストの後でも)。

Web アプリの起動時に次のエラーが記録されます。

2012-09-10 15:13:19,692 ERROR org.apache.cxf.management.jmx.InstrumentationManagerImpl - Could not start JMX connector server : java.io.IOException: Cannot bind to URL [rmi://localhost:9913/jmxrmi]: javax.naming.NameAlreadyBoundException: jmxrmi [Root exception is java.rmi.AlreadyBoundException: jmxrmi]

誰かがこの問題を解決する方法について何か考えがありますか?

前もって感謝します。

4

1 に答える 1

1

私は最終的に「解決策」を見つけました(実際、それは単なる回避策です)。

<cxf:bus bus="MyBus" id="MyBus" name="MyBus">
  <cxf:properties>
    <entry key="bus.jmx.enabled" value="true" />
    <entry key="bus.jmx.persistentBusId" value="MyBus" />
    <entry key="bus.jmx.usePlatformMBeanServer" value="true" />
    <entry key="bus.jmx.createMBServerConnectorFactory" value="false" />
  </cxf:properties>
</cxf:bus>

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

<jaxws:endpoint id="analyserEndpoint" implementor="#analyserImpl" address="/analyser">
  <jaxws:features>
    <bean class="org.apache.cxf.management.interceptor.ResponseTimeFeature" />
  </jaxws:features>
</jaxws:endpoint>

JMX コンソールの最後に、次の階層が表示されます。

org.apache.cxf
  Bus
    MyBus
      Operations
        shutdown
      Notifications
  Performance.Counter.Server
    cxf+random_number
      "WebServiceServiceNameAsAQName"
        "WebServicePortName"
          Attributes
            NumInvocations
            AvgResponseTime
            MaxResponseTime
            MinResponseTime
            NumCheckedApplicationFaults
            NumLogicalRuntimeFaults
            NumRuntimeFaults
            NumUnCheckedApplicationFaults
            TotalHandlingTime
          Operations
            reset
          "WebServiceMethodName"
            Attributes (same as above, per method)
            Operations
              reset

CXF WebServices MBeans で通常使用できる属性の一部 (状態など) を失い、カウンターのバス名が私が設定したものではないため、回避策と言います。

于 2012-09-11T09:26:36.437 に答える