Azure dependency conflict with Jackson: java.lang.LinkageError: Package versions

307 Views Asked by At

I'm having troubles with introducing azure storage sdk into my Java project. There apparently are conflicts between various Jackson dependencies versions, but the odd thing is that all the dependencies being imported are of the same, up-to-date version.

The azure dependencies:

<dependencyManagement>
    <dependencies>
      <dependency>
        <groupId>com.azure</groupId>
        <artifactId>azure-sdk-bom</artifactId>
        <version>1.2.14</version>
        <type>pom</type>
        <scope>import</scope>
      </dependency>
    </dependencies>
  </dependencyManagement>
<dependencies>
    <dependency>
        <groupId>com.azure</groupId>
        <artifactId>azure-storage-blob</artifactId>
    </dependency>
...
</dependencies>

The code that triggers the problem:

BlobServiceClient blobServiceClient = new BlobServiceClientBuilder()
                .connectionString(connectionString)
                .buildClient();
blobServiceClient.createBlobContainer("hello-world-" + UUID.randomUUID());

The problem:

ERROR [com.azure.core.implementation.jackson.ObjectMapperShim] (reactor-http-nio-1) Package versions: jackson-core=2.12.6, jackson-databind=2.12.6-1, jackson-dataformat-xml=2.15.2, jackson-datatype-jsr310=2.12.6, azure-core=1.40.0, Troubleshooting version conflicts: https://aka.ms/azsdk/java/dependency/troubleshoot
...
Caused by: java.lang.NoSuchMethodError: com.fasterxml.jackson.core.io.ContentReference com.fasterxml.jackson.core.io.IOContext.contentReference()'
    at deployment.psMobileServerAdminConsole-${acp.version}.war//com.fasterxml.jackson.dataformat.xml.deser.FromXmlParser.<init>(FromXmlParser.java:263)
    at deployment.psMobileServerAdminConsole-${acp.version}.war//com.fasterxml.jackson.dataformat.xml.XmlFactory._createParser(XmlFactory.java:653)
    at deployment.psMobileServerAdminConsole-${acp.version}.war//com.fasterxml.jackson.dataformat.xml.XmlFactory._createParser(XmlFactory.java:30)
    at [email protected]//com.fasterxml.jackson.core.JsonFactory.createParser(JsonFactory.java:1124)
    at [email protected]//com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:3643)

The odd thing is that I do not import these 2.12.6 dependencies explicitly or in transitive way - I only use 2.15.2

Jackson dependencies screenshot from IDE

Full dependency tree: https://github.com/lrd2/working/blob/main/dependency_tree.txt

So any idea what causes the conflict and how to resolve it?

1

There are 1 best solutions below

1
Piotr Kwiatkowski On

It was a WildFly server, to which I deployed the application, that caused the problem. It was overriding jackson dependencies configured in the app with predefined ones. After replacing them in WildFly configuration, the problem disappeared and the Azure SDK creates the blob container.