Play1.2.5 の auto-testについて

523 views
Skip to first unread message

山岸浩二

unread,
Nov 18, 2013, 2:42:48 AM11/18/13
to pla...@googlegroups.com
現在、Play framework 1.2.5 で Jenkinsを使用してプロジェクトを管理するにあたり、
auto-testでJunit、cobertura(カバレッジレポート)の自動実行を行いたいとかんがえているのですが、
auto-testをローカル環境のコマンドプロンプトで実行すると以下のエラーがでます。

--------------------------------------------------------------------------------------
C:\play-1.2.5\apps\Project_name>play auto-test
~        _            _
~  _ __ | | __ _ _  _| |
~ | '_ \| |/ _' | || |_|
~ |  __/|_|\____|\__ (_)
~ |_|            |__/
~
~ play! 1.2.5, http://www.playframework.org
~ framework ID is test
~
~ Running in test mode
~ Ctrl+C to stop
~
~ Deleting C:\play-1.2.5\apps\Argus\tmp
~
CompilerOracle: exclude jre
gex/Pretokenizer.next
Listening for transport dt_socket at address: 8000
16:21:09,515 INFO  ~ Starting C:\play-1.2.5\apps\Argus
16:21:09,531 WARN  ~ Declaring modules in application.conf is deprecated. Use dependencies.yml instead (module.cobertura)
16:21:09,531 INFO  ~ Module cobertura is available (C:\play-1.2.5\modules\cobertura-2.4)
16:21:09,531 INFO  ~ Module cobertura is available (C:\play-1.2.5\modules\cobertura-2.4)
16:21:14,156 WARN  ~ Actually play.tmp is set to null. Set it to play.tmp=none
16:21:14,250 WARN  ~ You're running Play! in DEV mode
~
~ Go to http://localhost:9000/@tests to run the tests
~
~ The application does not start. There are errors: java.io.IOException: Server returned HTTP response code: 500 for URL: http://l
ocalhost:9000/@tests.list
~
--------------------------------------------------------------------------------------

※ブラウザから手動実行の play testは問題なくできます。
※Jenkins側でもビルド手順にauto-testを設定しておりますが同様のエラーになります。

auto-testができないとJenkinsで管理ができないため、こちらおわかりの方がおりましたら、
ご教授いただけないでしょうか。
また、こちらの情報以外で必要な情報があればお伝えさせていただきます。

宜しくお願い致します。

yuichiro umezawa

unread,
Nov 18, 2013, 4:16:37 AM11/18/13
to pla...@googlegroups.com
梅澤 @garbagetown です。

play 1.2.5 と cobertura 2.4 で動作させたことがあります。スタックトレースをすべて
ご提示頂ければもう少しなにか分かるかもしれません。

ざっとググったら同じような話題が出てきたのですが、これは参考になりますか?

org.objectweb.asm.tree.analysis.AnalyzerException · Issue #13 · julienba/play-cobertura


それから、

16:21:09,531 WARN  ~ Declaring modules in application.conf is deprecated. Use dependencies.yml instead (module.cobertura)
16:21:09,531 INFO  ~ Module cobertura is available (C:\play-1.2.5\modules\cobertura-2.4)
16:21:09,531 INFO  ~ Module cobertura is available (C:\play-1.2.5\modules\cobertura-2.4)

この辺りから dependencies.yml ではなく application.conf でモジュールをロードされて
いること、なぜか coberuta モジュールが二回ロードされているっぽいことが気になりました。

application.conf と dependencies.yml を見直すと状況が変わるかもしれません。

憶測ばかりで申し訳ありません。



2013年11月18日 16:42 山岸浩二 <oc19...@gmail.com>:

--
このメールは Google グループのグループ「日本Playframeworkユーザー会」の登録者に送られています。
このグループから退会し、メールの受信を停止するには、play_ja+u...@googlegroups.com にメールを送信します。
このグループに投稿するには、pla...@googlegroups.com にメールを送信してください。
http://groups.google.com/group/play_ja からこのグループにアクセスしてください。
その他のオプションについては、https://groups.google.com/groups/opt_out にアクセスしてください。



--
yuichiro umezawa

山岸浩二

unread,
Nov 18, 2013, 5:50:48 AM11/18/13
to pla...@googlegroups.com
梅澤 @garbagetownさん
ご返事いただき有難うございました。

