azure-sdk-for-java: [BUG] Cosmos starter - exception with 2.4.0

Describe the bug When starting up with the cosmos starter and one simple repository, it fails with the following exception.

Exception or Stack Trace

2020-11-19 21:31:47.805  WARN 5716 --- [           main] s.c.a.AnnotationConfigApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'run' defined in me.avo.cosmos.CosmosApplication: Unsatisfied dependency expressed through method 'run' parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'notificationRepository': Unsatisfied dependency expressed through method 'setCosmosOperations' parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'cosmosTemplate' defined in class path resource [com/microsoft/azure/spring/autoconfigure/cosmosdb/CosmosAutoConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.microsoft.azure.spring.data.cosmosdb.core.CosmosTemplate]: Factory method 'cosmosTemplate' threw exception; nested exception is java.lang.NoSuchMethodError: reactor/netty/resources/ConnectionProvider.fixed(Ljava/lang/String;IJLjava/time/Duration;)Lreactor/netty/resources/ConnectionProvider; (loaded from file:/C:/Users/anvolkma/.gradle/caches/modules-2/files-2.1/io.projectreactor.netty/reactor-netty-core/1.0.1/d3b6861cd9cd8b1e3387f14d80eb9c6724fd052b/reactor-netty-core-1.0.1.jar by jdk.internal.loader.ClassLoaders$AppClassLoader@1bff1c41) called from interface com.azure.data.cosmos.internal.http.HttpClient (loaded from file:/C:/Users/anvolkma/.gradle/caches/modules-2/files-2.1/com.microsoft.azure/azure-cosmos/3.7.3/b82f7d25a9badb5e27942c92f7bc400484076d3d/azure-cosmos-3.7.3.jar by jdk.internal.loader.ClassLoaders$AppClassLoader@1bff1c41).
2020-11-19 21:31:47.823  INFO 5716 --- [           main] ConditionEvaluationReportLoggingListener : 

Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2020-11-19 21:31:47.854 ERROR 5716 --- [           main] o.s.b.d.LoggingFailureAnalysisReporter   : 

***************************
APPLICATION FAILED TO START
***************************

Description:

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

    com.azure.data.cosmos.internal.http.HttpClient.createFixed(HttpClient.java:47)

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:/C:/Users/anvolkma/.gradle/caches/modules-2/files-2.1/io.projectreactor.netty/reactor-netty-core/1.0.1/d3b6861cd9cd8b1e3387f14d80eb9c6724fd052b/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:/C:/Users/anvolkma/.gradle/caches/modules-2/files-2.1/io.projectreactor.netty/reactor-netty-core/1.0.1/d3b6861cd9cd8b1e3387f14d80eb9c6724fd052b/reactor-netty-core-1.0.1.jar


Action:

Correct the classpath of your application so that it contains a single, compatible version of reactor.netty.resources.ConnectionProvider

To Reproduce Steps to reproduce the behavior: Run a simple sample with spring boot 2.4.0

Code Snippet

@SpringBootApplication
class CosmosApplication {

    @Bean fun run(notificationRepository: NotificationRepository) = CommandLineRunner {
        val notification = Notification("Test", "Test")
        notificationRepository.save(notification)
    }

}

fun main(args: Array<String>) {
	runApplication<CosmosApplication>(*args)
}

Expected behavior Should start without issues.

Setup (please complete the following information):

  • OS: Windows
  • IDE : IntelliJ
  • Version of the Library used "com.microsoft.azure:azure-cosmosdb-spring-boot-starter:2.3.5"

Additional context The version shown on the project page does not exist: "com.azure.spring:azure-spring-boot-starter-cosmos:3.0.0-beta.1"

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 4
  • Comments: 17 (9 by maintainers)

Commits related to this issue

Most upvoted comments

@juliojgd We will release version supporting spring-boot-2.4.x before 2021-03-31.

@chenrujun Do you have any estimated date to release a versión supporting Spring Boot 2.4.x versions? Thanks

Hi, @RUBenGAMArrarodRiguEZ-ToMtOm

Sorry that now it does NOT support spring boot 2.4.0 or 2.4.2 versions. Because we have some problem in this PR: https://github.com/Azure/azure-sdk-for-java/pull/17905

@chenrujun Thanks, it does work with older versions. I am waiting for the next release.