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

`java.lang.ClassNotFoundException: org.kohsuke.putty.PuTTYKey` on scm step

    Details

    • Type: Bug
    • Status: Open (View Workflow)
    • Priority: Minor
    • Resolution: Unresolved
    • Labels:
      None
    • Environment:
    • Similar Issues:

      Description

      If the trilead-api plugin is not installed on a Jenkins 2.190.1 server, results in the following stacktrace

      java.lang.ClassNotFoundException: org.kohsuke.putty.PuTTYKey
              at jenkins.util.AntClassLoader.findClassInComponents(AntClassLoader.java:1383)
              at jenkins.util.AntClassLoader.findClass(AntClassLoader.java:1336)
              at jenkins.util.AntClassLoader.loadClass(AntClassLoader.java:1083)
              at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
      Caused: java.lang.NoClassDefFoundError: org/kohsuke/putty/PuTTYKey
              at com.cloudbees.jenkins.plugins.sshcredentials.impl.BasicSSHUserPrivateKey.getPrivateKeys(BasicSSHUserPrivateKey.java:174)
              at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.createSshKeyFile(CliGitAPIImpl.java:1878)
              at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:1793)
              at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.access$500(CliGitAPIImpl.java:78)
              at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$1.execute(CliGitAPIImpl.java:545)
              at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$2.execute(CliGitAPIImpl.java:758)
              at hudson.plugins.git.GitSCM.retrieveChanges(GitSCM.java:1152)
              at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1192)
              at org.jenkinsci.plugins.workflow.steps.scm.SCMStep.checkout(SCMStep.java:124)
              at org.jenkinsci.plugins.workflow.steps.scm.SCMStep$StepExecutionImpl.run(SCMStep.java:93)
              at org.jenkinsci.plugins.workflow.steps.scm.SCMStep$StepExecutionImpl.run(SCMStep.java:80)
              at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution.lambda$start$0(SynchronousNonBlockingStepExecution.java:47)
              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 

      Workaround is to install the trilead-api plugin. The plugin was unbundled from Jenkins core in Jenkins 2.190.1 and is needed by those plugins (git client, ssh-slaves, etc.) that previously used the version that was bundled with Jenkins core.

        Attachments

          Activity

          dicomj23 Dicom J created issue -
          ifernandezcalvo Ivan Fernandez Calvo made changes -
          Field Original Value New Value
          Component/s git-client-plugin [ 17423 ]
          Hide
          markewaite Mark Waite added a comment -

          If you're willing to try a pre-release build, you could install the build from PR-467 which includes a dependency on trlead-api. That build is only temporary, but it is being discussed in the pull request as a possible solution.

          Show
          markewaite Mark Waite added a comment - If you're willing to try a pre-release build, you could install the build from PR-467 which includes a dependency on trlead-api. That build is only temporary, but it is being discussed in the pull request as a possible solution.
          Hide
          dicomj23 Dicom J added a comment -

          Mark Waite, this "pre-release" build (I hope you meant plugin) is installed as the "latest" along with Jenkins Version 2.190.1, which appears on LTS list https://jenkins.io/changelog-stable/...

          Show
          dicomj23 Dicom J added a comment - Mark Waite , this "pre-release" build (I hope you meant plugin) is installed as the "latest" along with Jenkins Version 2.190.1, which appears on LTS list  https://jenkins.io/changelog-stable/ ...
          Hide
          markewaite Mark Waite added a comment -

          Yes, Dicom J the pre-release build (pull request build) is a build of the git client plugin from the stable-2.x branch, with the addition of a dependency on the trilead-api plugin. Install it on the Jenkins server where you are seeing this error, then report to this bug report if the error is resolved. If you're uncomfortable remaining with that pull request build, you can uninstall that version and return to the previous version after the experiment is complete.

          Show
          markewaite Mark Waite added a comment - Yes, Dicom J the pre-release build (pull request build) is a build of the git client plugin from the stable-2.x branch, with the addition of a dependency on the trilead-api plugin. Install it on the Jenkins server where you are seeing this error, then report to this bug report if the error is resolved. If you're uncomfortable remaining with that pull request build, you can uninstall that version and return to the previous version after the experiment is complete.
          Hide
          ifernandezcalvo Ivan Fernandez Calvo added a comment -

          I've tested a fresh installation of Jenkins 2.190.1, I've used a docker-compose environment you can find at https://github.com/kuisathaverat/jenkins-issues/tree/master/JENKINS-59676 , I cannot replicate the issue, the trilead-api 1.04 is installed and everything works as expected.
          Did you make a fresh install or an update from a previous version?

          Show
          ifernandezcalvo Ivan Fernandez Calvo added a comment - I've tested a fresh installation of Jenkins 2.190.1, I've used a docker-compose environment you can find at https://github.com/kuisathaverat/jenkins-issues/tree/master/JENKINS-59676 , I cannot replicate the issue, the trilead-api 1.04 is installed and everything works as expected. Did you make a fresh install or an update from a previous version?
          Hide
          dicomj23 Dicom J added a comment - - edited

          Mark Waite, thanks, I'm fine  as I figured out it right away that explicitly adding trilead-api plugin would resolve the issues. the one you see in Environment section is "trilead-api:1.0.5 - []" is my explicit addition to the latest, git-client and the rest plugins depend on "trilead-api (1.0.4) optional" what it's optional dependency and was not installed in my case.
          So I run into this when I did everything from stretch and "by the book" rom GA repos, without adding "trilead-api" as I din't even know about it and none of the plugins installed it. So if I ran into this, there's a chance that somebody else would. So I just decided to let you guys know. That's it.

          Show
          dicomj23 Dicom J added a comment - - edited Mark Waite , thanks, I'm fine  as I figured out it right away that explicitly adding trilead-api plugin would resolve the issues. the one you see in Environment section is "trilead-api:1.0.5 - []" is my explicit addition to the latest, git-client and the rest plugins depend on "trilead-api (1.0.4) optional" what it's optional dependency and was not installed in my case. So I run into this when I did everything from stretch and "by the book" rom GA repos, without adding "trilead-api" as I din't even know about it and none of the plugins installed it. So if I ran into this, there's a chance that somebody else would. So I just decided to let you guys know. That's it.
          Hide
          markewaite Mark Waite added a comment -

          That is very good information Dicom J. You found the problem because the plugins in your installation had the trilead-api as an optional dependency which was not installed. I guess that means that when Jenkins 2.190.1 unbundled the trilead-api the API was removed from Jenkins core so that it would be in the trilead-api plugin.

          Ivan Fernandez Calvo and I probably both always include the trilead-api in our installations because at various times it has been required in different iterations of the releases of the various plugins that we use.

          I'm delighted that installing the trilead plugin resolved the issue. That makes me wonder if I should make it an explicit dependency in the git client plugin so that it will be automatically installed if not already installed by the user for other reasons.

          Show
          markewaite Mark Waite added a comment - That is very good information Dicom J . You found the problem because the plugins in your installation had the trilead-api as an optional dependency which was not installed. I guess that means that when Jenkins 2.190.1 unbundled the trilead-api the API was removed from Jenkins core so that it would be in the trilead-api plugin. Ivan Fernandez Calvo and I probably both always include the trilead-api in our installations because at various times it has been required in different iterations of the releases of the various plugins that we use. I'm delighted that installing the trilead plugin resolved the issue. That makes me wonder if I should make it an explicit dependency in the git client plugin so that it will be automatically installed if not already installed by the user for other reasons.
          Hide
          markewaite Mark Waite added a comment -

          Dicom J just to confirm, when you saw the problem, was trilead-api 1.0.5 already installed or did you install it to resolve the problem?

          Show
          markewaite Mark Waite added a comment - Dicom J just to confirm, when you saw the problem, was trilead-api 1.0.5 already installed or did you install it to resolve the problem?
          Hide
          dicomj23 Dicom J added a comment -

          Installed to resolve the problem

          Show
          dicomj23 Dicom J added a comment - Installed to resolve the problem
          markewaite Mark Waite made changes -
          Description results in the following stacktrace
          {code:java}
          java.lang.ClassNotFoundException: org.kohsuke.putty.PuTTYKey
                  at jenkins.util.AntClassLoader.findClassInComponents(AntClassLoader.java:1383)
                  at jenkins.util.AntClassLoader.findClass(AntClassLoader.java:1336)
                  at jenkins.util.AntClassLoader.loadClass(AntClassLoader.java:1083)
                  at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
          Caused: java.lang.NoClassDefFoundError: org/kohsuke/putty/PuTTYKey
                  at com.cloudbees.jenkins.plugins.sshcredentials.impl.BasicSSHUserPrivateKey.getPrivateKeys(BasicSSHUserPrivateKey.java:174)
                  at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.createSshKeyFile(CliGitAPIImpl.java:1878)
                  at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:1793)
                  at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.access$500(CliGitAPIImpl.java:78)
                  at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$1.execute(CliGitAPIImpl.java:545)
                  at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$2.execute(CliGitAPIImpl.java:758)
                  at hudson.plugins.git.GitSCM.retrieveChanges(GitSCM.java:1152)
                  at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1192)
                  at org.jenkinsci.plugins.workflow.steps.scm.SCMStep.checkout(SCMStep.java:124)
                  at org.jenkinsci.plugins.workflow.steps.scm.SCMStep$StepExecutionImpl.run(SCMStep.java:93)
                  at org.jenkinsci.plugins.workflow.steps.scm.SCMStep$StepExecutionImpl.run(SCMStep.java:80)
                  at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution.lambda$start$0(SynchronousNonBlockingStepExecution.java:47)
                  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 {code}
          If the trilead-api plugin is not installed on a Jenkins 2.190.1 server, results in the following stacktrace
          {code:java}
          java.lang.ClassNotFoundException: org.kohsuke.putty.PuTTYKey
                  at jenkins.util.AntClassLoader.findClassInComponents(AntClassLoader.java:1383)
                  at jenkins.util.AntClassLoader.findClass(AntClassLoader.java:1336)
                  at jenkins.util.AntClassLoader.loadClass(AntClassLoader.java:1083)
                  at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
          Caused: java.lang.NoClassDefFoundError: org/kohsuke/putty/PuTTYKey
                  at com.cloudbees.jenkins.plugins.sshcredentials.impl.BasicSSHUserPrivateKey.getPrivateKeys(BasicSSHUserPrivateKey.java:174)
                  at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.createSshKeyFile(CliGitAPIImpl.java:1878)
                  at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:1793)
                  at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.access$500(CliGitAPIImpl.java:78)
                  at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$1.execute(CliGitAPIImpl.java:545)
                  at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$2.execute(CliGitAPIImpl.java:758)
                  at hudson.plugins.git.GitSCM.retrieveChanges(GitSCM.java:1152)
                  at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1192)
                  at org.jenkinsci.plugins.workflow.steps.scm.SCMStep.checkout(SCMStep.java:124)
                  at org.jenkinsci.plugins.workflow.steps.scm.SCMStep$StepExecutionImpl.run(SCMStep.java:93)
                  at org.jenkinsci.plugins.workflow.steps.scm.SCMStep$StepExecutionImpl.run(SCMStep.java:80)
                  at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution.lambda$start$0(SynchronousNonBlockingStepExecution.java:47)
                  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 {code}

          Workaround is to install the trilead-api plugin. The plugin was unbundled from Jenkins core in Jenkins 2.190.1 and is needed by those plugins (git client, ssh-slaves, etc.) that previously used the version that was bundled with Jenkins core.

            People

            • Assignee:
              ifernandezcalvo Ivan Fernandez Calvo
              Reporter:
              dicomj23 Dicom J
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated: