I am facing an error while trying to create a Azure blobConatinerClient using the credentials I have.
credentials is instanceOf StorageSharedKeyCredential and endpoint is instanceOf String
This is the code
public BlobContainerClient initBlobClient() {
BlobContainerClient blobContainerClient;
StorageSharedKeyCredential credential = new StorageSharedKeyCredential(ACCOUNT_NAME, ACCOUNT_KEY);
String endpoint = String.format(Locale.ROOT, "https://test.blob.core.windows.net");
// Getting the ClassDefError here
BlobServiceClient storageClient = new BlobServiceClientBuilder().endpoint(endpoint).credential(credential).buildClient();
blobContainerClient = storageClient.getBlobContainerClient(CONTAINTER_NAME);
return blobContainerClient;
}
and this is the stacktrace this triggers
at com.fasterxml.jackson.dataformat.xml.XmlMapper.<init>(XmlMapper.java:122)
at com.azure.core.util.serializer.JacksonAdapter.<init>(JacksonAdapter.java:76)
at com.azure.core.util.serializer.JacksonAdapter.createDefaultSerializerAdapter(JacksonAdapter.java:109)
at com.azure.core.http.rest.RestProxy.createDefaultSerializer(RestProxy.java:615)
at com.azure.core.http.rest.RestProxy.create(RestProxy.java:667)
at com.azure.storage.blob.implementation.ServicesImpl.<init>(ServicesImpl.java:58)
at com.azure.storage.blob.implementation.AzureBlobStorageImpl.<init>(AzureBlobStorageImpl.java:216)
at com.azure.storage.blob.implementation.AzureBlobStorageBuilder.build(AzureBlobStorageBuilder.java:93)
at com.azure.storage.blob.BlobServiceAsyncClient.<init>(BlobServiceAsyncClient.java:108)
at com.azure.storage.blob.BlobServiceClientBuilder.buildAsyncClient(BlobServiceClientBuilder.java:109)
at com.azure.storage.blob.BlobServiceClientBuilder.buildClient(BlobServiceClientBuilder.java:82)
And these are azure dependencies I have. I also added Jackson, since one of the StackOverflow comments said that would solve the issue but it didn't.
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
<version>2.12.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.azure/azure-storage-blob -->
<dependency>
<groupId>com.azure</groupId>
<artifactId>azure-storage-blob</artifactId>
<version>12.9.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.azure/azure-core -->
<dependency>
<groupId>com.azure</groupId>
<artifactId>azure-core</artifactId>
<version>1.3.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/io.projectreactor/reactor-core -->
<dependency>
<groupId>io.projectreactor</groupId>
<artifactId>reactor-core</artifactId>
<version>3.3.4.RELEASE</version>
</dependency>
<dependency>
<groupId>com.microsoft.azure</groupId>
<artifactId>azure-storage</artifactId>
<version>8.6.3</version>
</dependency>
<dependency>
<groupId>com.microsoft.azure</groupId>
<artifactId>azure</artifactId>
<version>1.33.0</version>
</dependency>
Can someone please point out if something is missing, Or if I have to change anything here?