test-resultのapplication.logには以下が出力されております。
------------------------------------------------------------------------------------------------------------------------
18 11 2013 19:43:19,109 INFO  ~ Starting C:\play-1.2.5\apps\Project_name
18 11 2013 19:43:19,109 WARN  ~ Declaring modules in application.conf is deprecated. Use dependencies.yml instead (module.cobertura)
18 11 2013 19:43:19,109 INFO  ~ Module cobertura is available (C:\play-1.2.5\modules\cobertura-2.4)
18 11 2013 19:43:19,109 INFO  ~ Module cobertura is available (C:\play-1.2.5\modules\cobertura-2.4)
18 11 2013 19:43:26,265 WARN  ~ Actually play.tmp is set to null. Set it to play.tmp=none
18 11 2013 19:43:26,375 WARN  ~ You're running Play! in DEV mode
18 11 2013 19:43:28,859 INFO  ~ Listening for HTTP on port 9000 (Waiting a first request to start) ...
18 11 2013 19:44:06,359 ERROR ~

@6gahjdgg0
Internal Server Error (500) for request GET /@tests.list

Compilation error (In {module:cobertura-2.4}/app/controllers/Cobertura.java around line 9)
The file {module:cobertura-2.4}/app/controllers/Cobertura.java could not be compiled. Error raised is : The type Cobertura is already defined

play.exceptions.CompilationException: The type Cobertura is already defined
    at play.classloading.ApplicationCompiler$2.acceptResult(ApplicationCompiler.java:246)
    at org.eclipse.jdt.internal.compiler.Compiler.handleInternalException(Compiler.java:676)
    at org.eclipse.jdt.internal.compiler.Compiler.compile(Compiler.java:520)
    at play.classloading.ApplicationCompiler.compile(ApplicationCompiler.java:282)
    at play.classloading.ApplicationClassloader.getAllClasses(ApplicationClassloader.java:426)
    at play.Play.start(Play.java:516)
    at play.Play.detectChanges(Play.java:642)
    at play.Invoker$Invocation.init(Invoker.java:198)
    at Invocation.HTTP Request(Play!)
18 11 2013 19:44:06,359 ERROR ~

@6gahjdgg1
Error during the 500 response generation

Template execution error (In /app/views/errors/500.html around line 16)
Execution error occured in template /app/views/errors/500.html. Exception raised was NullPointerException : Cannot get property 'role' on null object.

play.exceptions.TemplateExecutionException: Cannot get property 'role' on null object
    at play.templates.BaseTemplate.throwException(BaseTemplate.java:86)
    at play.templates.GroovyTemplate.internalRender(GroovyTemplate.java:272)
    at play.templates.Template.render(Template.java:26)
    at play.templates.GroovyTemplate.render(GroovyTemplate.java:202)
    at play.server.PlayHandler.serve500(PlayHandler.java:774)
    at Invocation.HTTP Request(Play!)
Caused by: java.lang.NullPointerException: Cannot get property 'role' on null object
    at /app/views/errors/500.html.(line:16)
    at play.templates.GroovyTemplate.internalRender(GroovyTemplate.java:247)
    ... 4 more
18 11 2013 19:44:07,500 INFO  ~ Cobertura plugin: generating test coverage report
18 11 2013 19:44:09,562 INFO  ~ Test coverage report has been generated: file:/C:/play-1.2.5/apps/Project_name/test-result/code-coverage/index.html
------------------------------------------------------------------------------------------------------------------------

お分かりになりましたらご教授ください。
宜しくお願い致します。


2013年11月18日月曜日 18時16分37秒 UTC+9 garbagetown:
このグループから退会し、メールの受信を停止するには、play_ja+unsubscribe@googlegroups.com にメールを送信します。

このグループに投稿するには、pla...@googlegroups.com にメールを送信してください。
http://groups.google.com/group/play_ja からこのグループにアクセスしてください。
その他のオプションについては、https://groups.google.com/groups/opt_out にアクセスしてください。



--
yuichiro umezawa

山岸浩二

unread,
Nov 18, 2013, 11:55:51 PM11/18/13
to pla...@googlegroups.com
application.confの以下をコメントにしたところauto-testが実行できるようになりました。
#%test.module.cobertura=${play.path}/modules/cobertura-2.4

auto-testはクリアされたのですが、最後にレポートを生成するところでエラーになります。
-------------------------------------------------------------------------------------------
Each commands' results:
  clean: Done
  dependencies --sync: Done
  auto-test: Done
[Cobertura] Publishing Cobertura coverage report...
[Cobertura] No coverage results were found using the pattern 'test-result/code-coverage/coverage.xml' relative to '/var/lib/jenkins/jobs/Project_name/workspace'.  Did you enter a pattern relative to the correct directory?  Did you generate the XML report(s) for Cobertura?
Build step 'Cobertura カバレッジ・レポートの集計' changed build result to FAILURE
Finished: FAILURE
-------------------------------------------------------------------------------------------

半日ほど悩みましたが解決できませんでした。
お分かりの方がおりましたらご教授の程、宜しくお願い致します。


2013年11月18日月曜日 19時50分48秒 UTC+9 山岸浩二:

garbagetown

unread,
Nov 19, 2013, 12:56:59 AM11/19/13
to pla...@googlegroups.com
梅澤 @garbagetown です。

auto-testは実行できたとのことでよかったです。

レポート生成に関するエラーはJenkinsの設定に問題がありそうです。

/var/lib/jenkins/jobs/Project_name/workspaceから見た相対パスtest-result/code-coverage/coverage.xml が
見つからないというエラーに見えます。パーミッションの問題かもしれません。

Jenkinsの設定内容や上記パス周りの設定等を開示できる範囲でご提示頂けると
もう少しなにか分かるかもしれません。

もうご覧になったかもしれませんが、この辺りは参考になりませんか?

JenkinsでPlay Frameworkのプロジェクトを扱う - juzowの日記
http://d.hatena.ne.jp/juzow/20120521/1337604010


2013年11月19日火曜日 13時55分51秒 UTC+9 山岸浩二:

山岸浩二

unread,
Nov 19, 2013, 2:45:57 AM11/19/13
to pla...@googlegroups.com
>JenkinsでPlay Frameworkのプロジェクトを扱う - juzowの日記
http://d.hatena.ne.jp/juzow/20120521/1337604010

基本的には上記サイトを参考に設定しました。

パーミッションについては、
/var/lib/jenkins/jobs/Project_name/workspace             rwxr-xr-x (755) 
/var/lib/jenkins/jobs/Project_name/workspace/test-result rwxr-xr-x (755) 
Owner,Groupともにjenkinsです。

Jenkinsの設定ですが、
Jenkins > Jenkinsの管理 > システムの管理で、
・Play path : 「/var/lib/jenkins/play/play-1.2.5/play」 を設定

②Jenkins > プロジェクト > 設定で、
・ソースコード管理にSVNの設定
ビルド Play!「clean」「dependencies --sync」「auto-test」 を設定
ビルド後の処理 : Coberturaカバレッジ・レポートの集計に「test-result/code-coverage/coverage.xml」 を設定
高度な設定で、レポートがない場合、ビルド失敗にチェック、ソースエンコーディングに「UTF-8」 を設定
Play! auto-test reportsを選択

③あとはJenkins > 開発者でJenkinsを使用できるユーザー追加を行っております。
※匿名ユーザーは使用不可の設定

その他はデフォルト設定のままとなります。

ちなみにバージョンは、「1.540」です。
OSは、CentOS6.4です。

何卒、宜しくお願いします。


2013年11月19日火曜日 14時56分59秒 UTC+9 garbagetown:

山岸浩二

unread,
Nov 20, 2013, 11:54:50 PM11/20/13
to pla...@googlegroups.com
auto-test完了に以下のえらーが発生しておりました。

--------------------------------------------------------------------------------

--- 省略 ---

