Help us understand the problem. What is going on with this article?

JenkinsのJUnitでNoClassDefFoundError

More than 3 years have passed since last update.

JUnitの結果のXMLファイルがなぜかNoClassDefFoundErrorで読めなかったが、解決したのでメモ。

環境

  • Ubuntu 12.04
  • Jenkins 1.581
  • JUnit plugin 1.5

エラーと原因

エラーは以下の通り。

Process leaked file descriptors. See http://wiki.jenkins-ci.org/display/JENKINS/Spawning+processes+from+build for more information
Recording test results
ERROR: Publisher hudson.tasks.junit.JUnitResultArchiver aborted due to exception
java.lang.NoClassDefFoundError: hudson/tasks/junit/JUnitParser$ParseResultCallable
     at hudson.tasks.junit.JUnitParser.parseResult(JUnitParser.java:90)
     at hudson.tasks.junit.JUnitResultArchiver.parse(JUnitResultArchiver.java:120)
     at hudson.tasks.junit.JUnitResultArchiver.perform(JUnitResultArchiver.java:137)
     at hudson.tasks.BuildStepCompatibilityLayer.perform(BuildStepCompatibilityLayer.java:74)
     at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)
     at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:770)
     at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:734)
     at hudson.model.Build$BuildExecution.post2(Build.java:183)
     at hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:683)
     at hudson.model.Run.execute(Run.java:1770)
     at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
     at hudson.model.ResourceController.execute(ResourceController.java:89)
     at hudson.model.Executor.run(Executor.java:240)

調べた結果以下のページで解決した。 

[#JENKINS-26060] Using Jenkins 1.583. Today updated plugins, junit publisher now crashes. - Jenkins JIRA

The problem is that JUnit 1.3 is actually incompatible with Jenkins before 1.587 except 1.580.1 LTS. Unfortunately this cannot be expressed through dependencies, and to make it available to LTS users, it'll also be made available to users on weeklies >1.580.

どうもJenkinsのバージョンが1.587より古く、JUnitのプラグインのバージョンが1.3だと不具合が出てしまうらしい。 

私の環境ではJUnitのプラグインのバージョンは1.5だったが、同様の問題が発生したので、1.3以降なら起きるのかもしれない(未検証)。

解決方法

Workarounds:
・Downgrade JUnit to 1.2
・Downgrade/cross-grade Jenkins to 1.580.1 LTS
・Upgrade Jenkins to 1.587 or higher
As this only affects older weekly releases between 1.580 and 1.586, it's not worth the effort to fix. The general expectation is that users keep their instance fairly close to the current release when using the weeklies.
 

とのことなので、JUnitのバージョンを下げるか、Jenkinsのバージョンを1.580.1にするか1.587以上にすればいいとのことなので、Jenkinsのバージョンを最新版にして解決。

# 一応バックアップ
$sudo mv /usr/share/jenkins/jenkins.war /usr/share/jenkins/jenkins.war.1.581
# Jenkinsの設定画面からダウンロード
$sudo cp /home/hoge/Download/jenkins.war /usr/share/jenkins/
# 再起動
$sudo /etc/init.d/jenkins restart
Why do not you register as a user and use Qiita more conveniently?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away