1

I am little new to Java 9 modules and tried to build a web service using spring boot. I'm going to use DiscoveryClient in my web service and the service was created as multiple modules. When I tried to run my service using IntellijIdea and it gives me below errors. I'm using Spring boot 2.1.2 and 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

Below is my modules that I created

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 boot starter class

 @SpringBootApplication
@EnableDiscoveryClient
public class NamingServerPocApplication {

    public static void main(String[] args) {
        SpringApplication.run(NamingServerPocApplication.class, args);
    }

}

mvn file content

<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>

I have searched this in different articles in the internet. But I was unable to resolve this. Can anybody please help me to resolve this!

Kepler
  • 399
  • 1
  • 7
  • 19
  • I think there is the "same" dependency in two modules:`com.netflix.client.http from both ribbon.httpclient and ribbon.core` and than a conflict occurs. But my module knowledge is not good enough for good suggestions. Maybe this helps: https://stackoverflow.com/questions/42358084/package-conflicts-with-automatic-modules-in-java-9 – pL4Gu33 Feb 07 '19 at 17:32

0 Answers0