jenkinsci / kubernetes-cd-plugin

A Jenkins plugin to deploy to Kubernetes cluster
MIT License
140 stars 72 forks source link

ClassNotFoundException: com.fasterxml.jackson.databind.JsonNode #99

Closed dpollastrini closed 5 years ago

dpollastrini commented 5 years ago

I'm running Jenkins (2.176.2) as a docker image (https://hub.docker.com/r/h1kkan/jenkins-docker, LTS). I've install the latest kubernetes-cd-plugin (2.1.0). My test pipeline script is configured as follows (redacted):

def DOCKER_REGISTRY="https://my.private.io"
node {
        git credentialsId: '99999999-9999-9999-9999-999999999999', url: 'git@github.com:xxxxxxxxx/my-api'               

        try {
            kubernetesDeploy (
                kubeconfigId: '99999999-9999-9999-9999-999999999999,
                configs: 'my-api.yml',
                dockerCredentials: [
                    [credentialsId: '99999999-9999-9999-9999-999999999999', url: "${DOCKER_REGISTRY}"]
                ]
            )
        } catch (e) {
            println 'ERROR!!'
        }
}

The plugin configuration validates successfully. However, the output is as follows:

[Pipeline] kubernetesDeploy
Starting Kubernetes deployment
Prepare Docker container registry secrets with name: acs-plugin--4h1knxten
[Pipeline] }
[Pipeline] // node
[Pipeline] End of Pipeline
java.lang.ClassNotFoundException: com.fasterxml.jackson.databind.JsonNode
    at jenkins.util.AntClassLoader.findClassInComponents(AntClassLoader.java:1373)
    at jenkins.util.AntClassLoader.findClass(AntClassLoader.java:1326)
    at jenkins.util.AntClassLoader.loadClass(AntClassLoader.java:1079)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
Caused: java.lang.NoClassDefFoundError: com/fasterxml/jackson/databind/JsonNode
    at com.microsoft.jenkins.kubernetes.wrapper.KubernetesClientWrapper.createOrReplaceSecrets(KubernetesClientWrapper.java:323)
    at com.microsoft.jenkins.kubernetes.command.DeploymentCommand$DeploymentTask.doCall(DeploymentCommand.java:159)
    at com.microsoft.jenkins.kubernetes.command.DeploymentCommand$DeploymentTask.call(DeploymentCommand.java:124)
    at com.microsoft.jenkins.kubernetes.command.DeploymentCommand$DeploymentTask.call(DeploymentCommand.java:106)
    at hudson.FilePath.act(FilePath.java:1163)
    at com.microsoft.jenkins.kubernetes.command.DeploymentCommand.execute(DeploymentCommand.java:68)
    at com.microsoft.jenkins.kubernetes.command.DeploymentCommand.execute(DeploymentCommand.java:45)
    at com.microsoft.jenkins.azurecommons.command.CommandService.runCommand(CommandService.java:88)
    at com.microsoft.jenkins.azurecommons.command.CommandService.execute(CommandService.java:96)
    at com.microsoft.jenkins.azurecommons.command.CommandService.executeCommands(CommandService.java:75)
    at com.microsoft.jenkins.azurecommons.command.BaseCommandContext.executeCommands(BaseCommandContext.java:77)
    at com.microsoft.jenkins.kubernetes.KubernetesDeploy.perform(KubernetesDeploy.java:42)
    at com.microsoft.jenkins.azurecommons.command.SimpleBuildStepExecution.run(SimpleBuildStepExecution.java:54)
    at com.microsoft.jenkins.azurecommons.command.SimpleBuildStepExecution.run(SimpleBuildStepExecution.java:35)
    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$Worker.run(ThreadPoolExecutor.java:624)
    at java.lang.Thread.run(Thread.java:748)
Finished: FAILURE

Its seems the plugin is not actually emitting a catch-able error as the "ERROR!" message does not appear. Regardless the stack trace appears at the bottom of the console output.

I've verified the documented dependencies are present in the Jenkins plugin manager, but it would seem I'm missing something.

Thanks in advance for your help.

runzexia commented 5 years ago

I think this should be incompatible with some plugins, I am using the official jenkins 2.176.2 and there is no problem.

dpollastrini commented 5 years ago

@runzexia Thanks for the response. It is not clear what you mean by "I think this [emphasis added] should be incompatible with some plugins...". Does "this" mean using a Docker container via k8s, the specific Docker image referenced, or ??

Regarding the Docker image, my understanding is that https://hub.docker.com/r/h1kkan/jenkins-docker is actually derived from the official image https://hub.docker.com/r/jenkins/jenkins (the former merely adds some plugins). In any case, the LTS tags for both images use 2.176.X. I also verified the Jenkins version in my Jenkins installation: org.jenkins-ci.main:jenkins-war:2.176.3.

Presuming that you are referring to the Docker image I am using as being incompatible, I rebuilt my installation using the "official" LTS image (https://hub.docker.com/r/jenkins/jenkins). With a clean install of the latest Jenkins image running as a K8s Deployment, I'm seeing the same error referenced in the origin report.

Thanks again for your time.

runzexia commented 5 years ago

Sorry, I think my previous answer is not very accurate. I also reproduced this problem. I will try to fix it today.

dpollastrini commented 5 years ago

@runzexia You, sir, are a golden god. Thanks!

image