Skip to content

Bugfix NPE where payload classloader did not include CLI types - #742

Merged
oleg-nenashev merged 1 commit into
jenkinsci:mainfrom
samrocketman:bugfix-npe
Jul 11, 2026
Merged

Bugfix NPE where payload classloader did not include CLI types#742
oleg-nenashev merged 1 commit into
jenkinsci:mainfrom
samrocketman:bugfix-npe

Conversation

@samrocketman

@samrocketman samrocketman commented Jun 30, 2026

Copy link
Copy Markdown
Member

I am trying to utilize jenkinsfile-runner. So far no luck due to complexity in my setup. However, without this patch I wasn't able to get jenkinsfile-runner to launch.

I encountered the bug packaged from main branch (commit before my HEAD).

How I launched it

CASC_JENKINS_CONFIG=jenkins.yaml jenkinsfile-runner run -w ../jenkins-ng/jenkins-war/ -p ../jenkins-ng/plugins/ -f .ci/Jenkinsfile

And got exception

Stack trace encountered

java.lang.RuntimeException: Unhandled exception
	at io.jenkins.jenkinsfile.runner.bootstrap.commands.JenkinsLauncherCommand.call(JenkinsLauncherCommand.java:69)
	at io.jenkins.jenkinsfile.runner.bootstrap.commands.JenkinsLauncherCommand.call(JenkinsLauncherCommand.java:37)
	at picocli.CommandLine.executeUserObject(CommandLine.java:2041)
	at picocli.CommandLine.access$1500(CommandLine.java:148)
	at picocli.CommandLine$RunLast.executeUserObjectOfLastSubcommandWithSameParent(CommandLine.java:2461)
	at picocli.CommandLine$RunLast.handle(CommandLine.java:2453)
	at picocli.CommandLine$RunLast.handle(CommandLine.java:2415)
	at picocli.CommandLine$AbstractParseResultHandler.execute(CommandLine.java:2273)
	at picocli.CommandLine$RunLast.execute(CommandLine.java:2417)
	at picocli.CommandLine.execute(CommandLine.java:2170)
	at io.jenkins.jenkinsfile.runner.bootstrap.Bootstrap.main(Bootstrap.java:46)
Caused by: java.lang.NoClassDefFoundError: io/jenkins/jenkinsfile/runner/bootstrap/commands/PipelineRunOptions
	at java.base/java.lang.Class.getDeclaredMethods0(Native Method)
	at java.base/java.lang.Class.privateGetDeclaredMethods(Class.java:3578)
	at java.base/java.lang.Class.getMethodsRecursive(Class.java:3719)
	at java.base/java.lang.Class.getMethod0(Class.java:3705)
	at java.base/java.lang.Class.getMethod(Class.java:2393)
	at io.jenkins.jenkinsfile.runner.JenkinsfileRunnerLauncher.doLaunch(JenkinsfileRunnerLauncher.java:34)
	at io.jenkins.jenkinsfile.runner.JenkinsLauncher.launch(JenkinsLauncher.java:144)
	at io.jenkins.jenkinsfile.runner.App.run(App.java:32)
	at io.jenkins.jenkinsfile.runner.bootstrap.commands.JenkinsLauncherCommand.runJenkinsfileRunnerApp(JenkinsLauncherCommand.java:226)
	at io.jenkins.jenkinsfile.runner.bootstrap.commands.JenkinsLauncherCommand.call(JenkinsLauncherCommand.java:67)
	... 10 more
Caused by: java.lang.ClassNotFoundException: io.jenkins.jenkinsfile.runner.bootstrap.commands.PipelineRunOptions
	at java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:445)
	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:593)
	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:526)
	... 20 more

Testing done

Submitter checklist

  • Make sure you are opening from a topic/feature/bugfix branch (right side) and not your main branch!
  • Ensure that the pull request title represents the desired changelog entry
  • Please describe what you did
  • Link to relevant issues in GitHub or Jira
  • Link to relevant pull requests, esp. upstream and downstream changes
  • Ensure you have provided tests that demonstrate the feature works or the issue is fixed

I am trying to utilize jenkinsfile-runner.  So far no luck due to complexity in my setup.  However, without this patch I wasn't able to get jenkinsfile-runner to launch.

How I launched it
=================

```
CASC_JENKINS_CONFIG=jenkins.yaml jenkinsfile-runner run -w ../jenkins-ng/jenkins-war/ -p ../jenkins-ng/plugins/ -f .ci/Jenkinsfile
```

And got exception

Stack trace encountered
=======================

