2012-11-25 36 views
3

我试图从科达硬朗使用指标,码头工程:http://metrics.codahale.com/manual/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 

编辑

直接在码头 - Maven的插件这样做有同样的效果:

<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> 

在此先感谢 比约恩

回答

0

这似乎是一个非常简单的类路径问题。你在哪里有装有仪器连接器的罐子?

在发行版中,您需要将它放在服务器类路径中,在lib/ext下或在启动时作为声明的选项。在插件中,您需要将该工件声明为插件本身的依赖项。

+0

正如通过IRC讨论的那样,问题在于,我直接将依赖项添加到pom.xml中。解决方法是将它们作为依赖项放入jetty-maven插件中。 – bjoernhaeuser