当前位置: 首页 > 面试题库 >

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

汲睿
2023-03-14
问题内容

以下是配置文件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

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


问题答案:

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

jenkins.model.Jenkins.get()

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



 类似资料:
  • 问题内容: 我有以下工作流程,用于将Web应用发布到我的开发服务器。该服务器只有一个docker主机,我正在使用docker-compose来管理容器。 将我的应用程序中的更改推送到私有gitlab(在docker中运行)。该应用程序包括一个Dockerfile和docker-compose.yml Gitlab触发了一个jenkins构建(jenkins也正在docker中运行),它会执行一些常

  • > 难道从詹金斯没有像主詹金斯那样安装和启动吗?我假设我将以同样的方式安装一个主Jenkins和另一个从Jenkins,然后主Jenkins将控制从Jenkins例如通过ssh?所以我不能通过GUI查看奴隶詹金斯? 我考虑在另一个VM上添加从Jenkins的原因是因为VM包含我们的应用服务器(许多测试环境)。从master Jenkins部署和启动/停止应用程序服务器是一个难题,因为master

  • 有没有可能让詹金斯使用真正的浏览器而不是无头浏览器?我正在运行一些用TestNG编写的测试(使用Selenium webdriver)。当我运行testng时。在Eclipse中,浏览器启动并运行测试。但当我使用Jenkins并用maven运行测试时,它不会启动任何浏览器。

  • 问题内容: 如何轻松地将Jenkins与qUnit集成?我将使用真正的浏览器(如firefox和chrome)运行测试。我的服务器在RedHat 6.1 Linux上运行。我想我都需要插件/库,但我仍然不知道如何使其工作。我第一次与Jenkins合作(在服务器端)。 //编辑: 如果有人也可以共享想法如何构建覆盖率报告,那将是很棒的。 提前致谢 :)。 问题答案: 说詹金斯和QUnit只是难题的一

  • 我想做一些非常简单的事情,在一个文件夹中,我有一个jar文件和一个包含脚本的名为脚本的文件夹。但我可以让詹金斯拉链来做这件事。 zip目录:“awsdeploy”,排除:“”,glob:“”,“scripts/”,zipFile:“SQSToElasticProcessor.zip” 必须显式命名“zip”的参数。@ 第 31 行,第 16 列。

  • 问题内容: 我有一个简单的问题。我想运行一个应在构建后运行的bat文件。bat文件采用参数previousVersion和currentVersion(在构建开始之前,这些参数作为“验证字符串参数”输入)。 这是我尝试过的“执行Windows批处理命令” 我得到的错误是cmd无法识别为内部或外部命令可操作程序或批处理文件出口9009 问题答案: 将“ cmd \ k”替换为“ call” “执行W