OAuthのJavaサンプルアプリケーションを動かそうとしてハマる

OAuthのJavaライブラリを試してみようと思いました。 

以下のページにsvnリポジトリのリンクがあるので、そこからチェックアウトします。

oauth - Project Hosting on Google Code

svn co http://oauth.googlecode.com/svn/code/java/ oauth-java

 

exampleフォルダの中にwebappというフォルダを見つけたので早速実行してみたのですが...

cd oauth-java
cd example/webapp
mvn jetty:run

エラーが出て実行できませんでした。

[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Building OAuth::Examples::Consumer webapp
[INFO]    task-segment: [jetty:run]
[INFO] ------------------------------------------------------------------------
[INFO] Preparing jetty:run
[INFO] [resources:resources {execution: default-resources}]
[WARNING] Using platform encoding (SJIS actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 1 resource
[INFO] [compiler:compile {execution: default-compile}]
[INFO] Nothing to compile - all classes are up to date
[INFO] [resources:testResources {execution: default-testResources}]
[WARNING] Using platform encoding (SJIS actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory /Users/makoto/work/sources/oauth-java/example/webapp/src/test/resources
[INFO] [compiler:testCompile {execution: default-testCompile}]
[INFO] No sources to compile
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Error configuring: org.mortbay.jetty:jetty-maven-plugin. Reason: ERROR: Cannot override read-only parameter: contextPath in goal: jetty:run
[INFO] ------------------------------------------------------------------------
[INFO] For more information, run Maven with the -e switch
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3 seconds
[INFO] Finished at: Mon Jan 11 19:41:13 JST 2010
[INFO] Final Memory: 20M/79M
[INFO] ------------------------------------------------------------------------

 

Cannot override read-only parameter: contextPath in goal: jetty:run

 

pom.xmlの中にあるjettyの設定でcontextPathパラメータを書き換えているのがよくないみたいです。

該当部分を修正します。

 

  <build>
    <plugins>
      <plugin>
        <groupId>org.mortbay.jetty</groupId>
        <artifactId>jetty-maven-plugin</artifactId>
        <configuration>
          <scanIntervalSeconds>10</scanIntervalSeconds>
          <webAppSourceDirectory>${basedir}/src/main/webapp/</webAppSourceDirectory>
          <webXmlFile>${basedir}/src/main/webapp/WEB-INF/web.xml</webXmlFile>
<!--           <contextPath>/CookieJar</contextPath> -->           <connectors> 
            <connector implementation="org.mortbay.jetty.nio.SelectChannelConnector">
              <port>9091</port>
              <maxIdleTime>60000</maxIdleTime>
            </connector>
          </connectors>
          <systemProperties>
            <systemProperty>
              <name>org.apache.commons.logging.Log</name>
              <value>org.apache.commons.logging.impl.SimpleLog</value>
            </systemProperty>
          </systemProperties>
        </configuration>
      </plugin>
    </plugins>
    ...
  </build>

 

もう一度トライしてみるとまたエラー

 

Class name which was explicitly given in configuration using 'implementation' attribute: 'org.mortbay.jetty.nio.SelectChannelConnector' cannot be loaded

 

connectorの実装がロードできないとかなんとか。よくわからないので検索してみると、connector実装のクラス名が変わったみたいなことが書いてありました。

[#JETTY-1071] org.mortbay.jetty.nio.SelectChannelConnector cannot be loaded in 7.0.0.1beta3 - jira.codehaus.org

 

試しにpom.xmlを修正したら無事に起動できました。

<connector implementation="org.eclipse.jetty.server.nio.SelectChannelConnector">

 

jettyってEclipseのプロジェクトになってたんですね。知らなかったー。

オープンソースのJavaアプリケーションサーバー「Jetty」がEclipseプロジェクトに - SourceForge.JP Magazine
 

Trackback URL for this post:

http://blog.smartnetwork.co.jp/staff/trackback/47

バイアグラ 販売

、胸の痛み、あらゆる種類のがある場合は投稿者が、あなたの医者を、できるだけ早期に検出されない心の問題にする可能性が参照してください。バイアグラはあなたの血、血圧と性欲と作品がなぜ血圧を増加させた。バイアグラを使用した後は、バイアグラ 販売を、あなたは、あなたの勃起の最後の3つまたは4つの時間を期待したり、性的なコンテンツまで。あなたが性的には、通常どおり、直接勃起を満たされている場合。