~ util/***Test...                PASSED     0s
~ util/***Test...                PASSED     0s
---------------------------------------
java.lang.reflect.InvocationTargetException
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:601)
	at net.sourceforge.cobertura.util.FileLocker.lock(FileLocker.java:124)
	at play.modules.cobertura.CoberturaPlugin$CoberturaPluginShutdownThread.run(Unknown Source)
Caused by: java.nio.channels.OverlappingFileLockException
	at sun.nio.ch.SharedFileLockTable.checkList(FileLockTable.java:255)
	at sun.nio.ch.SharedFileLockTable.add(FileLockTable.java:152)
	at sun.nio.ch.FileChannelImpl.lock(FileChannelImpl.java:972)
	at java.nio.channels.FileChannel.lock(FileChannel.java:1052)
	... 6 more
---------------------------------------
Unable to get lock on /var/lib/jenkins/jobs/Project_name/workspace/cobertura.ser.lock: null
This is known to happen on Linux kernel 2.6.20.
Make sure cobertura.jar is in the root classpath of the jvm 
process running the instrumented code.  If the instrumented code 
is running in a web server, this means cobertura.jar should be in 
the web server's lib directory.
Don't put multiple copies of cobertura.jar in different WEB-INF/lib directories.
Only one classloader should load cobertura.  It should be the root classloader.
---------------------------------------
lock file could not be deleted
~        _            _ 
~  _ __ | | __ _ _  _| |
~ | '_ \| |/ _' | || |_|
~ |  __/|_|\____|\__ (_)
~ |_|            |__/   
~
~ play! 1.2.5, http://www.playframework.org
~ framework ID is test
~
~ Running in test mode
~ Ctrl+C to stop
~ 
~ Deleting /var/lib/jenkins/jobs/Project_name/workspace/tmp
~
CompilerOracle: exclude jregex/Pretokenizer.next
Listening for transport dt_socket at address: 8000
14:58:44,806 INFO  ~ Starting /var/lib/jenkins/jobs/Project_name/workspace
14:58:44,814 INFO  ~ Module cobertura is available (/var/lib/jenkins/play/play-1.2.5/modules/cobertura-2.4)
14:58:46,735 WARN  ~ You're running Play! in DEV mode
~
~ Go to http://localhost:9000/@tests to run the tests
~
~
~ All tests passed
~
Each commands' results:
  clean: Done
  dependencies --sync: Done
  auto-test: Done
[Cobertura] Publishing Cobertura coverage report...
[Cobertura] No coverage results were found using the pattern 'test-result/code-coverage/coverage.xml' relative to '/var/lib/jenkins/jobs/Project_name/workspace'.  Did you enter a pattern relative to the correct directory?  Did you generate the XML report(s) for Cobertura?
Build step 'Cobertura カバレッジ・レポートの集計' changed build result to FAILURE
Finished: FAILURE
-------------------------------------------------------------

workspaceには、test-result以下にcode-coverage/coverage.xmlは作成されておりません。
coberturaプラグインのバーションの問題なのでしょうか。
※ちなみにプラグインのバージョンは1.9.3です。

こちらログから原因がお分かりになる方がおりましたらアドバイスをお願いします。
宜しくお願い致します。


2013年11月19日火曜日 16時45分57秒 UTC+9 山岸浩二:

山岸浩二

unread,
Nov 21, 2013, 3:05:30 AM11/21/13
to pla...@googlegroups.com
ビルド play! の「auto-test」 を 「auto-test -Dcobertura.use.java.nio=false」に変更したところ、
正常に終了することができました。
(やっと青になりました。長かった。)

梅澤 @garbagetownさん、ご協力いただき有難うございました。

2013年11月21日木曜日 13時54分50秒 UTC+9 山岸浩二:

yuichiro umezawa

unread,
Nov 22, 2013, 8:23:00 AM11/22/13
to pla...@googlegroups.com
山岸さん

問題が解決したようでよかったです。あまり役に立てず申し訳ありません。。。

play1.x ならお手伝いできることがあるかもしれませんので、また何かあれば
是非お気軽にお問い合わせください。




2013年11月21日 17:05 山岸浩二 <oc19...@gmail.com>:
このグループから退会し、メールの受信を停止するには、play_ja+u...@googlegroups.com にメールを送信します。

このグループに投稿するには、pla...@googlegroups.com にメールを送信してください。
http://groups.google.com/group/play_ja からこのグループにアクセスしてください。
その他のオプションについては、https://groups.google.com/groups/opt_out にアクセスしてください。



--
yuichiro umezawa

山岸浩二

unread,
Nov 26, 2013, 6:36:24 AM11/26/13
to pla...@googlegroups.com
梅澤さん

この度は有難うございました。
また行き詰った時はご連絡させていただきます。

今後とも宜しくお願い致します。

2013年11月22日金曜日 22時23分00秒 UTC+9 garbagetown:
Reply all
Reply to author
Forward
0 new messages