一尘不染

Docker文件-主詹金斯-hudson.util.HudsonFailedToLoad

docker

以下是配置文件docker-compose

data:
 build: jenkins-data
master:
 build: jenkins-master
 volumes_from:
  - data
 ports:
 - "50000:50000"
nginx:
 build: jenkins-nginx
 ports:
  - "80:80"
  - "443:443"
 links:
  - master:jenkins-master
# volumes:
#  - /etc/letsencrypt:/etc/letsencrypt
slave:
 build: jenkins-slave
#slavedotnet:
# build: jenkins-dotnetcore-slave

在这里可用。

运行以下命令后:

docker-compose -f jenkinsDocker/docker-compose.yml -p jenkins up -d nginx data master

从浏览器启动时,詹金斯大师显示以下错误:

Error
hudson.util.HudsonFailedToLoad: org.jvnet.hudson.reactor.ReactorException: java.lang.Error: java.lang.reflect.InvocationTargetException
    at hudson.WebAppMain$3.run(WebAppMain.java:244)
Caused by: org.jvnet.hudson.reactor.ReactorException: java.lang.Error: java.lang.reflect.InvocationTargetException
    at org.jvnet.hudson.reactor.Reactor.execute(Reactor.java:269)
    at jenkins.InitReactorRunner.run(InitReactorRunner.java:45)
    at jenkins.model.Jenkins.executeReactor(Jenkins.java:1009)
    at jenkins.model.Jenkins.<init>(Jenkins.java:877)
    at hudson.model.Hudson.<init>(Hudson.java:85)
    at hudson.model.Hudson.<init>(Hudson.java:81)
    at hudson.WebAppMain$3.run(WebAppMain.java:227)
Caused by: java.lang.Error: java.lang.reflect.InvocationTargetException
    at hudson.init.TaskMethodFinder.invoke(TaskMethodFinder.java:110)
    at hudson.init.TaskMethodFinder$TaskImpl.run(TaskMethodFinder.java:175)
    at org.jvnet.hudson.reactor.Reactor.runTask(Reactor.java:282)
    at jenkins.model.Jenkins$7.runTask(Jenkins.java:998)
    at org.jvnet.hudson.reactor.Reactor$2.run(Reactor.java:210)
    at org.jvnet.hudson.reactor.Reactor$Node.run(Reactor.java:117)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.reflect.InvocationTargetException
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at hudson.init.TaskMethodFinder.invoke(TaskMethodFinder.java:104)
    ... 8 more
Caused by: java.lang.NoSuchMethodError: jenkins.model.Jenkins.get()Ljenkins/model/Jenkins;
    at org.jenkinsci.plugins.workflow.cps.nodes.StepDescriptorCache.getPublicCache(StepDescriptorCache.java:48)
    at org.jenkinsci.plugins.workflow.cps.nodes.StepDescriptorCache.invalidateGlobalCache(StepDescriptorCache.java:55)
    ... 13 more

詹金斯大师的Docker文件在这里

