Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-65650

java.lang.NoClassDefFoundError: org/junit/rules/ExternalResource on builds after upgrade to 2.277.4

    XMLWordPrintable

Details

    • Bug
    • Status: Fixed but Unreleased (View Workflow)
    • Minor
    • Resolution: Fixed
    • gerrit-trigger-plugin
    • None
    • jenkins/jenkins:2.277.4-lts-slim docker image

    Description

       

      For every build since upgrading from 2.277.2 to 2.277.4 Jenkins appears to work fine, but throws frequently the following traceback in the logs:

       

      2021-05-16 22:00:00.601+0000 [id=109937]        WARNING        h.model.listeners.RunListener#report: RunListener failed
      java.lang.NoClassDefFoundError: org/junit/rules/ExternalResource
              at org.jvnet.hudson.test.BuildWatcher$Listener.onStarted(BuildWatcher.java:89)
              at hudson.model.listeners.RunListener.fireStarted(RunListener.java:238)
              at hudson.model.Run.execute(Run.java:1905)        
              at hudson.matrix.MatrixBuild.run(MatrixBuild.java:323)
              at hudson.model.ResourceController.execute(ResourceController.java:97)
              at hudson.model.Executor.run(Executor.java:429)   
      
      2021-05-16 22:00:07.018+0000 [id=109937]        WARNING        h.model.listeners.RunListener#report: RunListener failed
      java.lang.NoClassDefFoundError: org/junit/rules/ExternalResource
              at org.jvnet.hudson.test.BuildWatcher$Listener.onFinalized(BuildWatcher.java:100)
              at hudson.model.listeners.RunListener.fireFinalized(RunListener.java:255)
              at hudson.model.Run.onEndBuilding(Run.java:2069)  
              at hudson.model.Run.execute(Run.java:1976)        
              at hudson.matrix.MatrixRun.run(MatrixRun.java:153)
              at hudson.model.ResourceController.execute(Resource~   

       

       

      Attachments

        Issue Links

          Activity

            oleg_nenashev Oleg Nenashev added a comment -

            This is very strange. Looks like you have bith of Jenkins Test Harness unit testing framework in your environment. I would suspect a broken plugin which bundles https://github.com/jenkinsci/jenkins-test-harness directly

            oleg_nenashev Oleg Nenashev added a comment - This is very strange. Looks like you have bith of Jenkins Test Harness unit testing framework in your environment. I would suspect a broken plugin which bundles https://github.com/jenkinsci/jenkins-test-harness  directly
            ferro Ferruccio added a comment -

            Hi, I seem to see a similar problem, since upgrading from 2.277.2 to 2.277.4:

            java.lang.NoClassDefFoundError: org/junit/rules/ExternalResource
            	at org.jvnet.hudson.test.BuildWatcher$Listener.onFinalized(BuildWatcher.java:100)
            	at hudson.model.listeners.RunListener.fireFinalized(RunListener.java:255)
            	at hudson.model.Run.onEndBuilding(Run.java:2069)
            	at org.jenkinsci.plugins.workflow.job.WorkflowRun.finish(WorkflowRun.java:636)
            	at org.jenkinsci.plugins.workflow.job.WorkflowRun.access$800(WorkflowRun.java:137)
            	at org.jenkinsci.plugins.workflow.job.WorkflowRun$GraphL.onNewHead(WorkflowRun.java:1037)
            	at org.jenkinsci.plugins.workflow.cps.CpsFlowExecution.notifyListeners(CpsFlowExecution.java:1473)
            	at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$3.run(CpsThreadGroup.java:489)
            	at org.jenkinsci.plugins.workflow.cps.CpsVmExecutorService$1.run(CpsVmExecutorService.java:38)
            	at hudson.remoting.SingleLaneExecutorService$1.run(SingleLaneExecutorService.java:139)
            	at jenkins.util.ContextResettingExecutorService$1.run(ContextResettingExecutorService.java:28)
            	at jenkins.security.ImpersonatingExecutorService$1.run(ImpersonatingExecutorService.java:68)
            	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
            	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
            	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
            	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
            	at java.lang.Thread.run(Thread.java:748) 

             

            ferro Ferruccio added a comment - Hi, I seem to see a similar problem, since upgrading from 2.277.2 to 2.277.4: java.lang.NoClassDefFoundError: org/junit/rules/ExternalResource at org.jvnet.hudson.test.BuildWatcher$Listener.onFinalized(BuildWatcher.java:100) at hudson.model.listeners.RunListener.fireFinalized(RunListener.java:255) at hudson.model.Run.onEndBuilding(Run.java:2069) at org.jenkinsci.plugins.workflow.job.WorkflowRun.finish(WorkflowRun.java:636) at org.jenkinsci.plugins.workflow.job.WorkflowRun.access$800(WorkflowRun.java:137) at org.jenkinsci.plugins.workflow.job.WorkflowRun$GraphL.onNewHead(WorkflowRun.java:1037) at org.jenkinsci.plugins.workflow.cps.CpsFlowExecution.notifyListeners(CpsFlowExecution.java:1473) at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$3.run(CpsThreadGroup.java:489) at org.jenkinsci.plugins.workflow.cps.CpsVmExecutorService$1.run(CpsVmExecutorService.java:38) at hudson.remoting.SingleLaneExecutorService$1.run(SingleLaneExecutorService.java:139) at jenkins.util.ContextResettingExecutorService$1.run(ContextResettingExecutorService.java:28) at jenkins.security.ImpersonatingExecutorService$1.run(ImpersonatingExecutorService.java:68) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at java.lang. Thread .run( Thread .java:748)  
            rikuvoipio Riku added a comment - - edited

            Thank you oleg_nenashev

            I see the current (2.34.0) gerrit trigger plugin include the harness:

            unzip -l gerrit-trigger.jpi|grep harn
            9236782 2021-05-03 18:14 WEB-INF/lib/jenkins-test-harness-htmlunit-2.31-2.jar
            356560 2021-05-03 18:14 WEB-INF/lib/jenkins-test-harness-2.56.jar

            While the previous version of plugin (2.33.0) doesn't.

            So I think this bug needs to be reassigned to the gerrit-trigger plugin?

             Links to the plugins to verify:

             

            https://updates.jenkins.io/download/plugins/gerrit-trigger/2.34.0/gerrit-trigger.hpi

            https://updates.jenkins.io/download/plugins/gerrit-trigger/2.33.0/gerrit-trigger.hpi

            rikuvoipio Riku added a comment - - edited Thank you oleg_nenashev I see the current (2.34.0) gerrit trigger plugin include the harness: unzip -l gerrit-trigger.jpi|grep harn 9236782 2021-05-03 18:14 WEB-INF/lib/jenkins-test-harness-htmlunit-2.31-2.jar 356560 2021-05-03 18:14 WEB-INF/lib/jenkins-test-harness-2.56.jar While the previous version of plugin (2.33.0) doesn't. So I think this bug needs to be reassigned to the gerrit-trigger plugin?  Links to the plugins to verify:   https://updates.jenkins.io/download/plugins/gerrit-trigger/2.34.0/gerrit-trigger.hpi https://updates.jenkins.io/download/plugins/gerrit-trigger/2.33.0/gerrit-trigger.hpi
            ferro Ferruccio added a comment -

            Hi rikuvoipio, I came to a similar conclusion yesterday that the gerrit-trigger plugin (v 2.34.0) was the problem. Incidentally, with such version of the plugin I also see the following in Jenkins log:

            [2021-05-26 18:04:38] [WARNING] Failed to instantiate Key[type=org.jvnet.hudson.test.HudsonTestCase$TestBuildWrapper$TestBuildWrapperDescriptor, annotation=[none]]; skipping this component
            [2021-05-26 18:04:38] [WARNING] Failed to instantiate Key[type=org.jvnet.hudson.test.JenkinsRule$TestBuildWrapper$TestBuildWrapperDescriptor, annotation=[none]]; skipping this component  

            With gerrit-trigger plugin 2.34.0, we also see a failure related to the Job DSL plugin that raises an exception when encountering code such as:

            parameters {
             choice{
               name('MY_PARAM')
               description('a description')
               choices(['Option1',
                      'Option2',
               ])
              }
            }  

            the exception is something like:

            java.lang.ClassNotFoundException: junit.framework.TestCase
            	at jenkins.util.AntClassLoader.findClassInComponents(AntClassLoader.java:1387)
            	at jenkins.util.AntClassLoader.findClass(AntClassLoader.java:1342)
            	at jenkins.util.AntClassLoader.loadClass(AntClassLoader.java:1089)
            	at java.lang.ClassLoader.loadClass(ClassLoader.java:351)
            Caused: java.lang.NoClassDefFoundError: junit/framework/TestCase
            	at java.lang.ClassLoader.defineClass1(Native Method)
            	at java.lang.ClassLoader.defineClass(ClassLoader.java:756) 

            Which seems somehow related.

            ferro Ferruccio added a comment - Hi rikuvoipio , I came to a similar conclusion yesterday that the gerrit-trigger plugin (v 2.34.0) was the problem. Incidentally, with such version of the plugin I also see the following in Jenkins log: [2021-05-26 18:04:38] [WARNING] Failed to instantiate Key[type=org.jvnet.hudson.test.HudsonTestCase$TestBuildWrapper$TestBuildWrapperDescriptor, annotation=[none]]; skipping this component [2021-05-26 18:04:38] [WARNING] Failed to instantiate Key[type=org.jvnet.hudson.test.JenkinsRule$TestBuildWrapper$TestBuildWrapperDescriptor, annotation=[none]]; skipping this component With gerrit-trigger plugin 2.34.0, we also see a failure related to the Job DSL plugin that raises an exception when encountering code such as: parameters { choice{ name( 'MY_PARAM' ) description( 'a description' ) choices([ 'Option1' , 'Option2' , ]) } } the exception is something like: java.lang.ClassNotFoundException: junit.framework.TestCase at jenkins.util.AntClassLoader.findClassInComponents(AntClassLoader.java:1387) at jenkins.util.AntClassLoader.findClass(AntClassLoader.java:1342) at jenkins.util.AntClassLoader.loadClass(AntClassLoader.java:1089) at java.lang. ClassLoader .loadClass( ClassLoader .java:351) Caused: java.lang.NoClassDefFoundError: junit/framework/TestCase at java.lang. ClassLoader .defineClass1(Native Method) at java.lang. ClassLoader .defineClass( ClassLoader .java:756) Which seems somehow related.
            basil Basil Crow added a comment -

            Caused by the fix for JENKINS-53250, jenkinsci/gerrit-trigger-plugin#426 (released in 2.34.0), which added the jenkins-test-harness dependency outside of test scope:

            <dependency>
                <groupId>org.jenkins-ci.main</groupId>
                <artifactId>jenkins-test-harness</artifactId>
                <version>2.56</version>
            </dependency>
            

            FYI olivergondza

            basil Basil Crow added a comment - Caused by the fix for JENKINS-53250 , jenkinsci/gerrit-trigger-plugin#426 (released in 2.34.0), which added the jenkins-test-harness dependency outside of test scope: <dependency> <groupId> org.jenkins-ci.main </groupId> <artifactId> jenkins-test-harness </artifactId> <version> 2.56 </version> </dependency> FYI olivergondza
            fraz3alpha Andy Taylor added a comment -

            The presence of this test harness library causes a memory leak in Jenkins, whether or not the gerrit trigger plugin is used - I've raised that as https://issues.jenkins.io/browse/JENKINS-65771 (I only found this bug report afterwards).

            fraz3alpha Andy Taylor added a comment - The presence of this test harness library causes a memory leak in Jenkins, whether or not the gerrit trigger plugin is used - I've raised that as https://issues.jenkins.io/browse/JENKINS-65771  (I only found this bug report afterwards).
            basil Basil Crow added a comment -

            JENKINS-66060 is a similar bug that affects the Cavisson NS-ND Integration Performance Publisher plugin.

            basil Basil Crow added a comment - JENKINS-66060 is a similar bug that affects the Cavisson NS-ND Integration Performance Publisher plugin.
            olivergondza Oliver Gondža added a comment - The test harness was removed from hpi in https://github.com/jenkinsci/gerrit-trigger-plugin/commit/63407f4c4a314043b39b21c5cc340bb9a8200e7b . Resoled in alpha.

            People

              Unassigned Unassigned
              rikuvoipio Riku
              Votes:
              2 Vote for this issue
              Watchers:
              12 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: