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

UnsupportedClassVersionError: com/trilead/ssh2/ServerHostKeyVerifier

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: Blocker Blocker
    • trilead-api-plugin
    • None
    • Jenkins 2.346.3
      git-client-plugin 3.11.2
      kubernetes 3690.va_9ddf6635481
      ssh-slaves 1.834.v622da_57f702c

      After recently upgrade on git-client plugin, our slave pod failed checkout repo.

      Jenkins is able to checkout repo on the master node but failed on the slave pod with the same jobDSL in the pipeline job.

      In the logs:

      java.lang.UnsupportedClassVersionError: com/trilead/ssh2/ServerHostKeyVerifier has been compiled by a more recent version of the Java Runtime (class file version 55.0), this version of the Java Runtime only recognizes class file versions up to 52.0
      	at java.lang.ClassLoader.defineClass1(Native Method)
      	at java.lang.ClassLoader.defineClass(ClassLoader.java:756)
      	at java.lang.ClassLoader.defineClass(ClassLoader.java:635)
      	at hudson.remoting.RemoteClassLoader.loadClassFile(RemoteClassLoader.java:453)
      Caused: java.lang.UnsupportedClassVersionError: Failed to load com.trilead.ssh2.ServerHostKeyVerifier
      	at hudson.remoting.RemoteClassLoader.loadClassFile(RemoteClassLoader.java:455)
      	at hudson.remoting.RemoteClassLoader.loadRemoteClass(RemoteClassLoader.java:295)
      	at hudson.remoting.RemoteClassLoader.loadWithMultiClassLoader(RemoteClassLoader.java:264)
      	at hudson.remoting.RemoteClassLoader.findClass(RemoteClassLoader.java:223)
      	at java.lang.ClassLoader.loadClass(ClassLoader.java:418)
      	at java.lang.ClassLoader.loadClass(ClassLoader.java:351)
      	at java.lang.ClassLoader.defineClass1(Native Method)
      	at java.lang.ClassLoader.defineClass(ClassLoader.java:756)
      	at java.lang.ClassLoader.defineClass(ClassLoader.java:635)
      	at hudson.remoting.RemoteClassLoader.loadClassFile(RemoteClassLoader.java:453)
      Also:   hudson.remoting.Channel$CallSiteStackTrace: Remote call to JNLP4-connect connection from 10.193.21.68/10.193.21.68:55966
      		at hudson.remoting.Channel.attachCallSiteStackTrace(Channel.java:1784)
      		at hudson.remoting.UserRequest$ExceptionResponse.retrieve(UserRequest.java:356)
      		at hudson.remoting.Channel.call(Channel.java:1000)
      		at hudson.FilePath.act(FilePath.java:1194)
      		at hudson.FilePath.act(FilePath.java:1183)
      		at org.jenkinsci.plugins.gitclient.Git.getClient(Git.java:140)
      		at hudson.plugins.git.GitSCM.createClient(GitSCM.java:916)
      		at hudson.plugins.git.GitSCM.createClient(GitSCM.java:847)
      		at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1297)
      		at org.jenkinsci.plugins.workflow.steps.scm.SCMStep.checkout(SCMStep.java:129)
      		at org.jenkinsci.plugins.workflow.steps.scm.SCMStep$StepExecutionImpl.run(SCMStep.java:97)
      		at org.jenkinsci.plugins.workflow.steps.scm.SCMStep$StepExecutionImpl.run(SCMStep.java:84)
      		at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution.lambda$start$0(SynchronousNonBlockingStepExecution.java:47)
      		at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
      		at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
      		at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
      		at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
      		at java.base/java.lang.Thread.run(Thread.java:829)
      Caused: java.lang.UnsupportedClassVersionError: Failed to load org.jenkinsci.plugins.gitclient.verifier.AbstractJGitHostKeyVerifier
      	at hudson.remoting.RemoteClassLoader.loadClassFile(RemoteClassLoader.java:455)
      	at hudson.remoting.RemoteClassLoader.loadRemoteClass(RemoteClassLoader.java:287)
      	at hudson.remoting.RemoteClassLoader.loadWithMultiClassLoader(RemoteClassLoader.java:264)
      	at hudson.remoting.RemoteClassLoader.findClass(RemoteClassLoader.java:223)
      	at java.lang.ClassLoader.loadClass(ClassLoader.java:418)
      	at java.lang.ClassLoader.loadClass(ClassLoader.java:351)
      	at java.lang.Class.getDeclaredMethods0(Native Method)
      	at java.lang.Class.privateGetDeclaredMethods(Class.java:2701)
      	at java.lang.Class.getDeclaredMethod(Class.java:2128)
      	at java.io.ObjectStreamClass.getPrivateMethod(ObjectStreamClass.java:1643)
      	at java.io.ObjectStreamClass.access$1700(ObjectStreamClass.java:79)
      	at java.io.ObjectStreamClass$3.run(ObjectStreamClass.java:520)
      	at java.io.ObjectStreamClass$3.run(ObjectStreamClass.java:494)
      	at java.security.AccessController.doPrivileged(Native Method)
      	at java.io.ObjectStreamClass.<init>(ObjectStreamClass.java:494)
      	at java.io.ObjectStreamClass.lookup(ObjectStreamClass.java:391)
      	at java.io.ObjectStreamClass.initNonProxy(ObjectStreamClass.java:681)
      	at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:2003)
      	at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1850)
      	at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:2003)
      	at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1850)
      	at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:2160)
      	at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1667)
      	at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:2405)
      	at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:2329)
      	at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:2187)
      	at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1667)
      	at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:2405)
      	at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:2329)
      	at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:2187)
      	at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1667)
      	at java.io.ObjectInputStream.readObject(ObjectInputStream.java:503)
      	at java.io.ObjectInputStream.readObject(ObjectInputStream.java:461)
      	at hudson.remoting.UserRequest.deserialize(UserRequest.java:289)
      	at hudson.remoting.UserRequest.perform(UserRequest.java:189)
      	at hudson.remoting.UserRequest.perform(UserRequest.java:54)
      	at hudson.remoting.Request$2.run(Request.java:376)
      	at hudson.remoting.InterceptingExecutorService.lambda$wrap$0(InterceptingExecutorService.java:78)
      	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
      	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
      	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
      	at hudson.remoting.Engine$1.lambda$newThread$0(Engine.java:119)
      	at java.lang.Thread.run(Thread.java:748)
      Caused: java.io.IOException: Remote call on JNLP4-connect connection from 10.193.21.68/10.193.21.68:55966 failed
      	at hudson.remoting.Channel.call(Channel.java:1004)
      	at hudson.FilePath.act(FilePath.java:1194)
      	at hudson.FilePath.act(FilePath.java:1183)
      	at org.jenkinsci.plugins.gitclient.Git.getClient(Git.java:140)
      	at hudson.plugins.git.GitSCM.createClient(GitSCM.java:916)
      	at hudson.plugins.git.GitSCM.createClient(GitSCM.java:847)
      	at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1297)
      	at org.jenkinsci.plugins.workflow.steps.scm.SCMStep.checkout(SCMStep.java:129)
      	at org.jenkinsci.plugins.workflow.steps.scm.SCMStep$StepExecutionImpl.run(SCMStep.java:97)
      	at org.jenkinsci.plugins.workflow.steps.scm.SCMStep$StepExecutionImpl.run(SCMStep.java:84)
      	at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution.lambda$start$0(SynchronousNonBlockingStepExecution.java:47)
      	at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
      	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
      	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
      	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
      	at java.base/java.lang.Thread.run(Thread.java:829) 

      Our slave pod Dockerfile:

      FROM openjdk:8-jdk
      
      RUN apt-get clean
      RUN apt-get update
      RUN apt-get install -y \
          apt-transport-https \
          ca-certificates \
          curl \
          gnupg \
          lsb-release \
          gnupg-agent \
          software-properties-common
      
      RUN curl -fsSL https://download.docker.com/linux/debian/gpg | apt-key add -
      RUN add-apt-repository \
         "deb [arch=amd64] https://download.docker.com/linux/debian \
         $(lsb_release -cs) \
         stable"
      RUN apt-get update
      RUN apt-get install -y \
          docker-ce docker-ce-cli containerd.io
      
      RUN curl -O https://aliyuncli.alicdn.com/aliyun-cli-linux-3.0.90-amd64.tgz
      RUN tar zxvf aliyun-cli-linux-3.0.90-amd64.tgz -C /
      RUN mv aliyun /usr/local/bin/aliyun
      
      ARG MAVEN_VERSION=3.6.3
      ARG USER_HOME_DIR="/root"
      ARG SHA=c35a1803a6e70a126e80b2b3ae33eed961f83ed74d18fcd16909b2d44d7dada3203f1ffe726c17ef8dcca2dcaa9fca676987befeadc9b9f759967a8cb77181c0
      ARG BASE_URL=https://apache.osuosl.org/maven/maven-3/${MAVEN_VERSION}/binaries
      
      RUN mkdir -p /usr/share/maven /usr/share/maven/ref \
        && curl -fsSL -o /tmp/apache-maven.tar.gz ${BASE_URL}/apache-maven-${MAVEN_VERSION}-bin.tar.gz \
        && echo "${SHA}  /tmp/apache-maven.tar.gz" | sha512sum -c - \
        && tar -xzf /tmp/apache-maven.tar.gz -C /usr/share/maven --strip-components=1 \
        && rm -f /tmp/apache-maven.tar.gz \
        && ln -s /usr/share/maven/bin/mvn /usr/bin/mvn
      
      ENV MAVEN_HOME /usr/share/maven
      ENV MAVEN_CONFIG "$USER_HOME_DIR/.m2"
      
      RUN apt-get install -y \
          python3-pip \
          vim \
          iputils-ping
      
      RUN curl -O -L https://github.com/stedolan/jq/releases/download/jq-1.6/jq-linux64
      RUN chmod +x jq-linux64
      RUN mv jq-linux64 /usr/local/bin/jq
      
      RUN pip3 install yq==2.14.0
      RUN pip3 install awscli==1.18.6 --upgrade
      
      RUN curl -fsSL https://deb.nodesource.com/setup_14.x | bash -
      RUN apt-get install -y nodejs 

      Our pipeline stage:

              stage("Code Build") {
                  agent {
                      kubernetes {
                          yaml libraryResource('podsTemplate/common-dev.yaml')
                      }
                  }
                  steps {
                      cleanWs()
                      echo "checkout service code in k8s agent"
                      checkout([$class: 'GitSCM',
                                branches: [[name: 'develop']],
                                doGenerateSubmoduleConfigurations: false,
                                extensions: [[$class: 'RelativeTargetDirectory',
                                              relativeTargetDir: 'service-code']],
                                submoduleCfg: [],
                                userRemoteConfigs: [[credentialsId: '******',
                                                     url: '******']]])
                      echo "start to build from k8s pod"
                      container(name: 'docker') {
                          retry(1) {
                              timeout(time: 1, unit: 'HOURS') {
                                  timestamps {
                                      sh '''
                                          cd $WORKSPACE/service-code
                                          mvn clean verify
                                      '''
                                  }
                              }
                          }
                      }
                  }
              } 

      our pod template:

      apiVersion: v1
      kind: Pod
      spec:
        containers:
          - name: jnlp
            image: jenkins/inbound-agent:4.7-1
            resources:
              requests:
                cpu: "1000m"
                memory: "1024Mi"
              limits:
                cpu: "2000m"
                memory: "2048Mi"
            env:
              - name: CONTAINER_ENV_VAR
                value: jnlp
          - name: docker
            image: image url
            imagePullPolicy: Always
            command: ['cat']
            tty: true
            volumeMounts:
              - name: dockersock
                mountPath: /var/run/docker.sock
            resources:
              requests:
                cpu: 2000m
                memory: 2048Mi
              limits:
                cpu: 2000m
                memory: 2048Mi
        volumes:
          - name: dockersock
            hostPath:
              path: /var/run/docker.sock 

            markewaite Mark Waite
            yss0180 shaosheng yin
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: