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

ClassNotFoundException using ssh git repository in blue ocean Pipeline editor

      Trying to set up blue ocean pipeline with git repo in format `git@host:user/repo.git` throws exception and the flow gets stuck.

      Could be related to JENKINS-70379.

      I am running latest jenkins version (2.389) through docker and latest blueocean plugin (1.27.1) installed through plugins.txt

       

      There are actually two different exceptions.

      1. Exception when I just paste in the repo address and javascript automatically triggers some background action.
      2. Different exception (different class not found) when I click on the "Create pipeline" button

       

      I used find to look for `jsch*` in file system, and it is not there when installing blueocean plugin. I tried adding jsch to plugin list manually (even though you are not supposed to) and it did not help either.

       

      Exception 1:

       

      2023-02-03 18:48:43.482+0000 [id=25]    WARNING    o.e.j.s.h.ContextHandler$Context#log: Error while serving http://localhost:8080/blue/rest/organizations/jenkins/user/publickey/
       java.lang.NoClassDefFoundError: com/jcraft/jsch/JSch
           at io.jenkins.blueocean.ssh.SSHKeyUtils.generateKey(SSHKeyUtils.java:49)
      

       

      Exception 2:

      2023-02-03 18:48:58.576+0000 [id=72] WARNING o.e.j.s.h.ContextHandler$Context#log: Error while serving http://localhost:8080/blue/rest/organizations/jenkins/pipelines/
      java.lang.ClassNotFoundException: org.eclipse.jgit.transport.ssh.jsch.JschConfigSessionFactory
       at java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:476)
       at jenkins.util.URLClassLoader2.findClass(URLClassLoader2.java:35)
       at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:589)
       at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522)
      Caused: java.lang.NoClassDefFoundError: org/eclipse/jgit/transport/ssh/jsch/JschConfigSessionFactory
       at java.base/java.lang.ClassLoader.defineClass1(Native Method)
       at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1017)
       at java.base/java.security.SecureClassLoader.defineClass(SecureClassLoader.java:174)
       at java.base/java.net.URLClassLoader.defineClass(URLClassLoader.java:555)
       at java.base/java.net.URLClassLoader$1.run(URLClassLoader.java:458)
       at java.base/java.net.URLClassLoader$1.run(URLClassLoader.java:452)
       at java.base/java.security.AccessController.doPrivileged(Native Method)
       at java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:451)
       at jenkins.util.URLClassLoader2.findClass(URLClassLoader2.java:35)
       at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:589)
       at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522)
       at io.jenkins.blueocean.blueocean_git_pipeline.GitPipelineCreateRequest.validate(GitPipelineCreateRequest.java:64)

          [JENKINS-70559] ClassNotFoundException using ssh git repository in blue ocean Pipeline editor

          Janis created issue -
          Janis made changes -
          Description Original: !image-2023-02-03-20-41-24-144.png|width=446,height=401!

          Trying to set up blue ocean pipeline with git repo in format `git@host:user/repo.git` throws exception and the flow gets stuck.

          Could be related to JENKINS-70379.

          I am running latest jenkins version (2.389) through docker and latest blueocean plugin (1.27.1) installed through plugins.txt

           

          There are actually two different exceptions.
           # Exception when I just paste in the repo address and javascript automatically triggers some background action.
           # Different exception (different class not found) when I click on the "Create pipeline" button

           

          I used find to look for `jsch*` in file system, and it is not there when installing blueocean plugin. I tried adding jsch to plugin list manually (even though you are not supposed to) and it did not help either.

           

          Exception 1:

           
          {code:java}
          2023-02-03 18:48:43.482+0000 [id=25]    WARNING    o.e.j.s.h.ContextHandler$Context#log: Error while serving http://localhost:8080/blue/rest/organizations/jenkins/user/publickey/
           java.lang.NoClassDefFoundError: com/jcraft/jsch/JSch
               at io.jenkins.blueocean.ssh.SSHKeyUtils.generateKey(SSHKeyUtils.java:49)
          {code}
           

           

          Exception 2:

           
          {code:java}
           2023-02-03 18:48:58.576+0000 [id=72] WARNING o.e.j.s.h.ContextHandler$Context#log: Error while serving http://localhost:8080/blue/rest/organizations/jenkins/pipelines/ java.lang.ClassNotFoundException: org.eclipse.jgit.transport.ssh.jsch.JschConfigSessionFactory at java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:476) at jenkins.util.URLClassLoader2.findClass(URLClassLoader2.java:35) at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:589) at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522) Caused: java.lang.NoClassDefFoundError: org/eclipse/jgit/transport/ssh/jsch/JschConfigSessionFactory at java.base/java.lang.ClassLoader.defineClass1(Native Method) at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1017) at java.base/java.security.SecureClassLoader.defineClass(SecureClassLoader.java:174) at java.base/java.net.URLClassLoader.defineClass(URLClassLoader.java:555) at java.base/java.net.URLClassLoader$1.run(URLClassLoader.java:458) at java.base/java.net.URLClassLoader$1.run(URLClassLoader.java:452) at java.base/java.security.AccessController.doPrivileged(Native Method) at java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:451) at jenkins.util.URLClassLoader2.findClass(URLClassLoader2.java:35) at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:589) at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522) at io.jenkins.blueocean.blueocean_git_pipeline.GitPipelineCreateRequest.validate(GitPipelineCreateRequest.java:64)
          {code}
           

           

           

           
          New: !image-2023-02-03-20-41-24-144.png|width=446,height=401!

          Trying to set up blue ocean pipeline with git repo in format `git@host:user/repo.git` throws exception and the flow gets stuck.

          Could be related to JENKINS-70379.

          I am running latest jenkins version (2.389) through docker and latest blueocean plugin (1.27.1) installed through plugins.txt

           

          There are actually two different exceptions.
           # Exception when I just paste in the repo address and javascript automatically triggers some background action.
           # Different exception (different class not found) when I click on the "Create pipeline" button

           

          I used find to look for `jsch*` in file system, and it is not there when installing blueocean plugin. I tried adding jsch to plugin list manually (even though you are not supposed to) and it did not help either.

           

          Exception 1:

           
          {code:java}
          2023-02-03 18:48:43.482+0000 [id=25]    WARNING    o.e.j.s.h.ContextHandler$Context#log: Error while serving http://localhost:8080/blue/rest/organizations/jenkins/user/publickey/
           java.lang.NoClassDefFoundError: com/jcraft/jsch/JSch
               at io.jenkins.blueocean.ssh.SSHKeyUtils.generateKey(SSHKeyUtils.java:49)
          {code}
           

          Exception 2:
          {code:java}
          2023-02-03 18:48:58.576+0000 [id=72] WARNING o.e.j.s.h.ContextHandler$Context#log: Error while serving http://localhost:8080/blue/rest/organizations/jenkins/pipelines/
          java.lang.ClassNotFoundException: org.eclipse.jgit.transport.ssh.jsch.JschConfigSessionFactory
           at java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:476)
           at jenkins.util.URLClassLoader2.findClass(URLClassLoader2.java:35)
           at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:589)
           at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522)
          Caused: java.lang.NoClassDefFoundError: org/eclipse/jgit/transport/ssh/jsch/JschConfigSessionFactory
           at java.base/java.lang.ClassLoader.defineClass1(Native Method)
           at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1017)
           at java.base/java.security.SecureClassLoader.defineClass(SecureClassLoader.java:174)
           at java.base/java.net.URLClassLoader.defineClass(URLClassLoader.java:555)
           at java.base/java.net.URLClassLoader$1.run(URLClassLoader.java:458)
           at java.base/java.net.URLClassLoader$1.run(URLClassLoader.java:452)
           at java.base/java.security.AccessController.doPrivileged(Native Method)
           at java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:451)
           at jenkins.util.URLClassLoader2.findClass(URLClassLoader2.java:35)
           at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:589)
           at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522)
           at io.jenkins.blueocean.blueocean_git_pipeline.GitPipelineCreateRequest.validate(GitPipelineCreateRequest.java:64){code}

          Janis added a comment - - edited

          For now as a workaround I manually download jsch-0.1.55.jar and add it to /var/jenkins_home/war/WEB-INF/lib/ which solves the issue.

          Janis added a comment - - edited For now as a workaround I manually download jsch-0.1.55.jar and add it to /var/jenkins_home/war/WEB-INF/lib/ which solves the issue.

          Mark Waite added a comment - - edited

          Thanks for reporting the issue and thanks for investigating.

          Another workaround is to install git client plugin 4.0.0 instead of git client plugin 4.1.0. The jsch implementation that the blue ocean plugin relies on from JGit has been deprecated by JGit. Their documentation says that they may remove it at any time. Git client plugin 4.1.0 switches the JGit implementation to use Apache Mina sshd rather than jsch. The blue ocean plugin will need to adapt to that change the next time it updates its dependencies from the plugin bill of materials.

          Another workaround is to use HTTPS repository access instead of SSH repository access.

          Mark Waite added a comment - - edited Thanks for reporting the issue and thanks for investigating. Another workaround is to install git client plugin 4.0.0 instead of git client plugin 4.1.0. The jsch implementation that the blue ocean plugin relies on from JGit has been deprecated by JGit. Their documentation says that they may remove it at any time. Git client plugin 4.1.0 switches the JGit implementation to use Apache Mina sshd rather than jsch. The blue ocean plugin will need to adapt to that change the next time it updates its dependencies from the plugin bill of materials. Another workaround is to use HTTPS repository access instead of SSH repository access.
          Mark Waite made changes -
          Link New: This issue is caused by JENKINS-69159 [ JENKINS-69159 ]

          Mark Waite added a comment -

          Caused by the git client plugin switch from Jsch to Apache Mina sshd

          Mark Waite added a comment - Caused by the git client plugin switch from Jsch to Apache Mina sshd
          Mark Waite made changes -
          Summary Original: ClassNotFoundException when using git repository in blue ocean New: ClassNotFoundException when using git repository with ssh in blue ocean
          Mark Waite made changes -
          Summary Original: ClassNotFoundException when using git repository with ssh in blue ocean New: ClassNotFoundException with git repository using ssh in blue ocean Pipeline editor
          Mark Waite made changes -
          Summary Original: ClassNotFoundException with git repository using ssh in blue ocean Pipeline editor New: ClassNotFoundException using ssh git repository in blue ocean Pipeline editor
          Mark Waite made changes -
          Remote Link New: This issue links to "Blue ocean pull request 2397 - add Jsch to blue ocean git pipeline plugin (Web Link)" [ 28463 ]

            Unassigned Unassigned
            janhouse Janis
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: