2012-11-25 37 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