我正在尝试使用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>
(从码头分发复制),我收到了这个错误:
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>
提前致谢 的Björn
答案 0 :(得分:0)
这似乎是一个非常简单的类路径问题。你在哪里有包含仪表连接器的罐子?
在发行版中,您需要将它放在服务器类路径中,在lib / ext下或在启动时作为声明的选项。在插件中,您需要将工件声明为插件本身的依赖项。