reactor/netty/resources/ConnectionProvider.fixed(Ljava/lang/String;IJLjava/time/Duration;)Lreactor/netty/resources/ConnectionProvider;

Viewed 2608

spring boot application starts up fails with Azure cosmos DB

Description:

An attempt was made to call a method that does not exist. The attempt was made from the following location:

com.azure.cosmos.implementation.http.HttpClient.createFixed(HttpClient.java:56)

The following method did not exist:

reactor.netty.resources.ConnectionProvider.fixed(Ljava/lang/String;IJLjava/time/Duration;)Lreactor/netty/resources/ConnectionProvider;

The method's class, reactor.netty.resources.ConnectionProvider, is available from the following locations:

jar:file:/Users/vishnuvuyyur/.m2/repository/io/projectreactor/netty/reactor-netty-core/1.0.1/reactor-netty-core-1.0.1.jar!/reactor/netty/resources/ConnectionProvider.class

The class hierarchy was loaded from the following locations:

reactor.netty.resources.ConnectionProvider: file:/Users/vishnuvuyyur/.m2/repository/io/projectreactor/netty/reactor-netty-core/1.0.1/reactor-netty-core-1.0.1.jar
3 Answers

Reason for the error:

  • As in the logs it states :com.azure.cosmos.implementation.http.HttpClient.createFixed(HttpClient.java:56)

  • The azure cosmos library is not updated with the latest spring boot version

  • Current issue can be reproduced with spring-boot 2.4.0 and azure cosmos db 3.0.0-beta.1

    <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.3.3.RELEASE</version>
    
     <dependency>
          <groupId>com.microsoft.azure</groupId>
          <artifactId>azure-cosmosdb-spring-boot-starter</artifactId>
      <version>3.0.0-beta.1</version> 
    
  • Fix, lower the spiring boot version to 2.3.5 since azure db version 3.0.0-beta.1 dosen't support spring 2.4.0

Changing the spring boot version worked for me

<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>2.3.4.RELEASE</version>
    <relativePath/> 
</parent>

I've solved using java 11, i created webflux from intellij for reactive microservices.

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
     xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>2.4.5</version>
    <relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.api.bank.salesforce</groupId>
<artifactId>sbs</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>sbs</name>
<description>Demo project for Spring Boot</description>
<properties>
    <java.version>11</java.version>
</properties>
<dependencies>
    <dependency>
        <groupId>com.microsoft.azure</groupId>
        <artifactId>spring-data-cosmosdb</artifactId>
        <version>2.3.0</version>
    </dependency>
    <dependency>
        <groupId>com.azure</groupId>
        <artifactId>azure-core</artifactId>
        <version>1.10.0</version>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-web</artifactId>
    </dependency>

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

    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-context</artifactId>
    </dependency>
    <dependency>
        <groupId>io.swagger</groupId>
        <artifactId>swagger-annotations</artifactId>
        <version>1.5.21</version>
    </dependency>
    <dependency>
        <groupId>io.swagger</groupId>
        <artifactId>swagger-models</artifactId>
        <version>1.6.0</version>
    </dependency>
    <dependency>
        <groupId>com.fasterxml.jackson.core</groupId>
        <artifactId>jackson-annotations</artifactId>
        <version>2.10.3</version>
    </dependency>
    <dependency>
        <groupId>javax.validation</groupId>
        <artifactId>validation-api</artifactId>
    </dependency>
    <dependency>
        <groupId>org.threeten</groupId>
        <artifactId>threetenbp</artifactId>
        <version>1.5.0</version>
    </dependency>
</dependencies>

<dependencyManagement>
    <dependencies>
        <dependency>
            <groupId>io.projectreactor.netty</groupId>
            <artifactId>reactor-netty</artifactId>
            <version>0.9.2.RELEASE</version>
        </dependency>
    </dependencies>
</dependencyManagement>

<build>
    <plugins>
        <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
        </plugin>
        <plugin>
            <groupId>io.swagger.codegen.v3</groupId>
            <artifactId>swagger-codegen-maven-plugin</artifactId>
            <version>3.0.18</version>
            <executions>
                <execution>
                    <goals>
                        <goal>generate</goal>
                    </goals>
                    <configuration>
                        <inputSpec>${project.basedir}/src/main/resources/library-api.yaml</inputSpec>
                        <language>spring</language>
                        <output>${project.build.directory}/generated-sources/</output>
                        <generateSupportingFiles>false</generateSupportingFiles>
                        <apiPackage>com.api.bank.salesforce.sbs.api</apiPackage>
                        <modelPackage>com.api.bank.salesforce.sbs.models</modelPackage>
                        <configOptions>
                            <interfaceOnly>true</interfaceOnly>
                        </configOptions>
                    </configuration>
                </execution>
            </executions>
        </plugin>
    </plugins>
</build>
Related