gpt4 book ai didi

java - Docker:由于未找到 JAXB-API,Jenkins-jdk11 无法连接到 Nexus

转载 作者:行者123 更新时间:2023-12-02 04:56:54 24 4
gpt4 key购买 nike

尝试将jenkins-jdk11连接到在基于JDK8的主机系统上的docker-compose中运行相同网络的nexus3容器时出现以下错误。单击“测试连接”后 enter image description here

错误:

Nexus Repository Manager 3.x connection failed
javax.xml.bind.JAXBException: Implementation of JAXB-API has not been found on module path or classpath.
- with linked exception:
[java.lang.ClassNotFoundException: com.sun.xml.internal.bind.v2.ContextFactory]
at javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:278)
at javax.xml.bind.ContextFinder.find(ContextFinder.java:421)
at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:721)
at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:662)
at com.sonatype.nexus.api.zz.ex.a(SourceFile:33)
at com.sonatype.nexus.api.zz.ex.b(SourceFile:24)
at com.sonatype.nexus.api.zz.ez.handleResponse(SourceFile:54)
at org.apache.http.impl.client.CloseableHttpClient.execute(SourceFile:223)
at org.apache.http.impl.client.CloseableHttpClient.execute(SourceFile:165)
at com.sonatype.nexus.api.zz.et.a(SourceFile:84)
at com.sonatype.nexus.api.zz.es.getVersion(SourceFile:126)
at com.sonatype.nexus.api.repository.v3.RepositoryManagerV3Client$getVersion.call(Unknown Source)

docker-compose.yml

version: "3"
services:
jenkins-jdk11:
user: root
image: 'jenkins/jenkins:jdk11'
ports:
- '10000:8080'
- '50000:50000'
environment:
- TZ=Europe/Warsaw
- "JAVA_OPTS=-Djavax.xml.bind.JAXBContextFactory=com.sun.xml.bind.v2.ContextFactory"
links:
- nexus3
volumes:
- 'jenkins-data:/var/jenkins_home'
- '/var/run/docker.sock:/var/run/docker.sock'
deploy:
restart_policy:
condition: on-failure
networks:
- backend
nexus3:
container_name: nexus3
image: 'sonatype/nexus3'
ports:
- '50001:8081'
volumes:
- 'local-nexus-data-volume:/nexus-data'
networks:
- backend
volumes:
jenkins-data:
driver: local
local-nexus-data-volume:
driver: local
networks:
backend:
driver: overlay

问题是什么以及如何成功连接到 Nexus?

编辑我安装的 JAXB 插件: enter image description here

最佳答案

这是 Jenkins wiki 上列出的一个问题,涉及 Jenkins 与 Java 11 的兼容性问题。这里是 link .

一种可能的解决方案是在运行 Jenkins 时在 JAVA_OPTS 中添加 -Djavax.xml.bind.JAXBContextFactory=com.sun.xml.bind.v2.ContextFactory 。您可以通过使用 --env 选项将 env 变量传递到容器来完成此操作:

--env JAVA_OPTS=-Djavax.xml.bind.JAXBContextFactory=com.sun.xml.bind.v2.ContextFactory

或者在 docker compose 中使用 环境 :

services:
jenkins:
image: 'jenkins/jenkins:jdk11'
environment:
- JAVA_OPTS=-Djavax.xml.bind.JAXBContextFactory=com.sun.xml.bind.v2.ContextFactory

关于java - Docker:由于未找到 JAXB-API,Jenkins-jdk11 无法连接到 Nexus,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56406589/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com