I am using the below code to generating the ByteStream from the SasUrl of Azure storage
ConnectionProvider connectionProvider =
ConnectionProvider.builder("custom-connection-provider")
.maxConnections(200)
.pendingAcquireMaxCount(5000)
.build();
BlobClient blobClient = new BlobClientBuilder()
.endpoint(searchMultipleWrapper.getSasUrl().trim()) // IT IS MY VALID SAS URL
.httpClient(new NettyAsyncHttpClientBuilder()
.connectionProvider(connectionProvider)
.readTimeout(Duration.ofMinutes(10))
.writeTimeout(Duration.ofMinutes(10))
.responseTimeout(Duration.ofMinutes(10))
.build())
.retryOptions(new RequestRetryOptions(
RetryPolicyType.EXPONENTIAL,
5,
2,
null,
null,
null
))
.buildClient();
log.info("BlobClient Object check {} ", blobClient);
// Use try-with-resources to ensure InputStream is closed
try (InputStream inputStream = blobClient.openInputStream();
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream()) {
// Transfer data from InputStream to ByteArrayOutputStream
inputStream.transferTo(byteArrayOutputStream);
// Convert to Base64
byte[] imageBytes = byteArrayOutputStream.toByteArray();
String base64Image = Base64.getEncoder().encodeToString(imageBytes);
log.info("Base 64 : {} ", base64Image);
// Log the Base64 string (truncated for safety)
log.info("Base64 Image (truncated): " + base64Image.substring(0, Math.min(base64Image.length(), 100)) + "...");
} catch (Exception e) {
log.error("Error while processing blob content", e);
}
Exception which i am getting as below :-
stack_trace":"reactor.core.Exceptions$ReactiveException: io.netty.channel.StacklessClosedChannelException\n\tat
Heading ##reactor.core.Exceptions.propagate(Exceptions.java:410)\n\tat
reactor.core.publisher.BlockingSingleSubscriber.blockingGet(BlockingSingleSubscriber.java:102)\n\tat reactor.core.publisher.Mono.block(Mono.java:1779)\n\tat com.azure.storage.blob.specialized.BlobClientBase.openInputStream(BlobClientBase.java:393)\n\tat com.azure.storage.blob.specialized.BlobClientBase.openInputStream(BlobClientBase.java:323)\n\tat com.azure.storage.blob.specialized.BlobClientBase.openInputStream(BlobClientBase.java:312)\n\tat com.azure.storage.blob.specialized.BlobClientBase.openInputStream(BlobClientBase.java:299)\n
I think it is the versioning issue which has the bug on the Window system. Please check the reference of this one Click here
Please help me to short out from this problem
As i have mentioned in the question that it might be an open issue from the dependency side
I have used the below dependency which works perfectly previously i was using the azure-storage-blob
artifactId which was casing the above-mentioned issue.
<dependency>
<groupId>com.azure</groupId>
<artifactId>azure-core-http-okhttp</artifactId>
<version>1.12.0</version>
</dependency>