Error set up Azure CosmosEmulator in Spring

694 Views Asked by At

I am following the steps in https://www.baeldung.com/spring-data-cosmos-db to connect my spring project to Azure cosmosDB Emulator

I have the emulator running locally enter image description here

However I am running in to

Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.azure.data.cosmos.CosmosClient]: Factory method 'cosmosClient' 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:/Users/yatman.wong/.m2/repository/io/projectreactor/netty/reactor-netty-core/1.0.15/reactor-netty-core-1.0.15.jar by jdk.internal.loader.ClassLoaders$AppClassLoader@b0c88fd9) called from interface com.azure.data.cosmos.internal.http.HttpClient (loaded from file:/Users/yatman.wong/.m2/repository/com/microsoft/azure/azure-cosmos/3.7.3/azure-cosmos-3.7.3.jar by jdk.internal.loader.ClassLoaders$AppClassLoader@b0c88fd9).
    at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:185)
    at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:653)

Looks like some internal dependency issue with this azure dependency

<dependency> 
    <groupId>com.microsoft.azure</groupId> 
    <artifactId>spring-data-cosmosdb</artifactId> 
    <version>2.3.0</version> 
</dependency>

I have set up a bug demo project in https://github.com/yatw/SpringCosmosEmulator with full stack trace

Please give me an explanation, thank you!

0

There are 0 best solutions below