我对Java 9模块并不陌生,并尝试使用Spring Boot构建Web服务。我将在Web服务中使用DiscoveryClient,并且该服务已创建为多个模块。当我尝试使用IntellijIdea运行服务时,出现以下错误。我正在使用Spring Boot 2.1.2和Java 11。
Error:java: the unnamed module reads package com.netflix.client.http from both ribbon.httpclient and ribbon.core
Error:java: the unnamed module reads package com.netflix.loadbalancer from both ribbon.httpclient and ribbon.loadbalancer
Error:java: the unnamed module reads package com.netflix.client from both ribbon.core and ribbon.loadbalancer
Error:java: the unnamed module reads package org.xmlpull.v1 from both xmlpull and xpp3.min
Error:java: module spring.boot reads package com.netflix.client.http from both ribbon.httpclient and ribbon.core
Error:java: module spring.boot reads package com.netflix.loadbalancer from both ribbon.httpclient and ribbon.loadbalancer
Error:java: module spring.boot reads package com.netflix.client from both ribbon.core and ribbon.loadbalancer
Error:java: module spring.boot reads package org.xmlpull.v1 from both xmlpull and xpp3.min
Error:java: module spring.cloud.commons reads package com.netflix.client.http from both ribbon.httpclient and ribbon.core
Error:java: module spring.cloud.commons reads package com.netflix.loadbalancer from both ribbon.httpclient and ribbon.loadbalancer
Error:java: module spring.cloud.commons reads package com.netflix.client from both ribbon.core and ribbon.loadbalancer
Error:java: module spring.cloud.commons reads package org.xmlpull.v1 from both xmlpull and xpp3.min
Error:java: module spring.boot.autoconfigure reads package com.netflix.client.http from both ribbon.httpclient and ribbon.core
Error:java: module spring.boot.autoconfigure reads package com.netflix.loadbalancer from both ribbon.httpclient and ribbon.loadbalancer
Error:java: module spring.boot.autoconfigure reads package com.netflix.client from both ribbon.core and ribbon.loadbalancer
Error:java: module spring.boot.autoconfigure reads package org.xmlpull.v1 from both xmlpull and xpp3.min
Error:java: module spring.boot.starter.web reads package com.netflix.client.http from both ribbon.httpclient and ribbon.core
Error:java: module spring.boot.starter.web reads package com.netflix.loadbalancer from both ribbon.httpclient and ribbon.loadbalancer
Error:java: module spring.boot.starter.web reads package com.netflix.client from both ribbon.core and ribbon.loadbalancer
Error:java: module spring.boot.starter.web reads package org.xmlpull.v1 from both xmlpull and xpp3.min
Error:java: module spring.boot.starter reads package com.netflix.client.http from both ribbon.httpclient and ribbon.core
Error:java: module spring.boot.starter reads package com.netflix.loadbalancer from both ribbon.httpclient and ribbon.loadbalancer
Error:java: module spring.boot.starter reads package com.netflix.client from both ribbon.core and ribbon.loadbalancer
Error:java: module spring.boot.starter reads package org.xmlpull.v1 from both xmlpull and xpp3.min
Error:java: module spring.boot.starter.logging reads package com.netflix.client.http from both ribbon.httpclient and ribbon.core
Error:java: module spring.boot.starter.logging reads package com.netflix.loadbalancer from both ribbon.httpclient and ribbon.loadbalancer
Error:java: module spring.boot.starter.logging reads package com.netflix.client from both ribbon.core and ribbon.loadbalancer
Error:java: module spring.boot.starter.logging reads package org.xmlpull.v1 from both xmlpull and xpp3.min
Error:java: module logback.classic reads package com.netflix.client.http from both ribbon.httpclient and ribbon.core
Error:java: module logback.classic reads package com.netflix.loadbalancer from both ribbon.httpclient and ribbon.loadbalancer
Error:java: module logback.classic reads package com.netflix.client from both ribbon.core and ribbon.loadbalancer
Error:java: module logback.classic reads package org.xmlpull.v1 from both xmlpull and xpp3.min
Error:java: module logback.core reads package com.netflix.client.http from both ribbon.httpclient and ribbon.core
Error:java: module logback.core reads package com.netflix.loadbalancer from both ribbon.httpclient and ribbon.loadbalancer
Error:java: module logback.core reads package com.netflix.client from both ribbon.core and ribbon.loadbalancer
Error:java: module logback.core reads package org.xmlpull.v1 from both xmlpull and xpp3.min
Error:java: module org.apache.logging.slf4j reads package com.netflix.client.http from both ribbon.httpclient and ribbon.core
Error:java: module org.apache.logging.slf4j reads package com.netflix.loadbalancer from both ribbon.httpclient and ribbon.loadbalancer
Error:java: module org.apache.logging.slf4j reads package com.netflix.client from both ribbon.core and ribbon.loadbalancer
Error:java: module org.apache.logging.slf4j reads package org.xmlpull.v1 from both xmlpull and xpp3.min
Error:java: module jul.to.slf4j reads package com.netflix.client.http from both ribbon.httpclient and ribbon.core
Error:java: module jul.to.slf4j reads package com.netflix.loadbalancer from both ribbon.httpclient and ribbon.loadbalancer
Error:java: module jul.to.slf4j reads package com.netflix.client from both ribbon.core and ribbon.loadbalancer
Error:java: module jul.to.slf4j reads package org.xmlpull.v1 from both xmlpull and xpp3.min
Error:java: module java.annotation reads package com.netflix.client.http from both ribbon.httpclient and ribbon.core
Error:java: module java.annotation reads package com.netflix.loadbalancer from both ribbon.httpclient and ribbon.loadbalancer
Error:java: module java.annotation reads package com.netflix.client from both ribbon.core and ribbon.loadbalancer
Error:java: module java.annotation reads package org.xmlpull.v1 from both xmlpull and xpp3.min
Error:java: module spring.boot.starter.json reads package com.netflix.client.http from both ribbon.httpclient and ribbon.core
Error:java: module spring.boot.starter.json reads package com.netflix.loadbalancer from both ribbon.httpclient and ribbon.loadbalancer
Error:java: module spring.boot.starter.json reads package com.netflix.client from both ribbon.core and ribbon.loadbalancer
Error:java: module spring.boot.starter.json reads package org.xmlpull.v1 from both xmlpull and xpp3.min
Error:java: module com.fasterxml.jackson.databind reads package com.netflix.client.http from both ribbon.httpclient and ribbon.core
Error:java: module com.fasterxml.jackson.databind reads package com.netflix.loadbalancer from both ribbon.httpclient and ribbon.loadbalancer
Error:java: module com.fasterxml.jackson.databind reads package com.netflix.client from both ribbon.core and ribbon.loadbalancer
Error:java: module com.fasterxml.jackson.databind reads package org.xmlpull.v1 from both xmlpull and xpp3.min
Error:java: module com.fasterxml.jackson.datatype.jdk8 reads package com.netflix.client.http from both ribbon.httpclient and ribbon.core
Error:java: module com.fasterxml.jackson.datatype.jdk8 reads package com.netflix.loadbalancer from both ribbon.httpclient and ribbon.loadbalancer
Error:java: module com.fasterxml.jackson.datatype.jdk8 reads package com.netflix.client from both ribbon.core and ribbon.loadbalancer
Error:java: module com.fasterxml.jackson.datatype.jdk8 reads package org.xmlpull.v1 from both xmlpull and xpp3.min
Error:java: module com.fasterxml.jackson.datatype.jsr310 reads package com.netflix.client.http from both ribbon.httpclient and ribbon.core
Error:java: module com.fasterxml.jackson.datatype.jsr310 reads package com.netflix.loadbalancer from both ribbon.httpclient and ribbon.loadbalancer
Error:java: module com.fasterxml.jackson.datatype.jsr310 reads package com.netflix.client from both ribbon.core and ribbon.loadbalancer
Error:java: module com.fasterxml.jackson.datatype.jsr310 reads package org.xmlpull.v1 from both xmlpull and xpp3.min
Error:java: module com.fasterxml.jackson.module.paramnames reads package com.netflix.client.http from both ribbon.httpclient and ribbon.core
Error:java: module com.fasterxml.jackson.module.paramnames reads package com.netflix.loadbalancer from both ribbon.httpclient and ribbon.loadbalancer
Error:java: module com.fasterxml.jackson.module.paramnames reads package com.netflix.client from both ribbon.core and ribbon.loadbalancer
Error:java: module com.fasterxml.jackson.module.paramnames reads package org.xmlpull.v1 from both xmlpull and xpp3.min
Error:java: module spring.boot.starter.tomcat reads package com.netflix.client.http from both ribbon.httpclient and ribbon.core
Error:java: module spring.boot.starter.tomcat reads package com.netflix.loadbalancer from both ribbon.httpclient and ribbon.loadbalancer
Error:java: module spring.boot.starter.tomcat reads package com.netflix.client from both ribbon.core and ribbon.loadbalancer
Error:java: module spring.boot.starter.tomcat reads package org.xmlpull.v1 from both xmlpull and xpp3.min
Error:java: module tomcat.embed.core reads package com.netflix.client.http from both ribbon.httpclient and ribbon.core
Error:java: module tomcat.embed.core reads package com.netflix.loadbalancer from both ribbon.httpclient and ribbon.loadbalancer
Error:java: module tomcat.embed.core reads package com.netflix.client from both ribbon.core and ribbon.loadbalancer
Error:java: module tomcat.embed.core reads package org.xmlpull.v1 from both xmlpull and xpp3.min
Error:java: module tomcat.embed.el reads package com.netflix.client.http from both ribbon.httpclient and ribbon.core
Error:java: module tomcat.embed.el reads package com.netflix.loadbalancer from both ribbon.httpclient and ribbon.loadbalancer
Error:java: module tomcat.embed.el reads package com.netflix.client from both ribbon.core and ribbon.loadbalancer
Error:java: module tomcat.embed.el reads package org.xmlpull.v1 from both xmlpull and xpp3.min
Error:java: module tomcat.embed.websocket reads package com.netflix.client.http from both ribbon.httpclient and ribbon.core
Error:java: module tomcat.embed.websocket reads package com.netflix.loadbalancer from both ribbon.httpclient and ribbon.loadbalancer
Error:java: module tomcat.embed.websocket reads package com.netflix.client from both ribbon.core and ribbon.loadbalancer
Error:java: module tomcat.embed.websocket reads package org.xmlpull.v1 from both xmlpull and xpp3.min
Error:java: module org.hibernate.validator reads package com.netflix.client.http from both ribbon.httpclient and ribbon.core
Error:java: module org.hibernate.validator reads package com.netflix.loadbalancer from both ribbon.httpclient and ribbon.loadbalancer
Error:java: module org.hibernate.validator reads package com.netflix.client from both ribbon.core and ribbon.loadbalancer
Error:java: module org.hibernate.validator reads package org.xmlpull.v1 from both xmlpull and xpp3.min
Error:java: module java.validation reads package com.netflix.client.http from both ribbon.httpclient and ribbon.core
Error:java: module java.validation reads package com.netflix.loadbalancer from both ribbon.httpclient and ribbon.loadbalancer
Error:java: module java.validation reads package com.netflix.client from both ribbon.core and ribbon.loadbalancer
Error:java: module java.validation reads package org.xmlpull.v1 from both xmlpull and xpp3.min
Error:java: module org.jboss.logging reads package com.netflix.client.http from both ribbon.httpclient and ribbon.core
Error:java: module org.jboss.logging reads package com.netflix.loadbalancer from both ribbon.httpclient and ribbon.loadbalancer
Error:java: module org.jboss.logging reads package com.netflix.client from both ribbon.core and ribbon.loadbalancer
Error:java: module org.jboss.logging reads package org.xmlpull.v1 from both xmlpull and xpp3.min
Error:java: module com.fasterxml.classmate reads package com.netflix.client.http from both ribbon.httpclient and ribbon.core
Error:java: module com.fasterxml.classmate reads package com.netflix.loadbalancer from both ribbon.httpclient and ribbon.loadbalancer
Error:java: module com.fasterxml.classmate reads package com.netflix.client from both ribbon.core and ribbon.loadbalancer
Error:java: module com.fasterxml.classmate reads package org.xmlpull.v1 from both xmlpull and xpp3.min
下面是我创建的模块
module naming.server.poc.composite {
requires spring.web;
requires spring.boot.autoconfigure;
requires spring.cloud.commons;
requires spring.boot;
requires java.xml.bind;
requires java.activation;
}
Spring启动入门类
@SpringBootApplication
@EnableDiscoveryClient
public class NamingServerPocApplication {
public static void main(String[] args) {
SpringApplication.run(NamingServerPocApplication.class, args);
}
}
mvn文件内容
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<version>2.1</version>
</dependency>
<!-- https://mvnrepository.com/artifact/javax.xml.bind/jaxb-api -->
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<version>2.3.0</version>
</dependency>
<dependency>
<groupId>com.sun.activation</groupId>
<artifactId>javax.activation</artifactId>
<version>1.2.0</version>
</dependency>
</dependencies>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-dependencies</artifactId>
<version>${spring-cloud.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
我在互联网上的其他文章中对此进行了搜索。但是我无法解决这个问题。谁能帮我解决这个问题!