0

I am trying to replicate a simple example in Scala from the Azure Storage Blob client library for Java - Version 12.14.2 documentation, but am only able to get java.nio.channels.ClosedChannelException.

I've double-checked the target blob ACLs and verified that the network firewall on the target storage account is off (no restrictions).

Here is the main code:

val configUrl = "https://<storage_account>.blob.core.windows.net/<container>/<path>/application.conf"
val cred = new AzureCliCredentialBuilder().build()

val blobClient = new BlobClientBuilder()
      .endpoint(configUrl)
      .credential(cred)
      .buildClient();

val blockBlobClient = blobClient.getBlockBlobClient
val content = blockBlobClient.downloadContent

The call to downloadContent is giving me this exception:

Exception in thread "main" reactor.core.Exceptions$ReactiveException: java.nio.channels.ClosedChannelException
    at reactor.core.Exceptions.propagate(Exceptions.java:392)
    at reactor.core.publisher.BlockingSingleSubscriber.blockingGet(BlockingSingleSubscriber.java:97)
    at reactor.core.publisher.Mono.block(Mono.java:1706)
    at com.azure.storage.common.implementation.StorageImplUtils.blockWithOptionalTimeout(StorageImplUtils.java:128)
    at com.azure.storage.blob.specialized.BlobClientBase.downloadContent(BlobClientBase.java:658)
    at com.....Main$.main(Main.scala:54)

I've tried using the Azure CLI credential as shown here, and storage account key credential. I've also tried working from a BlobServiceClient and BlobContainerClient, but get the same error.

Traber
  • 11
  • 2

1 Answers1

1

With help from the Azure Java SDK team, it turns out it was a broken dependency in the Azure Java SDK. Adding a dependency override in build.sbt fixed it for me:

dependencyOverrides += "io.netty" % "netty-all" % "4.1.70.Final"
Traber
  • 11
  • 2