3

Coda Hale の metrics-jetty プロジェクトを使用しようとしています: http://metrics.codahale.com/manual/jetty/

問題は、クラスを使用するように jetty を構成する方法が本当にわからないということです。

プロジェクトを pom.xml に追加しましたが、jetty.xml を使用する場合:

<Call name="addConnector">
  <Arg>
      <New class="com.yammer.metrics.jetty.InstrumentedSelectChannelConnector">
        <Set name="host"><Property name="jetty.host" /></Set>
        <Set name="port"><Property name="jetty.port" default="9090"/></Set>
        <Set name="maxIdleTime">300000</Set>
        <Set name="Acceptors">2</Set>
        <Set name="statsOn">false</Set>
        <Set name="confidentialPort">8443</Set>
    <Set name="lowResourcesConnections">20000</Set>
    <Set name="lowResourcesMaxIdleTime">5000</Set>
      </New>
  </Arg>
</Call>

(jetty-distribution からコピー)、次のエラーが発生しています:

Caused by: java.lang.ClassNotFoundException: com.yammer.metrics.jetty.InstrumentedSelectChannelConnector

編集

これを jetty-maven-plugin で直接行うと、同じ効果があります。

    <plugin>
            <groupId>org.mortbay.jetty</groupId>
            <artifactId>jetty-maven-plugin</artifactId>
            <version>${jetty.version}</version>
            <configuration>
                <scanIntervalSeconds>0</scanIntervalSeconds>
                <stopKey>foo</stopKey>
                <stopPort>9999</stopPort>
                <reload>manual</reload>
                <connectors>
                    <connector
                        implementation="org.eclipse.jetty.server.nio.SelectChannelConnector">
                        <port>8080</port>
                    </connector>
                    <connector
                        implementation="com.yammer.metrics.jetty.InstrumentedSelectChannelConnector">
                    </connector>
                </connectors>
                <webAppSourceDirectory>${basedir}/src/main/webapp</webAppSourceDirectory>
                <!-- <jettyXml>${project.basedir}/src/main/resources/jetty.xml</jettyXml> -->
            </configuration>
            <executions>
                <execution>
                    <id>start-jetty</id>
                    <phase>pre-integration-test</phase>
                    <goals>
                        <goal>run</goal>
                    </goals>
                    <configuration>
                        <scanIntervalSeconds>10</scanIntervalSeconds>
                        <daemon>true</daemon>
                    </configuration>
                </execution>
                <execution>
                    <id>stop-jetty</id>
                    <phase>post-integration-test</phase>
                    <goals>
                        <goal>stop</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>

よろしくお願いしますビョルン

4

1 に答える 1

0

これはかなり単純なクラスパスの問題のようです。インストルメント化されたコネクタを含む jar はどこにありますか?

ディストリビューションでは、lib/ext の下、または起動時に宣言されたオプションとして、サーバーのクラスパスに含める必要があります。プラグインでは、プラグイン自体の依存関係として宣言されたアーティファクトが必要です。

于 2012-11-26T22:06:42.230 に答える