```
java.lang.RuntimeException: Unhandled exception
	at io.jenkins.jenkinsfile.runner.bootstrap.commands.JenkinsLauncherCommand.call(JenkinsLauncherCommand.java:69)
	at io.jenkins.jenkinsfile.runner.bootstrap.commands.JenkinsLauncherCommand.call(JenkinsLauncherCommand.java:37)
	at picocli.CommandLine.executeUserObject(CommandLine.java:2041)
	at picocli.CommandLine.access$1500(CommandLine.java:148)
	at picocli.CommandLine$RunLast.executeUserObjectOfLastSubcommandWithSameParent(CommandLine.java:2461)
	at picocli.CommandLine$RunLast.handle(CommandLine.java:2453)
	at picocli.CommandLine$RunLast.handle(CommandLine.java:2415)
	at picocli.CommandLine$AbstractParseResultHandler.execute(CommandLine.java:2273)
	at picocli.CommandLine$RunLast.execute(CommandLine.java:2417)
	at picocli.CommandLine.execute(CommandLine.java:2170)
	at io.jenkins.jenkinsfile.runner.bootstrap.Bootstrap.main(Bootstrap.java:46)
Caused by: java.lang.NoClassDefFoundError: io/jenkins/jenkinsfile/runner/bootstrap/commands/PipelineRunOptions
	at java.base/java.lang.Class.getDeclaredMethods0(Native Method)
	at java.base/java.lang.Class.privateGetDeclaredMethods(Class.java:3578)
	at java.base/java.lang.Class.getMethodsRecursive(Class.java:3719)
	at java.base/java.lang.Class.getMethod0(Class.java:3705)
	at java.base/java.lang.Class.getMethod(Class.java:2393)
	at io.jenkins.jenkinsfile.runner.JenkinsfileRunnerLauncher.doLaunch(JenkinsfileRunnerLauncher.java:34)
	at io.jenkins.jenkinsfile.runner.JenkinsLauncher.launch(JenkinsLauncher.java:144)
	at io.jenkins.jenkinsfile.runner.App.run(App.java:32)
	at io.jenkins.jenkinsfile.runner.bootstrap.commands.JenkinsLauncherCommand.runJenkinsfileRunnerApp(JenkinsLauncherCommand.java:226)
	at io.jenkins.jenkinsfile.runner.bootstrap.commands.JenkinsLauncherCommand.call(JenkinsLauncherCommand.java:67)
	... 10 more
Caused by: java.lang.ClassNotFoundException: io.jenkins.jenkinsfile.runner.bootstrap.commands.PipelineRunOptions
	at java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:445)
	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:593)
	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:526)
	... 20 more
```

Co-authored-by: sgleske@integralads.com
@samrocketman
samrocketman requested a review from a team as a code owner June 30, 2026 22:48
@romanisb

romanisb commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

Not 100% sure but it seems that the bug was already present but invisible before updating to Jenkins 2.555.3 (with #739 ). The bootstrap.jar appears to have been accidentally reachable through the classloader chain in older versions. With 2.555.3 that implicit reachability seems to be gone, so PipelineRunOptions can no longer be resolved from the classloader built in getClassFromJar(), causing the ClassNotFoundException.

The fix looks correct. SideClassLoader makes bootstrap types explicitly visible across the classloader boundary, which is the same pattern already used in createJenkinsWarClassLoader() and createSetupClassLoader().

@oleg-nenashev

@samrocketman

Copy link
Copy Markdown
Member Author

I report being able to successfully run a fully mocked pipeline.

Is there any interest in colorized output as a separate feature once this gets merged? I wrote a colorizer in python but would also consider porting it to jenkinsfile-runner.

@romanisb

romanisb commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

I report being able to successfully run a fully mocked pipeline.

I can also confirm that pipelines are running correctly with this fix.

Is there any interest in colorized output as a separate feature once this gets merged? I wrote a colorizer in python but would also consider porting it to jenkinsfile-runner.

Would be a nice to have, but should be done optional configuration.

@oleg-nenashev

Copy link
Copy Markdown
Member

Is there any interest in colorized output as a separate feature once this gets merged? I wrote a colorizer in python but would also consider porting it to jenkinsfile-runner.

Sure!

@oleg-nenashev oleg-nenashev added the bug Something isn't working label Jul 11, 2026
@oleg-nenashev
oleg-nenashev merged commit b9b366d into jenkinsci:main Jul 11, 2026
10 checks passed
@samrocketman
samrocketman deleted the bugfix-npe branch July 11, 2026 22:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants