Py学习  »  docker

Docker:Jenkins-jdk11无法连接到Nexus,因为找不到JAXB-API

mCs • 4 年前 • 718 次点击  

尝试连接时出现以下错误 jenkins-jdk11 nexus3 在docker中运行同一网络的容器组成基于JDK8的主机系统。点击“测试连接”后 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

Python社区是高质量的Python/Django开发社区
本文地址:http://www.python88.com/topic/53238
 
718 次点击  
文章 [ 1 ]  |  最新文章 4 年前
michalk
Reply   •   1 楼
michalk    4 年前

这是Jenkins wiki上列出的Jenkins与Java 11兼容问题。这是 link .

一个可能的解决方案是 -Djavax.xml.bind.JAXBContextFactory=com.sun.xml.bind.v2.ContextFactory 在爪哇岛当詹金斯的时候选择。可以通过使用 --env 选项:

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

environment

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