FROM gliderlabs/alpine:3.4 ## Official Jenkins build on openjdk:8-jdk file... this copied from that Dockerfile # Default to UTF-8 file.encodingENV LANG C.UTF-8 # add a simple script that can auto-detect the appropriate JAVA_HOME value# based on whether the JDK or only the JRE is installedRUN { \        echo '#!/bin/sh'; \     echo 'set -e'; \        echo; \     echo 'dirname "$(dirname "$(readlink -f "$(which javac || which java)")")"'; \  } > /usr/local/bin/docker-java-home \   && chmod +x /usr/local/bin/docker-java-homeENV JAVA_HOME /usr/lib/jvm/java-1.8-openjdkENV PATH $PATH:/usr/lib/jvm/java-1.8-openjdk/jre/bin:/usr/lib/jvm/java-1.8-openjdk/bin ENV JAVA_VERSION 8u111ENV JAVA_ALPINE_VERSION 8.111.14-r0 RUN set -x \ && apk add --no-cache \     openjdk8="$JAVA_ALPINE_VERSION" \   && [ "$JAVA_HOME" = "$(docker-java-home)" ] ## END of openjdk:8-jdk file RUN apk update &&\ apk upgrade &&\ apk add --no-cache git openssh-client curl zip unzip bash ttf-dejavu coreutils # SET Jenkins Environment VariablesENV JENKINS_HOME /var/jenkins_homeENV JENKINS_SLAVE_AGENT_PORT 50000ENV JENKINS_VERSION 2.7.3ENV JENKINS_SHA f822e70810e0d30c6fbe7935273635740faa3d89ENV JENKINS_UC https://updates.jenkins-ci.orgENV COPY_REFERENCE_FILE_LOG $JENKINS_HOME/copy_reference_file.logENV JAVA_OPTS="-Xmx8192m"ENV JENKINS_OPTS="--logfile=/var/log/jenkins/jenkins.log --webroot=/var/cache/jenkins/war" ARG JENKINS_USER=jenkinsARG JENKINS_GROUP=jenkinsARG uid=1000ARG gid=1000 # Jenkins is run with user `jenkins`, uid = 1000# If you bind mount a volume from the host or a data container,# ensure you use the same uidRUN addgroup -g ${gid} ${JENKINS_GROUP} \ && adduser -h "$JENKINS_HOME" -u ${uid} -G ${JENKINS_GROUP} -s /bin/bash -D ${JENKINS_USER} # `/usr/share/jenkins/ref/` contains all reference configuration we want# to set on a fresh new installation. Use it to bundle additional plugins# or config file with your custom jenkins Docker image.RUN mkdir -p /usr/share/jenkins/ref/init.groovy.d # Install TiniENV TINI_VERSION 0.9.0ENV TINI_SHA fa23d1e20732501c3bb8eeeca423c89ac80ed452 # Use tini as subreaper in Docker container to adopt zombie processes RUN curl -fsSL https://github.com/krallin/tini/releases/download/v${TINI_VERSION}/tini-static -o /bin/tini && chmod +x /bin/tini && echo "$TINI_SHA /bin/tini" | sha1sum -c - COPY init.groovy /usr/share/jenkins/ref/init.groovy.d/tcp-slave-agent-port.groovy # Can be used to customize where jenkins.war get downloaded fromARG JENKINS_URL=http://repo.jenkins-ci.org/public/org/jenkins-ci/main/jenkins-war/${JENKINS_VERSION}/jenkins-war-${JENKINS_VERSION}.war # could use ADD but this one does not check Last-Modified header neither does it allow to control checksum # see https://github.com/docker/docker/issues/8331RUN curl -fsSL ${JENKINS_URL} -o /usr/share/jenkins/jenkins.war && echo "${JENKINS_SHA} /usr/share/jenkins/jenkins.war" | sha1sum -c - # Prep Jenkins DirectoriesRUN chown -R ${JENKINS_USER} "$JENKINS_HOME" /usr/share/jenkins/refRUN mkdir /var/log/jenkinsRUN mkdir /var/cache/jenkinsRUN chown -R ${JENKINS_USER}:${JENKINS_GROUP} /var/log/jenkinsRUN chown -R ${JENKINS_USER}:${JENKINS_GROUP} /var/cache/jenkins # Expose Ports for web and slave agentsEXPOSE 8080EXPOSE 50000 # Switch to the jenkins userUSER ${JENKINS_USER} # Copy in local config files and set proper permissionsCOPY jenkins.sh /usr/local/bin/jenkins.shCOPY jenkins-support /usr/local/bin/jenkins-supportCOPY install-plugins.sh /usr/local/bin/install-plugins.sh USER root # Make sure permissions are set correctlyRUN chmod +x /usr/local/bin/jenkins-supportRUN chmod +x /usr/local/bin/install-plugins.shRUN chmod +x /usr/local/bin/jenkins.sh # Switch to the jenkins userUSER ${JENKINS_USER} # Tini as the entry point to manage zombie processesENTRYPOINT ["/bin/tini", "--", "/usr/local/bin/jenkins.sh"] RUN /usr/local/bin/install-plugins.sh jclouds-jenkins yet-another-docker-plugin scriptler docker-workflow

为什么詹金斯大师给这个例外?


阅读 688

收藏
2020-06-17

共1个答案

一尘不染

问题是您使用了3岁的
Jenkins版本2.7.3。堆栈跟踪抱怨方法

jenkins.model.Jenkins.get()

根据Jenkins API,此方法在2.98版中引入。有关更多详细信息,请参见更改日志

2020-06-17