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):
"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"
Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @kushagraThapar, @anfeldma-ms
@chenrujun @saragluna - please take a look at this issue.
@AndreasVolkmann - the exception you are getting is because of a netty dependency issue. Please check for netty and reactor-netty dependency versions used in your project and provided by spring and azure-cosmos modules.
Hi, @AndreasVolkmann, could you please share your pom?
@chenrujun I am using gradle kotlin script.
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
plugins {
val kotlinVersion = "1.4.20"
id("org.springframework.boot") version "2.4.0"
id("io.spring.dependency-management") version "1.0.10.RELEASE"
kotlin("jvm") version kotlinVersion
kotlin("plugin.spring") version kotlinVersion
}
group = "me.avo"
version = "0.0.1-SNAPSHOT"
java.sourceCompatibility = JavaVersion.VERSION_1_8
repositories {
jcenter()
mavenCentral()
}
dependencies {
implementation("org.springframework.boot:spring-boot-starter")
implementation("org.springframework.boot:spring-boot-starter-aop")
implementation("org.jetbrains.kotlin:kotlin-reflect")
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8")
implementation("com.microsoft.azure:azure-cosmosdb-spring-boot-starter:2.3.5")
testImplementation("org.springframework.boot:spring-boot-starter-test") {
exclude(group = "org.junit.vintage", module = "junit-vintage-engine")
}
testImplementation("io.strikt:strikt-spring:0.28.0")
testImplementation("com.tngtech.archunit:archunit:0.14.1")
}
tasks.withType<Test> {
useJUnitPlatform()
}
tasks.withType<KotlinCompile> {
kotlinOptions {
freeCompilerArgs = listOf("-Xjsr305=strict", "-Xinline-classes")
jvmTarget = "1.8"
useIR = true
}
}
Hi, @AndreasVolkmann,
Thank you for your kotlin script.
I reproduced your problem.
And fixed the problem by following commit:
https://github.com/chenrujun/azure-sdk-for-java-issue17692/commit/af69d6d0561b173757a8607b2816bfae5125c53e
Could you please try it in your project?
spring-boot:2.4.0 just released, and we haven't support it for now.
Please wait our next release.
@chenrujun Thanks, it does work with older versions.
I am waiting for the next release.
cc: @yiliuTo . FYI.
@chenrujun after about a month ago of that finding https://github.com/Azure/azure-sdk-for-java/issues/17692#issuecomment-733402462
A new version has been released, spring data cosmos 3.3.0
Des it support any of the spring boot 2.4.0 or 2.4.2 versions?
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
Thanks for the update I took a look at that issue.
@chenrujun Do you have any estimated date to release a versi贸n supporting Spring Boot 2.4.x versions?
Thanks
@juliojgd
We will release version supporting spring-boot-2.4.x before 2021-03-31.
Closing this issue because azure-spring-boot-starter-cosmos:3.3.0 has been released. It supports spring-boot:2.4.3.
Most helpful comment
@juliojgd
We will release version supporting spring-boot-2.4.x before
2021-03-31.