Search code examples
microsoft-graph-sdksmicrosoft-graph-api

com.azure.core.util.serializer.JacksonAdapter - Didn't set coercion defaults as it wasn't found on the classpath


While running the below code, I'm getting error:

String clientId = "*******";
    String clientSecret  = "*********";
    String tenant  = "********";
    ClientSecretCredential clientSecretCredential = new ClientSecretCredentialBuilder()
            .clientId(clientId)
            .clientSecret(clientSecret)
            .tenantId(tenant)
            .build();

    TokenCredentialAuthProvider tokenCredentialAuthProvider = new TokenCredentialAuthProvider(Arrays.asList("https://graph.microsoft.com/Mail.Send"), clientSecretCredential);

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

Error :

14:07:44.942 [main] DEBUG com.azure.core.util.serializer.JacksonAdapter - Failed to retrieve MethodHandles used to set coercion configurations. Setting coercion configurations will be skipped.java.lang.ClassNotFoundException: com.fasterxml.jackson.databind.cfg.MutableCoercionConfigat java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:606)at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:168)at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522)at java.base/java.lang.Class.forName0(Native Method)at java.base/java.lang.Class.forName(Class.java:377)at com.azure.core.util.serializer.JacksonAdapter.<clinit>(JacksonAdapter.java:77)at com.azure.identity.implementation.IdentityClient.<clinit>(IdentityClient.java:94)at com.azure.identity.implementation.IdentityClientBuilder.build(IdentityClientBuilder.java:113)at com.azure.identity.ClientSecretCredential.<init>(ClientSecretCredential.java:50)at com.azure.identity.ClientSecretCredentialBuilder.build(ClientSecretCredentialBuilder.java:62)at com.optum.subropoint.subro.fp.utils.MsGraph.main(MsGraph.java:28)14:07:45.850 [main] DEBUG com.azure.core.util.serializer.JacksonAdapter - Didn't set coercion defaults as it wasn't found on the classpath.14:07:46.209 [main] DEBUG reactor.util.Loggers$LoggerFactory - Using Slf4j logging framework

I'm using ms graph api to send an email


Solution

  • This is not specific as to which sample you are following, Please refer these samples From the Microsoft Graph API DOCs on sending the mail with different formats and as you are using the JAVA SDK.

    Please refer this DOC.Check if you are successful in sending the mail, if not please share the Client request and the time Stamp so I can check form our side whats the exact error that you are getting.

    Also please check if you have provided the necessary permissions, enter image description here