azure-sdk-for-java icon indicating copy to clipboard operation
azure-sdk-for-java copied to clipboard

NoClassDefFoundError in azure-keyvault-secrets-spring-boot-starter:2.3.5 about reactor

Open shweta5595 opened this issue 1 year ago • 1 comments

Query/Question I am currently using this dependency in my pom.xml and accessing secrets from Key-vault using property value annotation.

                <dependency>
                        <artifactId>azure-keyvault-secrets-spring-boot-starter</artifactId>
                        <groupId>com.microsoft.azure</groupId>
                        <version>2.3.5</version>
                 </dependency>

But i am getting this exception java.lang.BootstrapMethodError: java.lang.NoClassDefFoundError: reactor/netty/tcp/ProxyProvider$TypeSpec 19:18:01 at com.azure.core.http.netty.NettyAsyncHttpClientBuilder.lambda$build$7(NettyAsyncHttpClientBuilder.java:139) 19:18:01 at reactor.netty.http.client.HttpClient.tcpConfiguration(HttpClient.java:1493) 19:18:01 at com.azure.core.http.netty.NettyAsyncHttpClientBuilder.build(NettyAsyncHttpClientBuilder.java:121) 19:18:01 at com.azure.core.http.netty.implementation.ReactorNettyClientProvider.createInstance(ReactorNettyClientProvider.java:14) 19:18:01 at com.azure.core.implementation.http.HttpClientProviders.createInstance(HttpClientProviders.java:37) 19:18:01 at com.azure.core.http.HttpClient.createDefault(HttpClient.java:27) 19:18:01 at com.azure.core.http.HttpPipelineBuilder.build(HttpPipelineBuilder.java:60) 19:18:01 at com.azure.security.keyvault.secrets.SecretClientBuilder.buildAsyncClient(SecretClientBuilder.java:161) 19:18:01 at com.azure.security.keyvault.secrets.SecretClientBuilder.buildClient(SecretClientBuilder.java:104) 19:18:01 at com.microsoft.azure.keyvault.spring.KeyVaultEnvironmentPostProcessorHelper.addKeyVaultPropertySource(KeyVaultEnvironmentPostProcessorHelper.java:83) 19:18:01 at com.microsoft.azure.keyvault.spring.KeyVaultEnvironmentPostProcessor.postProcessEnvironment(KeyVaultEnvironmentPostProcessor.java:47) 19:18:01 at org.springframework.boot.env.EnvironmentPostProcessorApplicationListener.onApplicationEnvironmentPreparedEvent(EnvironmentPostProcessorApplicationListener.java:102) 19:18:01 at org.springframework.boot.env.EnvironmentPostProcessorApplicationListener.onApplicationEvent(EnvironmentPostProcessorApplicationListener.java:87) 19:18:01 at org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:176) 19:18:01 at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:169) 19:18:01 at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:143) 19:18:01 at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:131) 19:18:01 at org.springframework.boot.context.event.EventPublishingRunListener.environmentPrepared(EventPublishingRunListener.java:82) 19:18:01 at org.springframework.boot.SpringApplicationRunListeners.lambda$environmentPrepared$2(SpringApplicationRunListeners.java:63) 19:18:01 Caused by: java.lang.NoClassDefFoundError: reactor/netty/tcp/ProxyProvider$TypeSpec 19:18:01 ... 77 common frames omitted 19:18:01 Caused by: java.lang.ClassNotFoundException: reactor.netty.tcp.ProxyProvider$TypeSpec 19:18:01 at java.net.URLClassLoader.findClass(URLClassLoader.java:381) 19:18:01 at java.lang.ClassLoader.loadClass(ClassLoader.java:424) 19:18:01 at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:338) 19:18:01 at java.lang.ClassLoader.loadClass(ClassLoader.java:357) 19:18:01 ... 77 common frames omitted

Setup

  • OS: iOS
  • IDE: IntelliJ
  • Library/Libraries: com.microsoft.azure:azure-keyvault-secrets-spring-boot-starter:2.3.5

shweta5595 avatar Aug 12 '22 16:08 shweta5595

Using Spring Boot version 2.5.12

<artifactId>spring-boot-starter-parent</artifactId>
<groupId>org.springframework.boot</groupId>
<version>2.5.12</version> 

shweta5595 avatar Aug 12 '22 16:08 shweta5595

Hi @shweta5595 , thanks for your reaching out! The azure-keyvault-secrets-spring-boot-starter:2.3.5 has already ended support, could you upgrade to the latest version 4.3.0 ? Or you can refer to here to find the latest version suitable for you.

moarychan avatar Aug 15 '22 02:08 moarychan

Hi @moarychan , We are using this dependency in our project azure-keyvault-secrets-spring-boot-starter:2.3.5 , upgrading to the spring-cloud variant , would incur a lot of structural changes . As we have cosmos dependency also in our project without spring-cloud. Earlier we were using azure-keyvault-secrets-spring-boot-starter:2.3.0 version which worked fine without the above mentioned error. But due to security concerns we wanted it to upgrade to 2.3.5 . Could you please help with the same.

shweta5595 avatar Aug 15 '22 08:08 shweta5595

Hi @shweta5595 , thanks for your update! Is azure-cosmosdb-spring-boot-starter also the same version 2.3.5? We would like to hear about your concerns, which may help us improve subsequent migration documentation.

Could you please provide more info with the below questions for us?

  • What major changes do you need to make to upgrade to the latest version? Would it be better to upgrade to version 3.x (such as 3.14.0)?
  • Are there any special considerations for not upgrading a version?

moarychan avatar Aug 16 '22 04:08 moarychan

Hi @moarychan ,

  1. Earlier when we used spring-webflux along with azure-keyvault-secrets-spring-boot-starter:2.3.0 which worked fine and we were able to retrieve secrets from key vault.

  2. Due to security concerns we want it to upgrade it to azure-keyvault-secrets-spring-boot-starter:2.3.5 along with spring-webflux. But we are facing the above mentioned issue.

  3. We are not upgrading it to spring-cloud-azure-starter-keyvault-secrets:4.3.0 as we are not sure that this would also work well with reactive spring i.e spring-webflux . And also this will incur some amount of code changes which we do not want to do right now , as we are already live in production.

  4. Not using 3.14.0 version or above , because we are using the configs in a certain way which is again rewriting the piece again. So to refrain from that we are looking for an alternative that will allow us to use 2.3.5 version , which I know is migrated now.

I am looking out for some solution that will help azure-keyvault-secrets-spring-boot-starter:2.3.5 this version work and we dont face the above mentioned issue.

shweta5595 avatar Aug 16 '22 06:08 shweta5595

Hi @shweta5595 , thanks for your update!

I can reproduce your exception, and I try to downgrade the dependencies, such as reactor, netty, reactory-netty, but will occur new issues when listing the secrets from Azure KV. In fact, this modification may bring unpredictable problems, because it's not compatible with the current Spring Boot.

I notice you are using Spring Boot 2.5.12, this version is compatible with com.azure.spring:azure-spring-boot-starter-keyvault-secrets:3.14.0, and after testing, works fine. Please evaluate this update to resolve the issue you are experiencing, you can find this test project here.

moarychan avatar Aug 17 '22 07:08 moarychan

Hi @moarychan , Thankyou so much !! I was able to proceed.

shweta5595 avatar Aug 18 '22 03:08 shweta5595