Uploaded image for project: 'Tika'
  1. Tika
  2. TIKA-3817

Azure Graph conflict with Tika-app on (JsonGenerator) jackson version 2.13.3 - bug changes version to 2.4.1 (Tika's version)

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Cannot Reproduce
    • 2.4.1
    • None
    • app
    • Java 1.8, Maven Project, tika-app 2.4.1, jackson 2.13.3, azure-core 1.30.0

    • Important

    Description

      Azure Graph conflict on jackson.

      Both Tika-app 2.4.1 and Azure-core 1.30.0 use jars with classes of the same name JsonGenerator (com.fasterxml.jackson.core.JsonGenerator) when fetching the jackson version, of which jackson-core 2.13.3 is desired and set in the pom. This results in version conflict - where tika changes the jackson version from the desired 2.13.3 to tika's version 2.4.1, which doesn't even exist for jackson and would be far too old a version of jackson.

       

      ERROR [main] 12:03:19,483 com.azure.core.implementation.jackson.JacksonVersion Version '2.4.1' of package 'jackson-annotations' is not supported (older than earliest supported version - `2.10.0`), please upgrade.
      ERROR [main] 12:03:19,489 com.azure.core.implementation.jackson.JacksonVersion Version '2.4.1' of package 'jackson-core' is not supported (older than earliest supported version - `2.10.0`), please upgrade.
      ERROR [main] 12:03:19,489 com.azure.core.implementation.jackson.JacksonVersion Version '2.4.1' of package 'jackson-databind' is not supported (older than earliest supported version - `2.10.0`), please upgrade.
      INFO  [main] 12:03:19,491 com.azure.core.implementation.jackson.JacksonVersion Package versions: jackson-annotations=2.4.1, jackson-core=2.4.1, jackson-databind=2.4.1, jackson-dataformat-xml=unknown, jackson-datatype-jsr310=2.13.3, azure-core=1.30.0, Troubleshooting version conflicts: https://aka.ms/azsdk/java/dependency/troubleshoot
      ERROR [main] 12:03:19,494 com.azure.core.implementation.jackson.ObjectMapperShim Package versions: jackson-annotations=2.4.1, jackson-core=2.4.1, jackson-databind=2.4.1, jackson-dataformat-xml=unknown, jackson-datatype-jsr310=2.13.3, azure-core=1.30.0, Troubleshooting version conflicts: https://aka.ms/azsdk/java/dependency/troubleshoot
      Exception in thread "main" java.lang.LinkageError: Package versions: jackson-annotations=2.4.1, jackson-core=2.4.1, jackson-databind=2.4.1, jackson-dataformat-xml=unknown, jackson-datatype-jsr310=2.13.3, azure-core=1.30.0, Troubleshooting version conflicts: https://aka.ms/azsdk/java/dependency/troubleshoot
          at com.azure.core.implementation.jackson.ObjectMapperShim.createHeaderMapper(ObjectMapperShim.java:138)
          at com.azure.core.util.serializer.JacksonAdapter.<init>(JacksonAdapter.java:81)
          at com.azure.core.util.serializer.JacksonAdapter.<init>(JacksonAdapter.java:59)
          at com.azure.core.util.serializer.JacksonAdapter$SerializerAdapterHolder.<clinit>(JacksonAdapter.java:114)
          at com.azure.core.util.serializer.JacksonAdapter.createDefaultSerializerAdapter(JacksonAdapter.java:123)
          at com.azure.identity.implementation.IdentityClient.<clinit>(IdentityClient.java:104)
          at com.azure.identity.implementation.IdentityClientBuilder.build(IdentityClientBuilder.java:158)
          at com.azure.identity.ClientSecretCredential.<init>(ClientSecretCredential.java:68)
          at com.azure.identity.ClientSecretCredentialBuilder.build(ClientSecretCredentialBuilder.java:93)
          at main.java.emailtranslator.EmailTranslator.connectOffice365MicrosoftGraph

       

      My offending code calling azure-core graph:

                  final ClientSecretCredential clientSecretCredential = new ClientSecretCredentialBuilder()
                  .clientId(clientId)
                  .clientSecret(clientSecret)
                  .tenantId(tenantId)
                  .build();

                  final TokenCredentialAuthProvider tokenCredentialAuthProvider = new TokenCredentialAuthProvider(scopes, clientSecretCredential);

                  final GraphServiceClient graphClient =
                  GraphServiceClient
                  .builder()
                  .authenticationProvider(tokenCredentialAuthProvider)
                  .buildClient();

                  final User me = graphClient.me().buildRequest().get();

       

      which calls azure-core-1.30.0.jar -> com.azure.core.implementation.jackson -> JacksonVersion.class line 43 onwards:

          private JacksonVersion() {
              annotationsVersion = SemanticVersion.getPackageVersionForClass("com.fasterxml.jackson.annotation.JsonProperty");
              coreVersion = SemanticVersion.getPackageVersionForClass("com.fasterxml.jackson.core.JsonGenerator");
              databindVersion = SemanticVersion.getPackageVersionForClass("com.fasterxml.jackson.databind.ObjectMapper");
              xmlVersion = SemanticVersion.getPackageVersionForClass("com.fasterxml.jackson.dataformat.xml.XmlMapper");
              jsr310Version = SemanticVersion.getPackageVersionForClass("com.fasterxml.jackson.datatype.jsr310.JavaTimeModule");

       

      Which is messed up by: tika-app-2.4.1,jar -> com.azure.core.implementation.jackson.JacksonVersion -> JsonGenerator.class

      which changes the jackson version from 2.13.3 to tika's 2.4.1... causing a world of hurt

       

       

       

      Portions of My POM trying to resolve the conflict:

      ...

          <dependencyManagement>
             <dependencies>
                  <dependency>
                      <groupId>com.fasterxml.jackson.core</groupId>
                      <artifactId>jackson-annotations</artifactId>
                      <version>2.13.3</version>
                  </dependency>
                  <dependency>
                      <groupId>com.fasterxml.jackson.core</groupId>
                      <artifactId>jackson-core</artifactId>
                      <version>2.13.3</version>
                  </dependency>
                  <dependency>
                      <groupId>com.fasterxml.jackson.core</groupId>
                      <artifactId>jackson-databind</artifactId>
                      <version>2.13.3</version>
                  </dependency>
                  <dependency>
                      <groupId>com.fasterxml.jackson.dataformat</groupId>
                      <artifactId>jackson-dataformat-xml</artifactId>
                      <version>2.13.3</version>
                  </dependency>
                  <dependency>
                      <groupId>com.fasterxml.jackson.datatype</groupId>
                      <artifactId>jackson-datatype-jsr310</artifactId>
                      <version>2.13.3</version>
                  </dependency>
              </dependencies>
          </dependencyManagement>

      ...

              <!-- https://mvnrepository.com/artifact/com.azure/azure-core -->
              <dependency>
                  <groupId>com.azure</groupId>
                  <artifactId>azure-core</artifactId>
                  <version>1.30.0</version><!{}Jun, 2022{}>
                  <exclusions>
                      <exclusion>
                          <groupId>com.fasterxml.jackson.core</groupId>
                          <artifactId>jackson-annotations</artifactId>
                      </exclusion>
                      <exclusion>
                          <groupId>com.fasterxml.jackson.core</groupId>
                          <artifactId>jackson-core</artifactId>
                      </exclusion>
                      <exclusion>
                          <groupId>com.fasterxml.jackson.core</groupId>
                          <artifactId>jackson-databind</artifactId>
                      </exclusion>
                      <exclusion>
                          <groupId>com.fasterxml.jackson.dataformat</groupId>
                          <artifactId>jackson-dataformat-xml</artifactId>
                      </exclusion>
                      <exclusion>
                          <groupId>com.fasterxml.jackson.datatype</groupId>
                          <artifactId>jackson-datatype-jsr310</artifactId>
                      </exclusion>
                  </exclusions>
              </dependency>

      ...

              <!-- https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-annotations -->
              <dependency>
                  <groupId>com.fasterxml.jackson.core</groupId>
                  <artifactId>jackson-annotations</artifactId>
                  <version>2.13.3</version>
                  <scope>provided</scope>
              </dependency>
              <!-- https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-core -->
              <dependency>
                  <groupId>com.fasterxml.jackson.core</groupId>
                  <artifactId>jackson-core</artifactId>
                  <version>2.13.3</version>
                  <scope>provided</scope>
              </dependency>
              <!-- https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-databind -->
              <dependency>
                  <groupId>com.fasterxml.jackson.core</groupId>
                  <artifactId>jackson-databind</artifactId>
                  <version>2.13.3</version>
                  <scope>provided</scope>
              </dependency>
              <!-- https://mvnrepository.com/artifact/com.fasterxml.jackson.dataformat/jackson-dataformat-xml -->
              <dependency>
                  <groupId>com.fasterxml.jackson.dataformat</groupId>
                  <artifactId>jackson-dataformat-xml</artifactId>
                  <version>2.13.3</version>
                  <scope>provided</scope>
              </dependency>
              <!-- https://mvnrepository.com/artifact/com.fasterxml.jackson.datatype/jackson-datatype-jsr310 -->
              <dependency>
                  <groupId>com.fasterxml.jackson.datatype</groupId>
                  <artifactId>jackson-datatype-jsr310</artifactId>
                  <version>2.13.3</version>
                  <scope>provided</scope>
              </dependency>

      ...

              <dependency>
                  <groupId>org.apache.tika</groupId>
                  <artifactId>tika-app</artifactId>
                  <version>2.4.1</version><!{}Jun, 2022{}>
                  <exclusions>
                      <exclusion>
                          <groupId>com.fasterxml.jackson.core</groupId>
                          <artifactId>jackson-annotations</artifactId>
                      </exclusion>
                      <exclusion>
                          <groupId>com.fasterxml.jackson.core</groupId>
                          <artifactId>jackson-core</artifactId>
                      </exclusion>
                      <exclusion>
                          <groupId>com.fasterxml.jackson.core</groupId>
                          <artifactId>jackson-databind</artifactId>
                      </exclusion>
                      <exclusion>
                          <groupId>com.fasterxml.jackson.dataformat</groupId>
                          <artifactId>jackson-dataformat-xml</artifactId>
                      </exclusion>
                      <exclusion>
                          <groupId>com.fasterxml.jackson.datatype</groupId>
                          <artifactId>jackson-datatype-jsr310</artifactId>
                      </exclusion>
                  </exclusions>
              </dependency>

      Attachments

        1. screenshot-1.png
          125 kB
          Tilman Hausherr

        Activity

          People

            Unassigned Unassigned
            AndreNel Andre Nel
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: