创建storagemanager客户端时,获取“java.lang.nosuchmethoderror:reactor.netty.http.client.httpclient.doafterresponsesuccess”

5lhxktic  于 2021-07-14  发布在  Java
关注(0)|答案(1)|浏览(870)

代码段:

profile = new AzureProfile(tenantId, subId, AzureEnvironment.AZURE);

    credential =
        new ClientSecretCredentialBuilder()
            .clientId(clientId)
            .clientSecret(clientSecret)
            .authorityHost(profile.getEnvironment().getActiveDirectoryEndpoint())
            .tenantId(tenantId)
            .build();

    manager = StorageManager.authenticate(credential, profile);

使用的依赖项:

compile group: 'com.azure', name: 'azure-core-management', version: '1.1.0'
    compile group: 'com.azure', name: 'azure-identity', version: '1.2.2'
    compile group: 'com.azure.resourcemanager', name: 'azure-resourcemanager-storage', version: '2.1.0'
    compile group: 'io.projectreactor', name: 'reactor-core', version: '3.4.2'
    compile 'com.squareup.okhttp3:okhttp:3.13.1'
    compile 'com.squareup.okio:okio:1.13.0'
    compile group: 'com.microsoft.azure', name: 'adal4j', version: '1.6.6'
  compile group: 'com.microsoft.azure', name: 'azure-client-authentication', version: '1.4.0'

spring version : 2.1.18.RELEASE

创建storagemanager示例时,出现以下错误:

java.lang.NoSuchMethodError: reactor.netty.http.client.HttpClient.doAfterResponseSuccess(Ljava/util/function/BiConsumer;)Lreactor/netty/http/client/HttpClient;
    at com.azure.core.http.netty.NettyAsyncHttpClientBuilder.build(NettyAsyncHttpClientBuilder.java:101) ~[azure-core-http-netty-1.7.1.jar!/:?]
    at com.azure.core.http.netty.implementation.ReactorNettyClientProvider.createInstance(ReactorNettyClientProvider.java:14) ~[azure-core-http-netty-1.7.1.jar!/:?]
    at com.azure.core.implementation.http.HttpClientProviders.createInstance(HttpClientProviders.java:39) ~[azure-core-1.12.0.jar!/:?]
    at com.azure.core.http.HttpClient.createDefault(HttpClient.java:39) ~[azure-core-1.12.0.jar!/:?]
    at com.azure.core.http.HttpPipelineBuilder.build(HttpPipelineBuilder.java:60) ~[azure-core-1.12.0.jar!/:?]
    at com.azure.resourcemanager.resources.fluentcore.utils.HttpPipelineProvider.buildHttpPipeline(HttpPipelineProvider.java:85) ~[azure-resourcemanager-resources-2.1.0.jar!/:2.1.0]
    at com.azure.resourcemanager.resources.fluentcore.utils.HttpPipelineProvider.buildHttpPipeline(HttpPipelineProvider.java:45) ~[azure-resourcemanager-resources-2.1.0.jar!/:2.1.0]
    at com.azure.resourcemanager.storage.StorageManager.authenticate(StorageManager.java:55) ~[azure-resourcemanager-storage-2.1.0.jar!/:2.1.0]

当从本地机器上运行相同的代码时,它工作正常,但是当应用程序部署时,它给出了这个错误,如何解决这个问题??

dhxwm5r4

dhxwm5r41#

此代码似乎没有问题,您可以检查以下几点:
1.检查程序所需的包是否已正确部署,包含的版本是否正确。
2.部署后,包之间是否有冲突。
解决方案:
您可以尝试删除已部署的代码并重新部署它。部署过程中可能会出现一些错误。

相关问题