jenkinsci/jenkinsfile-runner

Jenkinsfile runner thows NoClassDefFoundError: com/cloudbees/plugins/credentials/CredentialsUnavailableException

HellaSolutions opened this issue · 7 comments

Version report

Jenkins and plugins versions report:

Jenkins 2.321 (WAR)

  • What Operating System are you using (both controller, and any agents involved in the problem)?

Windows 10 Enterprise

Reproduction steps

  • Download the current jenkinsfile-runner-1.0-beta-30 distribution
  • Download the Jenkins 2.321 (WAR)
  • execute ./bin/jenkinsfile-runner.bat -w jenkins.war -f Jenkinsfile
  • Jenkinsfile
pipeline {
    agent any
    stages {
        stage('Print hello') {
            steps {
                echo 'Hello world!'
            }
        }
    }
}

Results

Expected result:

pipeline run

Actual result:

Exploding E:\external-repos\jenkinsfile-runner-1.0-beta-30\jenkins.war, this might take some time.
java.lang.RuntimeException: Unhandled exception
at io.jenkins.jenkinsfile.runner.bootstrap.commands.JenkinsLauncherCommand.call(JenkinsLauncherCommand.java:69)
at io.jenkins.jenkinsfile.runner.bootstrap.Bootstrap.call(Bootstrap.java:71)
at io.jenkins.jenkinsfile.runner.bootstrap.Bootstrap.call(Bootstrap.java:21)
at picocli.CommandLine.executeUserObject(CommandLine.java:1953)
at picocli.CommandLine.access$1300(CommandLine.java:145)
at picocli.CommandLine$RunLast.executeUserObjectOfLastSubcommandWithSameParent(CommandLine.java:2352)
at picocli.CommandLine$RunLast.handle(CommandLine.java:2346)
at picocli.CommandLine$RunLast.handle(CommandLine.java:2311)
at picocli.CommandLine$AbstractParseResultHandler.execute(CommandLine.java:2179)
at picocli.CommandLine.execute(CommandLine.java:2078)
at io.jenkins.jenkinsfile.runner.bootstrap.Bootstrap.main(Bootstrap.java:46)
Caused by: java.lang.NoClassDefFoundError: com/cloudbees/plugins/credentials/CredentialsUnavailableException
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Unknown Source)
at java.lang.Class.privateGetMethodRecursive(Unknown Source)
at java.lang.Class.getMethod0(Unknown Source)
at java.lang.Class.getMethod(Unknown Source)
at io.jenkins.jenkinsfile.runner.JenkinsfileRunnerLauncher.doLaunch(JenkinsfileRunnerLauncher.java:34)
at io.jenkins.jenkinsfile.runner.JenkinsLauncher.launch(JenkinsLauncher.java:132)
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: com.cloudbees.plugins.credentials.CredentialsUnavailableException
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 20 more

I have this same error.

This error confuses me.

This seems to be due to missing plug-ins which are required to run even the simplest of pipelines. I worked through the errors (by running the command over and over) and eventually got it to run error free with the following list of plugins (store in a file and pass with the -p option to jenkinsfile-runner). Hopefully this help someone trying to get up and running with this tool. Do note that this is very sensitive to whitespace. No extra spaces at ends of lines or blank lines are allowed.

ace-editor:1.1
ansicolor:1.0.0
apache-httpcomponents-client-4-api:4.5.13-1.0
authentication-tokens:1.4
authorize-project:1.4.0
azure-ad:180.v8b1e80e6f242
azure-credentials:181.v00b0d97d2686
azure-sdk:20.vd701043901ab
azure-vm-agents:789.va0c40e4d0070
blueocean:1.24.8
blueocean-autofavorite:1.2.4
blueocean-bitbucket-pipeline:1.24.8
blueocean-commons:1.24.8
blueocean-config:1.24.8
blueocean-core-js:1.24.8
blueocean-dashboard:1.24.8
blueocean-display-url:2.4.1
blueocean-events:1.24.8
blueocean-github-pipeline:1.24.8
blueocean-git-pipeline:1.24.8
blueocean-i18n:1.24.8
blueocean-jwt:1.24.8
blueocean-personalization:1.24.8
blueocean-pipeline-api-impl:1.24.8
blueocean-pipeline-editor:1.24.8
blueocean-pipeline-scm-api:1.24.8
blueocean-rest:1.24.8
blueocean-rest-impl:1.24.8
blueocean-web:1.24.8
bootstrap4-api:4.6.0-1
branch-api:2.6.2
caffeine-api:2.9.2-29.v717aac953ff3
checks-api:1.7.2
cloudbees-bitbucket-branch-source:2.4.4
cloudbees-folder:6.16
cloud-stats:0.27
configuration-as-code:1.54
credentials:2.6.2
credentials-binding:1.27
dark-theme:0.0.12
disable-github-multibranch-status:1.2
display-url-api:2.3.5
durable-task:1.37
echarts-api:4.9.0-3
email-ext:2.83
embeddable-build-status:2.0.3
extended-read-permission:3.2
favorite:2.3.1
font-awesome-api:5.15.1-1
git:4.8.3
git-client:3.9.0
github:1.33.1
github-api:1.122
github-branch-source:2.11.3
github-checks:1.0.13
github-label-filter:1.0.0
github-scm-trait-notification-context:1.1
git-server:1.9
handy-uri-templates-2-api:2.1.6-1.0
htmlpublisher:1.25
jackson2-api:2.12.4
jenkins-design-language:1.24.8
jjwt-api:0.11.2-5.143e44951c52
job-dsl:1.77
jquery3-api:3.5.1-2
jsch:0.1.55.2
junit:1.49
kubernetes:1.30.3
kubernetes-client-api:5.4.1
kubernetes-credentials:0.9.0
lockable-resources:2.11
mailer:1.34
matrix-auth:2.6.7
matrix-project:1.18
mercurial:2.0
metrics:4.0.2.8
Office-365-Connector:4.15.2
okhttp-api:3.14.9
pipeline-build-step:2.14
pipeline-github:2.8-138.d766e30bb08b
pipeline-graph-analysis:1.10
pipeline-input-step:2.12
pipeline-milestone-step:1.3.1
pipeline-model-api:1.9.2
pipeline-model-definition:1.9.2
pipeline-model-extensions:1.9.2
pipeline-stage-step:2.5
pipeline-stage-tags-metadata:1.9.2
pipeline-utility-steps:2.5.0
plain-credentials:1.7
plugin-util-api:2.4.0
popper-api:1.16.0-7
pubsub-light:1.13
role-strategy:3.2.0
scm-api:2.6.5
script-security:1.78
snakeyaml-api:1.29.1
sse-gateway:1.24
ssh-credentials:1.18.1
structs:1.23
theme-manager:0.6
timestamper:1.13
token-macro:2.15
trilead-api:1.0.13
variant:1.4
workflow-api:2.46
workflow-basic-steps:2.20
workflow-cps:2.94
workflow-cps-global-lib:2.19
workflow-durable-task-step:2.35
workflow-job:2.41
workflow-multibranch:2.24
workflow-scm-step:2.13
workflow-step-api:2.24
workflow-support:3.8

FWIW the recommended way of packaging custom versions is https://github.com/jenkinsci/jenkinsfile-runner/tree/master/packaging-slim-parent-pom . Using the embedded plugin manager is not very reliable until #248 is finalized, and Plugin Installation Manager is used to declare mandatory plugins

FWIW the recommended way of packaging custom versions is https://github.com/jenkinsci/jenkinsfile-runner/tree/master/packaging-slim-parent-pom . Using the embedded plugin manager is not very reliable until #248 is finalized, and Plugin Installation Manager is used to declare mandatory plugins

I'm not sure I follow... what was I supposed to do instead? All I was trying to do was to run that single Jenkinsfile snippet posted in the initial post of this issue. I guess I don't follow why I should have needed to generate a giant list of plug-ins to use to get that simple jenkinsfile to run. Was there some easier path to making this work which we all missed?

guess I don't follow why I should have needed to generate a giant list of plug-ins to use to get that simple jenkinsfile to run.

You definitely should not. I plan to provide a Vanilla Executable package that includes all the necessary plugins. Currently it is available as a Docker image only. It was available before to some extent, but it was a bogus one due to #450

@oleg-nenashev I am getting same error with latest (just pulled) docker image using next Jenkinsfile

node {
  stage("one") {
  }
  stage("two") {
    echo "Done!"
  }
}

Error:

No explicit version has been selected, using latest LTS
Running pipeline on jenkins 2.319.2
Exploding /home/egorse/.jenkinsfile-runner/war/2.319.2/jenkins-war-2.319.2.war, this might take some time.
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:1953)
	at picocli.CommandLine.access$1300(CommandLine.java:145)
	at picocli.CommandLine$RunLast.executeUserObjectOfLastSubcommandWithSameParent(CommandLine.java:2352)
	at picocli.CommandLine$RunLast.handle(CommandLine.java:2346)
	at picocli.CommandLine$RunLast.handle(CommandLine.java:2311)
	at picocli.CommandLine$AbstractParseResultHandler.execute(CommandLine.java:2179)
	at picocli.CommandLine.execute(CommandLine.java:2078)
	at io.jenkins.jenkinsfile.runner.bootstrap.Bootstrap.main(Bootstrap.java:46)
Caused by: java.lang.NoClassDefFoundError: com/cloudbees/plugins/credentials/CredentialsUnavailableException
	at java.lang.Class.getDeclaredMethods0(Native Method)
	at java.lang.Class.privateGetDeclaredMethods(Class.java:2701)
	at java.lang.Class.privateGetMethodRecursive(Class.java:3048)
	at java.lang.Class.getMethod0(Class.java:3018)
	at java.lang.Class.getMethod(Class.java:1784)
	at io.jenkins.jenkinsfile.runner.JenkinsfileRunnerLauncher.doLaunch(JenkinsfileRunnerLauncher.java:34)
	at io.jenkins.jenkinsfile.runner.JenkinsLauncher.launch(JenkinsLauncher.java:121)
	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)
	... 9 more
Caused by: java.lang.ClassNotFoundException: com.cloudbees.plugins.credentials.CredentialsUnavailableException
	at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:418)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:351)
	... 19 more