Jenkins failed to trigger a build on pull request

Hello,
I am using Jenkins controller container 2.462.1 with two node agents,
lately Jankins is failing on triggering builds when a pull request, jenkins logs is as follow:

Sep 03, 2024 2:32:29 PM INFO org.jenkinsci.plugins.github.webhook.subscriber.DefaultPushGHEventSubscriber onEvent
Received PushEvent for https://github.com/XXXXX from 172.22.0.1 ⇒ https://XXXX/jenkins/github-webhook/
Sep 03, 2024 2:32:42 PM WARNING jenkins.scm.api.SCMHeadEvent$DispatcherImpl log
SCMEventListener.onSCMHeadEvent(SCMHeadEvent) jenkins.branch.MultiBranchProject$SCMEventListenerImpl@6404b594 propagated an exception
java.lang.ClassNotFoundException: org.objectweb.asm.ClassWriter
Caused: java.lang.NoClassDefFoundError: org/objectweb/asm/ClassWriter
	at PluginClassLoader for scm-api//jenkins.scm.api.SCMHeadMixinEqualityGenerator.create(SCMHeadMixinEqualityGenerator.java:234)
	at PluginClassLoader for scm-api//jenkins.scm.api.SCMHeadMixinEqualityGenerator.getOrCreate(SCMHeadMixinEqualityGenerator.java:152)
	at PluginClassLoader for scm-api//jenkins.scm.api.SCMHead.equals(SCMHead.java:191)
	at java.base/java.util.HashMap.getNode(Unknown Source)
	at java.base/java.util.HashMap.containsKey(Unknown Source)
	at java.base/java.util.HashSet.contains(Unknown Source)
	at PluginClassLoader for scm-api//jenkins.scm.api.trait.SCMSourceRequest.isExcluded(SCMSourceRequest.java:182)
	at PluginClassLoader for scm-api//jenkins.scm.api.trait.SCMSourceRequest.process(SCMSourceRequest.java:333)
	at PluginClassLoader for github-branch-source//org.jenkinsci.plugins.github_branch_source.GitHubSCMSource.retrievePullRequest(GitHubSCMSource.java:1245)
	at PluginClassLoader for github-branch-source//org.jenkinsci.plugins.github_branch_source.GitHubSCMSource.retrieve(GitHubSCMSource.java:1085)
	at PluginClassLoader for scm-api//jenkins.scm.api.SCMSource._retrieve(SCMSource.java:372)
	at PluginClassLoader for scm-api//jenkins.scm.api.SCMSource.fetch(SCMSource.java:326)
	at PluginClassLoader for branch-api//jenkins.branch.MultiBranchProject$SCMEventListenerImpl.processHeadCreate(MultiBranchProject.java:1375)
	at PluginClassLoader for branch-api//jenkins.branch.MultiBranchProject$SCMEventListenerImpl.onSCMHeadEvent(MultiBranchProject.java:1208)
	at PluginClassLoader for scm-api//jenkins.scm.api.SCMHeadEvent$DispatcherImpl.fire(SCMHeadEvent.java:246)
	at PluginClassLoader for scm-api//jenkins.scm.api.SCMHeadEvent$DispatcherImpl.fire(SCMHeadEvent.java:229)
	at PluginClassLoader for scm-api//jenkins.scm.api.SCMEvent$Dispatcher.run(SCMEvent.java:545)
	at jenkins.security.ImpersonatingScheduledExecutorService$1.run(ImpersonatingScheduledExecutorService.java:67)
	at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
	at java.base/java.util.concurrent.FutureTask.run(Unknown Source)
	at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(Unknown Source)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
	at java.base/java.lang.Thread.run(Unknown Source)

when choosing to scan the repository now button, it will detect and build the new pull request.
any suggestion is appreciated.

do you think the issue is between jenkins controller and GitHub or between Jenkins controller and Jenkins agent?
I know that my jenkins controller is using newer java (17.0.12) while the salves are on openjdk 16.0.1 2021-04-20

team… any thoughts here, still not able to fix this?

Welcome back, @zohair. :wave:

The error message indicates that Jenkins is unable to find the org.objectweb.asm.ClassWriter class, which is causing a NoClassDefFoundError. This issue is likely due to a missing or incompatible plugin dependency.
I can find quite a few references to this class in some plugins, particularly in the scm plugin that appears in your stack trace.

Here are some steps that may help to resolve this issue:

  1. Ensure all your Jenkins plugins are up to date. Sometimes, plugin updates include necessary dependencies or fixes for such issues.
  2. Verify that the required dependencies for the scm-api and github-branch-source plugins are installed. You can do this by checking the plugin documentation or the Jenkins update center.
  3. If updating doesn’t work, try reinstalling the affected plugins (scm-api, github-branch-source, etc.). Sometimes, plugin files can get corrupted. :person_shrugging:
  4. Ensure that the versions of the plugins you are using are compatible with your Jenkins version (2.462.1). Incompatible versions can cause such issues.
1 Like

Hello Everyone,

We are also facing the issue for past few days where Jenkins was not able to trigger the build on pull request.
Its a production environment we cannot update the Jenkins with latest version.
Also plugins are giving the warning that if we upgrade to latest then it might be possible latest version is not compatible with old Jenkins Version.

Executor threw an exception
java.lang.NoClassDefFoundError: org/objectweb/asm/ClassWriter
	at PluginClassLoader for scm-api//jenkins.scm.api.SCMHeadMixinEqualityGenerator.create(SCMHeadMixinEqualityGenerator.java:234)
	at PluginClassLoader for scm-api//jenkins.scm.api.SCMHeadMixinEqualityGenerator.getOrCreate(SCMHeadMixinEqualityGenerator.java:152)
	at PluginClassLoader for scm-api//jenkins.scm.api.SCMHead.equals(SCMHead.java:191)
	at PluginClassLoader for branch-api//jenkins.branch.Branch.equals(Branch.java:279)
	at PluginClassLoader for branch-api//jenkins.branch.MultiBranchProject$SCMHeadObserverImpl.observeExisting(MultiBranchProject.java:2033)
	at PluginClassLoader for branch-api//jenkins.branch.MultiBranchProject$SCMHeadObserverImpl.observe(MultiBranchProject.java:2021)
	at PluginClassLoader for scm-api//jenkins.scm.api.trait.SCMSourceRequest.process(SCMSourceRequest.java:357)
	at PluginClassLoader for github-branch-source//org.jenkinsci.plugins.github_branch_source.GitHubSCMSource.retrievePullRequest(GitHubSCMSource.java:1245)
	at PluginClassLoader for github-branch-source//org.jenkinsci.plugins.github_branch_source.GitHubSCMSource.retrieve(GitHubSCMSource.java:1085)
	at PluginClassLoader for scm-api//jenkins.scm.api.SCMSource._retrieve(SCMSource.java:372)
	at PluginClassLoader for scm-api//jenkins.scm.api.SCMSource.fetch(SCMSource.java:282)
	at PluginClassLoader for branch-api//jenkins.branch.MultiBranchProject.computeChildren(MultiBranchProject.java:654)
	at PluginClassLoader for cloudbees-folder//com.cloudbees.hudson.plugins.folder.computed.ComputedFolder.updateChildren(ComputedFolder.java:269)
	at PluginClassLoader for cloudbees-folder//com.cloudbees.hudson.plugins.folder.computed.FolderComputation.run(FolderComputation.java:167)
	at PluginClassLoader for branch-api//jenkins.branch.MultiBranchProject$BranchIndexing.run(MultiBranchProject.java:1057)
	at hudson.model.ResourceController.execute(ResourceController.java:101)
	at hudson.model.Executor.run(Executor.java:446)

The agents need to use the same java major version as the controller (for builds you can still have separate java installations), mixing java176 and java16 is a recipe for trouble.

I insured all dependancies for both plugins scm-api and github-branch-source are up to date as well as the two plugins, that did not help me so far

I use a containerized aganets and was little afraid to play with it, I will try to update one of these agents and see how it

seems like mismatch java between controller and agent was not a problem, even it is not nice and I should do something about it, thanks to @poddingue and after a bunch of plugin updates the pipeline for PRs works just fine

thank you @poddingue updating plugins (+15) fixed my issue and pipeline is working now