Closed sudharsan2020 closed 4 years ago
Thanks for filing this issue @sudharsan2020. @g2vinay can you please assist @sudharsan2020 with resolving the dependency conflict?
https://github.com/Azure/azure-sdk-for-java/wiki/Frequently-Asked-Questions#dependency-conflict
Hi @joshfree , I haven't heard any update on this. Could you please share the necessary steps to resolve this? This is impacting our deliverables.
@sudharsan2020 I have been looking into this issue and trying to reproduce it. The stack trace shows that somewhere in the application KeyVault Track 1 SDK is expected to be supplied while Track 2 SDK is being used here. I'll share the updates of my findings here ASAP.
@sudharsan2020 Using the pom file configuration provided, I was able to reproduce the error in the stack trace.
Adding this dependency in the pom file resolved the issue for me. Adding this dependency in the top-level pom resolves the conflicts as it standardizes the jackson version to use in the application.
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
<version>2.10.0</version>
</dependency>
You can use any version from 2.10.0 and up.
@g2vinay Thanks for the update. I tried adding the jackson-core dependency and still getting the same error in the above pom. I also tried updating the jackson-datatype-joda to 2.10.0 and still geting the same error. No clue on resolving the issue
Exception in thread "main" java.lang.NoClassDefFoundError: com/fasterxml/jackson/core/TSFBuilder at com.fasterxml.jackson.dataformat.xml.XmlMapper.<init>(XmlMapper.java:122) at com.azure.core.util.serializer.JacksonAdapter.<init>(JacksonAdapter.java:68) at com.azure.core.util.serializer.JacksonAdapter.createDefaultSerializerAdapter(JacksonAdapter.java:101) at com.azure.identity.implementation.IdentityClient.<clinit>(IdentityClient.java:89) at com.azure.identity.implementation.IdentityClientBuilder.build(IdentityClientBuilder.java:99) at com.azure.identity.ClientSecretCredential.<init>(ClientSecretCredential.java:50) at com.azure.identity.ClientSecretCredentialBuilder.build(ClientSecretCredentialBuilder.java:62) at com.concordfax.capture.core.azure.keyvault.AzureKeyVaultStore.getSecretClient(AzureKeyVaultStore.java:79) at com.concordfax.capture.core.azure.keyvault.AzureKeyVaultStore.queryKeyVaultSecrets(AzureKeyVaultStore.java:36) at com.auxolabs.cvision.pipeline.AzureKeyVaultStoreCore.main(AzureKeyVaultStoreCore.java:24) Caused by: java.lang.ClassNotFoundException: com.fasterxml.jackson.core.TSFBuilder at java.net.URLClassLoader.findClass(URLClassLoader.java:382) at java.lang.ClassLoader.loadClass(ClassLoader.java:424) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349) at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ... 10 more
@sudharsan2020
The code compiled fine with jackson-core version 2.10.0 on my end.
Further, can you try the following steps:
<Path-To-User-Diir>/.m2
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
<version>2.11.2</version>
</dependency>
Try running the application with this configuration to see if the issue is resolved.
Shading the package If the above steps do not work out, then another approach is to use the shading route to shade jackson packages to avoid dependency conflicts:
mvn clean install
on the sample app’s pom file. This will install the shaded library in the local .m2 directory.Add the dependency of the newly installed keyvault shaded package and msal packailege separately in your application pom file:
<dependency>
<groupId>com.azure.shaded</groupId>
<artifactId>keyvault-shaded</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.microsoft.azure</groupId>
<artifactId>msal4j</artifactId>
<version>1.6.1</version>
</dependency>
Both of these strategies worked out fine on my end and resolved the conflict + code compiled fine. keyvaultshaded.zip
@g2vinay You are awesome. Shading approach solves the case. Thanks alot for your fantastic support :+1: :100:
Describe the bug Getting the No class def found error when quering the Keyvault using Azure Keyvault secrets library (azure-security-keyvault-secrets)
Exception or Stack Trace java.lang.ClassNotFoundException: com.microsoft.azure.keyvault.authentication.KeyVaultCredentials
Exception in thread "main" java.lang.NoClassDefFoundError: com/fasterxml/jackson/core/TSFBuilder at com.fasterxml.jackson.dataformat.xml.XmlMapper.<init>(XmlMapper.java:122) at com.azure.core.util.serializer.JacksonAdapter.<init>(JacksonAdapter.java:68) at com.azure.core.util.serializer.JacksonAdapter.createDefaultSerializerAdapter(JacksonAdapter.java:101) at com.azure.identity.implementation.IdentityClient.<clinit>(IdentityClient.java:89) at com.azure.identity.implementation.IdentityClientBuilder.build(IdentityClientBuilder.java:99) at com.azure.identity.ClientSecretCredential.<init>(ClientSecretCredential.java:50) at com.azure.identity.ClientSecretCredentialBuilder.build(ClientSecretCredentialBuilder.java:62) at com.concordfax.capture.core.azure.keyvault.AzureKeyVaultStore.getSecretClient(AzureKeyVaultStore.java:93) at com.concordfax.capture.core.azure.keyvault.AzureKeyVaultStore.queryKeyVaultSecrets(AzureKeyVaultStore.java:39) at com.auxolabs.cvision.pipeline.AzureKeyVaultStoreCore.main(AzureKeyVaultStoreCore.java:24) Caused by: java.lang.ClassNotFoundException: com.fasterxml.jackson.core.TSFBuilder at java.net.URLClassLoader.findClass(URLClassLoader.java:382) at java.lang.ClassLoader.loadClass(ClassLoader.java:424) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349) at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ... 10 more
To Reproduce Steps to reproduce the behavior: Use the below dependency versions in maven
Code Snippet
public class AzureKeyVaultStoreCore { public static void main(String[] args) throws Exception { KeyVaultSecretsRequestModel keyVaultRequestModel = readKeyVaultEnvironmentVariables(); String kvUri = "https://" + keyVaultRequestModel.getKeyVaultName()+ ".vault.azure.net";
}`
Expected behavior Keyvault secrets should be fetched from the vault.
Setup (please complete the following information):
Additional context pom.xml can be viewed at: https://codeshare.io/2jXbXD
Maven dependency tree +- org.projectlombok:lombok:jar:1.16.16:compile +- io.dropwizard:dropwizard-core:jar:1.1.0:compile | +- io.dropwizard:dropwizard-util:jar:1.1.0:compile | | - com.google.code.findbugs:jsr305:jar:3.0.1:compile | +- io.dropwizard:dropwizard-jackson:jar:1.1.0:compile | | +- com.fasterxml.jackson.datatype:jackson-datatype-guava:jar:2.8.7:compile | | +- com.fasterxml.jackson.datatype:jackson-datatype-jsr310:jar:2.8.7:compile | | +- com.fasterxml.jackson.datatype:jackson-datatype-jdk8:jar:2.8.7:compile | | +- com.fasterxml.jackson.module:jackson-module-parameter-names:jar:2.8.7:compile | | +- com.fasterxml.jackson.module:jackson-module-afterburner:jar:2.8.7:compile | | - ch.qos.logback:logback-classic:jar:1.2.1:compile | +- io.dropwizard:dropwizard-validation:jar:1.1.0:compile | | +- org.hibernate:hibernate-validator:jar:5.3.4.Final:compile | | | +- org.jboss.logging:jboss-logging:jar:3.3.0.Final:compile | | | - com.fasterxml:classmate:jar:1.3.1:compile | | - org.glassfish:javax.el:jar:3.0.0:compile | +- io.dropwizard:dropwizard-configuration:jar:1.1.0:compile | +- io.dropwizard:dropwizard-logging:jar:1.1.0:compile | | +- io.dropwizard.metrics:metrics-logback:jar:3.2.2:compile | | +- ch.qos.logback:logback-core:jar:1.2.1:compile | | +- org.slf4j:log4j-over-slf4j:jar:1.7.24:compile | | +- org.slf4j:jcl-over-slf4j:jar:1.7.24:compile | | - org.eclipse.jetty:jetty-util:jar:9.4.2.v20170220:compile | +- io.dropwizard:dropwizard-metrics:jar:1.1.0:compile | +- io.dropwizard:dropwizard-servlets:jar:1.1.0:compile | | - io.dropwizard.metrics:metrics-annotation:jar:3.2.2:compile | +- io.dropwizard:dropwizard-jetty:jar:1.1.0:compile | | +- io.dropwizard.metrics:metrics-jetty9:jar:3.2.2:compile | | +- org.eclipse.jetty:jetty-servlet:jar:9.4.2.v20170220:compile | | | - org.eclipse.jetty:jetty-security:jar:9.4.2.v20170220:compile | | +- org.eclipse.jetty:jetty-servlets:jar:9.4.2.v20170220:compile | | - org.eclipse.jetty:jetty-http:jar:9.4.2.v20170220:compile | +- io.dropwizard:dropwizard-lifecycle:jar:1.1.0:compile | +- io.dropwizard.metrics:metrics-core:jar:3.2.2:compile | +- io.dropwizard.metrics:metrics-jvm:jar:3.2.2:compile | +- io.dropwizard.metrics:metrics-servlets:jar:3.2.2:compile | | +- io.dropwizard.metrics:metrics-json:jar:3.2.2:compile | | - com.papertrail:profiler:jar:1.0.2:compile | +- io.dropwizard.metrics:metrics-healthchecks:jar:3.2.2:compile | +- io.dropwizard:dropwizard-request-logging:jar:1.1.0:compile | | - ch.qos.logback:logback-access:jar:1.2.1:compile | +- net.sourceforge.argparse4j:argparse4j:jar:0.7.0:compile | - org.eclipse.jetty.toolchain.setuid:jetty-setuid-java:jar:1.0.3:compile +- io.dropwizard:dropwizard-jersey:jar:1.1.0:compile | +- org.glassfish.jersey.core:jersey-server:jar:2.25.1:compile | | +- org.glassfish.jersey.core:jersey-common:jar:2.25.1:compile | | | +- org.glassfish.jersey.bundles.repackaged:jersey-guava:jar:2.25.1:compile | | | - org.glassfish.hk2:osgi-resource-locator:jar:1.0.1:compile | | +- org.glassfish.jersey.core:jersey-client:jar:2.25.1:compile | | +- javax.ws.rs:javax.ws.rs-api:jar:2.0.1:compile | | +- org.glassfish.jersey.media:jersey-media-jaxb:jar:2.25.1:compile | | +- javax.annotation:javax.annotation-api:jar:1.2:compile | | +- org.glassfish.hk2.external:javax.inject:jar:2.5.0-b32:compile | | +- org.glassfish.hk2:hk2-locator:jar:2.5.0-b32:compile | | | - org.javassist:javassist:jar:3.20.0-GA:compile | | - javax.validation:validation-api:jar:1.1.0.Final:compile | +- org.glassfish.jersey.ext:jersey-metainf-services:jar:2.25.1:compile | +- org.glassfish.jersey.ext:jersey-bean-validation:jar:2.25.1:compile | | +- javax.el:javax.el-api:jar:2.2.4:compile | | - org.glassfish.web:javax.el:jar:2.2.4:compile | +- io.dropwizard.metrics:metrics-jersey2:jar:3.2.2:compile | +- com.fasterxml.jackson.jaxrs:jackson-jaxrs-json-provider:jar:2.8.7:compile | | +- com.fasterxml.jackson.jaxrs:jackson-jaxrs-base:jar:2.8.7:compile | | - com.fasterxml.jackson.module:jackson-module-jaxb-annotations:jar:2.8.7:compile | +- org.glassfish.jersey.containers:jersey-container-servlet:jar:2.25.1:compile | | - org.glassfish.jersey.containers:jersey-container-servlet-core:jar:2.25.1:compile | +- org.eclipse.jetty:jetty-server:jar:9.4.2.v20170220:compile | | +- javax.servlet:javax.servlet-api:jar:3.1.0:compile | | - org.eclipse.jetty:jetty-io:jar:9.4.2.v20170220:compile | +- org.eclipse.jetty:jetty-webapp:jar:9.4.2.v20170220:compile | | - org.eclipse.jetty:jetty-xml:jar:9.4.2.v20170220:compile | +- org.eclipse.jetty:jetty-continuation:jar:9.4.2.v20170220:compile | - org.apache.commons:commons-lang3:jar:3.5:compile +- org.glassfish.hk2:hk2-api:jar:2.5.0-b36:compile | +- javax.inject:javax.inject:jar:1:compile | +- org.glassfish.hk2:hk2-utils:jar:2.5.0-b36:compile | - org.glassfish.hk2.external:aopalliance-repackaged:jar:2.5.0-b36:compile +- com.google.guava:guava:jar:20.0:compile +- com.smoketurner:dropwizard-swagger:jar:1.1.0-1:compile | +- io.dropwizard:dropwizard-auth:jar:1.1.0:compile | +- io.dropwizard:dropwizard-assets:jar:1.1.0:compile | +- io.dropwizard:dropwizard-views:jar:1.1.0:compile | +- io.dropwizard:dropwizard-views-freemarker:jar:1.1.0:compile | | - org.freemarker:freemarker:jar:2.3.23:compile | +- org.glassfish.jersey.media:jersey-media-multipart:jar:2.25.1:compile | | - org.jvnet.mimepull:mimepull:jar:1.9.6:compile | - io.swagger:swagger-jersey2-jaxrs:jar:1.5.13:compile | - io.swagger:swagger-jaxrs:jar:1.5.13:compile | +- io.swagger:swagger-core:jar:1.5.13:compile | | - io.swagger:swagger-models:jar:1.5.13:compile | | - io.swagger:swagger-annotations:jar:1.5.13:compile | - org.reflections:reflections:jar:0.9.10:compile | - com.google.code.findbugs:annotations:jar:2.0.1:compile +- com.azure:azure-identity:jar:1.0.0:compile | +- com.azure:azure-core:jar:1.0.0:compile | | +- com.fasterxml.jackson.dataformat:jackson-dataformat-xml:jar:2.10.0:compile | | | +- org.codehaus.woodstox:stax2-api:jar:4.2:compile | | | - com.fasterxml.woodstox:woodstox-core:jar:6.0.1:compile | | - io.projectreactor:reactor-core:jar:3.3.0.RELEASE:compile | | - org.reactivestreams:reactive-streams:jar:1.0.3:compile | +- com.microsoft.azure:msal4j:jar:0.5.0-preview:compile | +- com.nimbusds:oauth2-oidc-sdk:jar:6.14:compile | | +- com.sun.mail:javax.mail:jar:1.6.1:compile | | | - javax.activation:activation:jar:1.1:compile | | +- com.github.stephenc.jcip:jcip-annotations:jar:1.0-1:compile | | +- net.minidev:json-smart:jar:2.3:compile (versioselected from constraint [1.3.1,2.3]) | | | - net.minidev:accessors-smart:jar:1.2:compile | | | - org.ow2.asm:asm:jar:5.0.4:compile | | +- com.nimbusds:lang-tag:jar:1.5:compile (versioselected from constraint [1.4.3,)) | | - com.nimbusds:nimbus-jose-jwt:jar:8.20:compile (versioselected from constraint [6.0.1,)) | +- org.nanohttpd:nanohttpd:jar:2.3.1:compile | - net.java.dev.jna:jna-platform:jar:5.4.0:compile | - net.java.dev.jna:jna:jar:5.4.0:compile +- org.mongojack:mongojack:jar:2.9.4:compile | +- org.mongodb:mongodb-driver:jar:3.8.0:compile | | +- org.mongodb:bson:jar:3.8.0:compile | | - org.mongodb:mongodb-driver-core:jar:3.8.0:compile | +- com.fasterxml.jackson.core:jackson-databind:jar:2.9.6:compile | +- de.undercouch:bson4jackson:jar:2.9.2:compile | +- javax.persistence:persistence-api:jar:1.0.2:compile | - commons-io:commons-io:jar:2.6:compile +- io.fabric8:kubernetes-client:jar:4.0.4:compile | +- io.fabric8:kubernetes-model:jar:3.0.2:compile | +- com.squareup.okhttp3:okhttp:jar:3.9.1:compile | | - com.squareup.okio:okio:jar:1.13.0:compile | +- com.squareup.okhttp3:logging-interceptor:jar:3.9.1:compile | +- org.slf4j:slf4j-api:jar:1.7.13:compile | +- org.slf4j:jul-to-slf4j:jar:1.7.13:compile | +- com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:jar:2.7.7:compile | | - org.yaml:snakeyaml:jar:1.15:compile | +- com.fasterxml.jackson.core:jackson-core:jar:2.7.7:compile | +- io.fabric8:zjsonpatch:jar:0.3.0:compile | - com.github.mifmif:generex:jar:1.0.1:compile | - dk.brics.automaton:automaton:jar:1.11-8:compile +- com.microsoft.azure:applicationinsights-core:jar:2.1.0:compile +- com.microsoft.azure:azure:jar:1.16.0:compile | +- com.microsoft.azure:azure-client-runtime:jar:1.6.2:compile | | - com.microsoft.rest:client-runtime:jar:1.6.2:compile | | +- com.squareup.retrofit2:retrofit:jar:2.4.0:compile | | +- com.squareup.okhttp3:okhttp-urlconnection:jar:3.11.0:compile | | +- com.squareup.retrofit2:converter-jackson:jar:2.4.0:compile | | - com.squareup.retrofit2:adapter-rxjava:jar:2.4.0:compile | +- com.microsoft.azure:azure-client-authentication:jar:1.6.2:compile | | +- com.microsoft.azure:adal4j:jar:1.6.2:compile | | - com.microsoft.azure:azure-annotations:jar:1.2.0:compile | +- com.microsoft.azure:azure-mgmt-resources:jar:1.16.0:compile | | - io.reactivex:rxjava:jar:1.3.8:compile | +- com.microsoft.azure:azure-mgmt-storage:jar:1.16.0:compile | +- com.microsoft.azure:azure-mgmt-network:jar:1.16.0:compile | +- com.microsoft.azure:azure-mgmt-compute:jar:1.16.0:compile | +- com.microsoft.azure:azure-mgmt-graph-rbac:jar:1.16.0:compile | +- com.microsoft.azure:azure-mgmt-keyvault:jar:1.16.0:compile | | - com.microsoft.azure:azure-keyvault:jar:1.0.0:compile | | - com.microsoft.azure:azure-keyvault-webkey:jar:1.0.0:compile | +- com.microsoft.azure:azure-mgmt-batch:jar:1.16.0:compile | +- com.microsoft.azure:azure-mgmt-trafficmanager:jar:1.16.0:compile | +- com.microsoft.azure:azure-mgmt-dns:jar:1.16.0:compile | +- com.microsoft.azure:azure-mgmt-redis:jar:1.16.0:compile | +- com.microsoft.azure:azure-mgmt-appservice:jar:1.16.0:compile | | - com.microsoft.azure:azure-storage:jar:6.1.0:compile | | - com.microsoft.azure:azure-keyvault-core:jar:0.8.0:compile | +- com.microsoft.azure:azure-mgmt-locks:jar:1.16.0:compile | +- com.microsoft.azure:azure-mgmt-eventhub:jar:1.16.0:compile | +- com.microsoft.azure:azure-mgmt-cdn:jar:1.16.0:compile | +- com.microsoft.azure:azure-mgmt-sql:jar:1.16.0:compile | +- com.microsoft.azure:azure-mgmt-containerinstance:jar:1.16.0:compile | +- com.microsoft.azure:azure-mgmt-containerregistry:jar:1.16.0:compile | +- com.microsoft.azure:azure-mgmt-containerservice:jar:1.16.0:compile | +- com.microsoft.azure:azure-mgmt-cosmosdb:jar:1.16.0:compile | +- com.microsoft.azure:azure-mgmt-search:jar:1.16.0:compile | +- com.microsoft.azure:azure-mgmt-msi:jar:1.16.0:compile | +- com.microsoft.azure:azure-mgmt-monitor:jar:1.16.0:compile | +- com.microsoft.azure:azure-mgmt-servicebus:jar:1.16.0:compile | - com.microsoft.azure:azure-mgmt-batchai:jar:1.16.0:compile +- com.google.code.gson:gson:jar:2.7:compile +- org.apache.httpcomponents:httpmime:jar:4.5.3:compile +- org.apache.httpcomponents:httpclient:jar:4.5.2:compile | +- org.apache.httpcomponents:httpcore:jar:4.4.4:compile | +- commons-logging:commons-logging:jar:1.2:compile | - commons-codec:commons-codec:jar:1.9:compile +- junit:junit:jar:4.12:test | - org.hamcrest:hamcrest-core:jar:1.3:test +- com.googlecode.json-simple:json-simple:jar:1.1.1:compile +- com.fasterxml.jackson.core:jackson-annotations:jar:2.10.0:compile +- com.fasterxml.jackson.datatype:jackson-datatype-joda:jar:2.10.0:compile | - joda-time:joda-time:jar:2.9.9:compile - com.azure:azure-security-keyvault-secrets:jar:4.1.0:compile - com.azure:azure-core-http-netty:jar:1.2.0:compile +- io.netty:netty-handler:jar:4.1.42.Final:compile | +- io.netty:netty-common:jar:4.1.42.Final:compile | +- io.netty:netty-transport:jar:4.1.42.Final:compile | | - io.netty:netty-resolver:jar:4.1.42.Final:compile | - io.netty:netty-codec:jar:4.1.42.Final:compile +- io.netty:netty-handler-proxy:jar:4.1.42.Final:compile | - io.netty:netty-codec-socks:jar:4.1.42.Final:compile +- io.netty:netty-buffer:jar:4.1.42.Final:compile +- io.netty:netty-codec-http:jar:4.1.42.Final:compile +- io.netty:netty-codec-http2:jar:4.1.42.Final:compile +- io.netty:netty-transport-native-unix-common:jar:4.1.42.Final:compile +- io.netty:netty-transport-native-epoll:jar:linux-x86_64:4.1.42.Final:compile - io.projectreactor.netty:reactor-netty:jar:0.9.0.RELEASE:compile - io.projectreactor.addons:reactor-pool:jar:0.1.0.RELEASE:compile
Information Checklist Kindly make sure that you have added all the following information above and checkoff the required fields otherwise we will treat the issuer as an incomplete report