Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

spring cloud netflix jersey version conflict

Hello I have a Spring boot application that is using

    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-jersey</artifactId>
    </dependency>

This is dependent on Jersey version 2.7.

When trying to use

<dependency>
    <groupId>org.springframework.cloud</groupId>
    <artifactId>spring-cloud-starter-eureka</artifactId>
</dependency>

That internally uses Jersey version 1.1, the application fails given the two different versions of the same library.

Any advice in how to fix this issue, I have tried to use only the version 2.7 but they seems to be not compatible each-other

Thanks

java.lang.NoSuchMethodError: javax.ws.rs.core.Application.getProperties()Ljava/util/Map; at org.glassfish.jersey.server.ApplicationHandler.(ApplicationHandler.java:303) at org.glassfish.jersey.server.ApplicationHandler.(ApplicationHandler.java:284) at org.glassfish.jersey.servlet.WebComponent.(WebComponent.java:311) at org.glassfish.jersey.servlet.ServletContainer.init(ServletContainer.java:168) at org.glassfish.jersey.servlet.ServletContainer.init(ServletContainer.java:358) at javax.servlet.GenericServlet.init(GenericServlet.java:158) at io.undertow.servlet.core.LifecyleInterceptorInvocation.proceed(LifecyleInterceptorInvocation.java:117) at io.undertow.servlet.core.ManagedServlet$DefaultInstanceStrategy.start(ManagedServlet.java:220) at io.undertow.servlet.core.ManagedServlet.getServlet(ManagedServlet.java:163) at io.undertow.servlet.handlers.ServletHandler.handleRequest(ServletHandler.java:84) at io.undertow.servlet.handlers.FilterHandler.handleRequest(FilterHandler.java:82)

like image 635
user2818032 Avatar asked Oct 19 '22 13:10

user2818032


1 Answers

I have gotten the setup with Jersey 2 and Eureka client all through spring cloud to work by specifying the following:

    <plugin>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-maven-plugin</artifactId>
        <configuration>
            <excludes>
                <exclude>
                    <groupId>javax.ws.rs</groupId>
                    <artifactId>jsr311-api</artifactId>
                </exclude>
            </excludes>
        </configuration>
    </plugin>

The only problem though is that the tests are not running yet. But we are still trying to find a full solution to the problem.

like image 98
Thor's beard Avatar answered Oct 27 '22 23:10

Thor's beard