0
After upgrading the Azure SDK version to 1.7.0, authentication code failed with "java.lang.NoClassDefFoundError: com/microsoft/azure/management/batchai/implementation/BatchAIManager"

My authentication code is

/** * Default constructor. */ public Azure() {

    try {
        credentials = new ApplicationTokenCredentials(Config.AzureclientId_admin, Config.AzuretenantId_admin,
                Config.Azuresecret_admin, AzureEnvironment.AZURE);

        azure = com.microsoft.azure.management.Azure.authenticate(credentials)
                .withSubscription(Config.AzuresubscriptionId_admin);


    } catch (Exception ex) {
        Log.Message("Unable to create the Azure object", LogLevel.ERROR);
        ex.printStackTrace();
    }
}
  • Possible duplicate of [How to solve java.lang.NoClassDefFoundError?](https://stackoverflow.com/questions/17973970/how-to-solve-java-lang-noclassdeffounderror) – Syed Waqas Bukhary Mar 16 '18 at 11:59
  • This looked to be maven issue. The dependency was downloaded and seen in the .m2 directory but was not loaded in Eclipse Maven dependency. I deleted azure directory from the .m2 and compiled it again which resolved the issue. – Rajesh Shinde Mar 19 '18 at 06:10

1 Answers1

0

This looked to be maven issue. The dependency was downloaded and seen in the .m2 directory but was not loaded in Eclipse Maven dependency. I deleted azure directory from the .m2 and compiled it again which resolved the issue.