MS Graph Java SDK抛出身份验证异常。

huangapple go评论70阅读模式
英文:

MS Graph Java SDK throwing authentication exceptions

问题

以下是您提供的内容的中文翻译:

我正在尝试为 Microsoft Graph 文件请求使用用户名/密码身份验证(与为此目的创建的 AD 帐户一起使用,因为我们希望仅限制访问特定的 SharePoint 目录)。我使用了 .Net Core 的 Graph SDK(工作正常)编写了一些代码,现在我正在将其移植到 Java 用于另一个应用程序,但我无法使其进行身份验证。我粘贴了我尝试运行的 Java 代码,它的 .Net Core 等效代码,以及最后一次运行 Java 代码时的完整调试级别日志输出。

我已经尽可能地接近了 Java 代码,但是我没有找到 .WithUsernamePassword(email, password) 方法的等效方法(可能是因为 Java SDK 将用户名和密码直接提供给了 UsernamePasswordProvider 的构造函数)。

我使用的是 Auth 库的 v0.2.0 版本和主 SDK 的 v2.2.0 版本。我已经将这个问题提交到了 GitHub 问题页面,因为看起来这可能是 SDK 中的一个 bug,但我也很想让其他人查看一下我的 Java 代码,看看我是否做错了什么,这更有可能是问题的原因。

引发异常的 Java 代码

@Test
public void authError() {
    final String userAccountEmail = //
    final String userAccountPassword = //
    final String siteID = //
    final String driveID = //
    final String clientID = //
    final String filePath = //

    final IAuthenticationProvider authProvider = new UsernamePasswordProvider(clientID, Arrays.asList(), userAccountEmail, userAccountPassword);
    final IGraphServiceClient graphClient = GraphServiceClient.builder()
        .authenticationProvider(authProvider)
        .buildClient();
    graphClient.getLogger().setLoggingLevel(LoggerLevel.DEBUG);
    graphClient
        .sites(siteID)
        .drives(driveID).root()
        .itemWithPath(filePath)
        .buildRequest()
        .get();
}

工作的 C# 代码(.Net Core,没有异常,结果如预期)

    [Fact]
    public void authError()
    {
        var userAccountEmail = //
        var userAccountPassword = //
        var siteID = //
        var driveID = //
        var tenant = //
        var clientID = //
        var filePath = //
        var securePassword = new NetworkCredential("", userAccountPassword).SecurePassword;

        var publicClientApplication = PublicClientApplicationBuilder
            .Create(clientID)
            .WithTenantId(tenant)
            .Build();

        var graphClient = new GraphServiceClient(new UsernamePasswordProvider(publicClientApplication));

        graphClient
            .Sites[siteID]
            .Drives[driveID].Root
            .ItemWithPath(filePath)
            .Request()
            .WithUsernamePassword(userAccountEmail, securePassword)
            .GetAsync().GetAwaiter().GetResult();
    }

完整的 Java 调试级别日志输出

Sep 23, 2020 6:13:53 PM com.microsoft.graph.logger.DefaultLogger setLoggingLevel
INFO: 将日志级别设置为 DEBUG
OAuthProblemException{error='unsupported_response_type', description='Invalid response! Response body is not application/json encoded', uri='null', state='null', scope='null', redirectUri='null', responseStatus=0, parameters={}}
	at org.apache.oltu.oauth2.common.exception.OAuthProblemException.error(OAuthProblemException.java:63)
	at org.apache.oltu.oauth2.client.response.OAuthJSONAccessTokenResponse.setBody(OAuthJSONAccessTokenResponse.java:76)
    ...

请注意,翻译后的内容可能会受到语言差异的影响,一些术语可能因上下文而有所变化。

英文:

I'm trying to use Username/Password authentication for a Microsoft Graph files request (in conjunction with an AD account created for this purpose, since we want to limit access to only specific directories within SharePoint). I wrote some code using .Net Core's Graph SDK (working a-ok) that I'm porting to Java for a different application, and I can't get it to authenticate. I pasted the Java code I'm trying to run, its .Net Core equivalent, and lastly the whole debug-level log output from a run of the Java code.

I got the Java code as close as possible, but I didn't see an equivalent of the .WithUsernamePassword(email, password) method (probably since the Java SDK gives the username and password directly to the constructor of UsernamePasswordProvider).

I'm using v0.2.0 of the Auth library and v2.2.0 of the main SDK. I raised this as an issue with the msgraph-sdk-java-auth library, as it seems likely this might be a bug in the SDK, but I'm also curious for someone else to look at my Java code and let me know if I'm doing anything wrong, which is more likely.

Java code producing the exception

    @Test
    public void authError() {
        final String userAccountEmail = //
        final String userAccountPassword = //
        final String siteID = //
        final String driveID = //
        final String clientID = //
        final String filePath = //

        final IAuthenticationProvider authProvider = new UsernamePasswordProvider(clientID, Arrays.asList(), userAccountEmail, userAccountPassword);
        final IGraphServiceClient graphClient = GraphServiceClient.builder()
            .authenticationProvider(authProvider)
            .buildClient();
        graphClient.getLogger().setLoggingLevel(LoggerLevel.DEBUG);
        graphClient
            .sites(siteID)
            .drives(driveID).root()
            .itemWithPath(filePath)
            .buildRequest()
            .get();
    }

Working C# code (.Net Core, no exception, result is as expected)

        [Fact]
        public void authError()
        {
            var userAccountEmail = //
            var userAccountPassword = //
            var siteID = //
            var driveID = //
            var tenant = //
            var clientID = //
            var filePath = //
            var securePassword = new NetworkCredential("", userAccountPassword).SecurePassword;

            var publicClientApplication = PublicClientApplicationBuilder
                .Create(clientID)
                .WithTenantId(tenant)
                .Build();

            var graphClient = new GraphServiceClient(new UsernamePasswordProvider(publicClientApplication));

            graphClient
                .Sites[siteID]
                .Drives[driveID].Root
                .ItemWithPath(filePath)
                .Request()
                .WithUsernamePassword(userAccountEmail, securePassword)
                .GetAsync().GetAwaiter().GetResult();
        }

Full Java debug-level log output

<!-- language: lang-none -->

Sep 23, 2020 6:13:53 PM com.microsoft.graph.logger.DefaultLogger setLoggingLevel
INFO: Setting logging level to DEBUG
OAuthProblemException{error=&#39;unsupported_response_type&#39;, description=&#39;Invalid response! Response body is not application/json encoded&#39;, uri=&#39;null&#39;, state=&#39;null&#39;, scope=&#39;null&#39;, redirectUri=&#39;null&#39;, responseStatus=0, parameters={}}
at org.apache.oltu.oauth2.common.exception.OAuthProblemException.error(OAuthProblemException.java:63)
at org.apache.oltu.oauth2.client.response.OAuthJSONAccessTokenResponse.setBody(OAuthJSONAccessTokenResponse.java:76)
at org.apache.oltu.oauth2.client.response.OAuthClientResponse.init(OAuthClientResponse.java:92)
at org.apache.oltu.oauth2.client.response.OAuthAccessTokenResponse.init(OAuthAccessTokenResponse.java:65)
at org.apache.oltu.oauth2.client.response.OAuthClientResponse.init(OAuthClientResponse.java:101)
at org.apache.oltu.oauth2.client.response.OAuthAccessTokenResponse.init(OAuthAccessTokenResponse.java:60)
at org.apache.oltu.oauth2.client.response.OAuthClientResponse.init(OAuthClientResponse.java:120)
at org.apache.oltu.oauth2.client.response.OAuthClientResponseFactory.createCustomResponse(OAuthClientResponseFactory.java:82)
at org.apache.oltu.oauth2.client.URLConnectionClient.execute(URLConnectionClient.java:111)
at org.apache.oltu.oauth2.client.OAuthClient.accessToken(OAuthClient.java:65)
at org.apache.oltu.oauth2.client.OAuthClient.accessToken(OAuthClient.java:55)
at org.apache.oltu.oauth2.client.OAuthClient.accessToken(OAuthClient.java:71)
at com.microsoft.graph.auth.publicClient.UsernamePasswordProvider.getAccessTokenNewRequest(UsernamePasswordProvider.java:98)
at com.microsoft.graph.auth.publicClient.UsernamePasswordProvider.getAccessToken(UsernamePasswordProvider.java:71)
at com.microsoft.graph.auth.publicClient.UsernamePasswordProvider.authenticateRequest(UsernamePasswordProvider.java:62)
at com.microsoft.graph.http.CoreHttpProvider.sendRequestInternal(CoreHttpProvider.java:382)
at com.microsoft.graph.http.CoreHttpProvider.send(CoreHttpProvider.java:207)
at com.microsoft.graph.http.CoreHttpProvider.send(CoreHttpProvider.java:187)
at com.microsoft.graph.http.BaseRequest.send(BaseRequest.java:345)
at com.microsoft.graph.requests.extensions.DriveItemRequest.get(DriveItemRequest.java:84)
at com.orion.FileAccess.graph.GraphConnectionTest.authError(GraphConnectionTest.java:73)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:69)
at com.intellij.rt.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:33)
at com.intellij.rt.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:220)
at com.intellij.rt.junit.JUnitStarter.main(JUnitStarter.java:53)
Sep 23, 2020 6:13:54 PM com.microsoft.graph.logger.DefaultLogger logDebug
INFO: Starting to send request, URL https://graph.microsoft.com/v1.0/sites/&lt;site ID&gt;/drives/&lt;drive ID&gt;/root:/OneDriveConnector.Tests:
Sep 23, 2020 6:13:54 PM com.microsoft.graph.logger.DefaultLogger logDebug
INFO: Request Method GET
Sep 23, 2020 6:13:54 PM com.microsoft.graph.logger.DefaultLogger logDebug
INFO: Response code 401, Unauthorized
Sep 23, 2020 6:13:54 PM com.microsoft.graph.logger.DefaultLogger logDebug
INFO: Handling error response
Sep 23, 2020 6:13:54 PM com.microsoft.graph.logger.DefaultLogger logDebug
INFO: Deserializing type GraphErrorResponse
Sep 23, 2020 6:13:54 PM com.microsoft.graph.logger.DefaultLogger logError
SEVERE: CoreHttpProvider[send] - 207Graph service exception Error code: InvalidAuthenticationToken
Sep 23, 2020 6:13:54 PM com.microsoft.graph.logger.DefaultLogger logError
SEVERE: CoreHttpProvider[send] - 207Error message: CompactToken parsing failed with error code: 80049217
Sep 23, 2020 6:13:54 PM com.microsoft.graph.logger.DefaultLogger logError
SEVERE: CoreHttpProvider[send] - 207
Sep 23, 2020 6:13:54 PM com.microsoft.graph.logger.DefaultLogger logError
SEVERE: CoreHttpProvider[send] - 207GET https://graph.microsoft.com/v1.0/sites/&lt;site ID&gt;/drives/&lt;drive ID&gt;/root:/OneDriveConnector.Tests:
Sep 23, 2020 6:13:54 PM com.microsoft.graph.logger.DefaultLogger logError
SEVERE: CoreHttpProvider[send] - 207SdkVersion : graph-java/v2.2.0
Sep 23, 2020 6:13:54 PM com.microsoft.graph.logger.DefaultLogger logError
SEVERE: CoreHttpProvider[send] - 207Authorization : [PII_REDACTED]
Sep 23, 2020 6:13:54 PM com.microsoft.graph.logger.DefaultLogger logError
SEVERE: CoreHttpProvider[send] - 207
Sep 23, 2020 6:13:54 PM com.microsoft.graph.logger.DefaultLogger logError
SEVERE: CoreHttpProvider[send] - 207
Sep 23, 2020 6:13:54 PM com.microsoft.graph.logger.DefaultLogger logError
SEVERE: CoreHttpProvider[send] - 207401 : Unauthorized
Sep 23, 2020 6:13:54 PM com.microsoft.graph.logger.DefaultLogger logError
SEVERE: CoreHttpProvider[send] - 207Cache-Control : private
Sep 23, 2020 6:13:54 PM com.microsoft.graph.logger.DefaultLogger logError
SEVERE: CoreHttpProvider[send] - 207client-request-id : d73219c9-d26e-4972-9598-2a0ca6b6b8df
Sep 23, 2020 6:13:54 PM com.microsoft.graph.logger.DefaultLogger logError
SEVERE: CoreHttpProvider[send] - 207Content-Length : 333
Sep 23, 2020 6:13:54 PM com.microsoft.graph.logger.DefaultLogger logError
SEVERE: CoreHttpProvider[send] - 207Content-Type : application/json
Sep 23, 2020 6:13:54 PM com.microsoft.graph.logger.DefaultLogger logError
SEVERE: CoreHttpProvider[send] - 207Date : Wed, 23 Sep 2020 22:13:54 GMT
Sep 23, 2020 6:13:54 PM com.microsoft.graph.logger.DefaultLogger logError
SEVERE: CoreHttpProvider[send] - 207request-id : 61be66ec-05e4-408f-9aa5-dec61829cea6
Sep 23, 2020 6:13:54 PM com.microsoft.graph.logger.DefaultLogger logError
SEVERE: CoreHttpProvider[send] - 207Strict-Transport-Security : max-age=31536000
Sep 23, 2020 6:13:54 PM com.microsoft.graph.logger.DefaultLogger logError
SEVERE: CoreHttpProvider[send] - 207WWW-Authenticate : Bearer realm=&quot;&quot;, authorization_uri=&quot;https://login.microsoftonline.com/common/oauth2/authorize&quot;, client_id=&quot;00000003-0000-0000-c000-000000000000&quot;
Sep 23, 2020 6:13:54 PM com.microsoft.graph.logger.DefaultLogger logError
SEVERE: CoreHttpProvider[send] - 207x-ms-ags-diagnostic : {&quot;ServerInfo&quot;:{&quot;DataCenter&quot;:&quot;North Central US&quot;,&quot;Slice&quot;:&quot;SliceC&quot;,&quot;Ring&quot;:&quot;2&quot;,&quot;ScaleUnit&quot;:&quot;000&quot;,&quot;RoleInstance&quot;:&quot;AGSFE_IN_10&quot;}}
Sep 23, 2020 6:13:54 PM com.microsoft.graph.logger.DefaultLogger logError
SEVERE: CoreHttpProvider[send] - 207{
Sep 23, 2020 6:13:54 PM com.microsoft.graph.logger.DefaultLogger logError
SEVERE: CoreHttpProvider[send] - 207  &quot;error&quot;: {
Sep 23, 2020 6:13:54 PM com.microsoft.graph.logger.DefaultLogger logError
SEVERE: CoreHttpProvider[send] - 207    &quot;code&quot;: &quot;InvalidAuthenticationToken&quot;,
Sep 23, 2020 6:13:54 PM com.microsoft.graph.logger.DefaultLogger logError
SEVERE: CoreHttpProvider[send] - 207    &quot;message&quot;: &quot;CompactToken parsing failed with error code: 80049217&quot;,
Sep 23, 2020 6:13:54 PM com.microsoft.graph.logger.DefaultLogger logError
SEVERE: CoreHttpProvider[send] - 207    &quot;innerError&quot;: {
Sep 23, 2020 6:13:54 PM com.microsoft.graph.logger.DefaultLogger logError
SEVERE: CoreHttpProvider[send] - 207      &quot;date&quot;: &quot;2020-09-23T22:13:54&quot;,
Sep 23, 2020 6:13:54 PM com.microsoft.graph.logger.DefaultLogger logError
SEVERE: CoreHttpProvider[send] - 207      &quot;request-id&quot;: &quot;61be66ec-05e4-408f-9aa5-dec61829cea6&quot;,
Sep 23, 2020 6:13:54 PM com.microsoft.graph.logger.DefaultLogger logError
SEVERE: CoreHttpProvider[send] - 207      &quot;client-request-id&quot;: &quot;d73219c9-d26e-4972-9598-2a0ca6b6b8df&quot;
Sep 23, 2020 6:13:54 PM com.microsoft.graph.logger.DefaultLogger logError
SEVERE: CoreHttpProvider[send] - 207    }
Sep 23, 2020 6:13:54 PM com.microsoft.graph.logger.DefaultLogger logError
SEVERE: CoreHttpProvider[send] - 207  }
Sep 23, 2020 6:13:54 PM com.microsoft.graph.logger.DefaultLogger logError
SEVERE: CoreHttpProvider[send] - 207}
Sep 23, 2020 6:13:54 PM com.microsoft.graph.logger.DefaultLogger logError
SEVERE: Throwable detail: com.microsoft.graph.http.GraphServiceException: Error code: InvalidAuthenticationToken
Error message: CompactToken parsing failed with error code: 80049217
GET https://graph.microsoft.com/v1.0/sites/&lt;site ID&gt;/drives/&lt;drive ID&gt;/root:/OneDriveConnector.Tests:
SdkVersion : graph-java/v2.2.0
Authorization : [PII_REDACTED]
401 : Unauthorized
Cache-Control : private
client-request-id : d73219c9-d26e-4972-9598-2a0ca6b6b8df
Content-Length : 333
Content-Type : application/json
Date : Wed, 23 Sep 2020 22:13:54 GMT
request-id : 61be66ec-05e4-408f-9aa5-dec61829cea6
Strict-Transport-Security : max-age=31536000
WWW-Authenticate : Bearer realm=&quot;&quot;, authorization_uri=&quot;https://login.microsoftonline.com/common/oauth2/authorize&quot;, client_id=&quot;00000003-0000-0000-c000-000000000000&quot;
x-ms-ags-diagnostic : {&quot;ServerInfo&quot;:{&quot;DataCenter&quot;:&quot;North Central US&quot;,&quot;Slice&quot;:&quot;SliceC&quot;,&quot;Ring&quot;:&quot;2&quot;,&quot;ScaleUnit&quot;:&quot;000&quot;,&quot;RoleInstance&quot;:&quot;AGSFE_IN_10&quot;}}
{
&quot;error&quot;: {
&quot;code&quot;: &quot;InvalidAuthenticationToken&quot;,
&quot;message&quot;: &quot;CompactToken parsing failed with error code: 80049217&quot;,
&quot;innerError&quot;: {
&quot;date&quot;: &quot;2020-09-23T22:13:54&quot;,
&quot;request-id&quot;: &quot;61be66ec-05e4-408f-9aa5-dec61829cea6&quot;,
&quot;client-request-id&quot;: &quot;d73219c9-d26e-4972-9598-2a0ca6b6b8df&quot;
}
}
}
com.microsoft.graph.http.GraphServiceException: Error code: InvalidAuthenticationToken
Error message: CompactToken parsing failed with error code: 80049217
GET https://graph.microsoft.com/v1.0/sites/&lt;site ID&gt;/drives/&lt;drive ID&gt;/root:/OneDriveConnector.Tests:
SdkVersion : graph-java/v2.2.0
Authorization : [PII_REDACTED]
401 : Unauthorized
Cache-Control : private
client-request-id : d73219c9-d26e-4972-9598-2a0ca6b6b8df
Content-Length : 333
Content-Type : application/json
Date : Wed, 23 Sep 2020 22:13:54 GMT
request-id : 61be66ec-05e4-408f-9aa5-dec61829cea6
Strict-Transport-Security : max-age=31536000
WWW-Authenticate : Bearer realm=&quot;&quot;, authorization_uri=&quot;https://login.microsoftonline.com/common/oauth2/authorize&quot;, client_id=&quot;00000003-0000-0000-c000-000000000000&quot;
x-ms-ags-diagnostic : {&quot;ServerInfo&quot;:{&quot;DataCenter&quot;:&quot;North Central US&quot;,&quot;Slice&quot;:&quot;SliceC&quot;,&quot;Ring&quot;:&quot;2&quot;,&quot;ScaleUnit&quot;:&quot;000&quot;,&quot;RoleInstance&quot;:&quot;AGSFE_IN_10&quot;}}
{
&quot;error&quot;: {
&quot;code&quot;: &quot;InvalidAuthenticationToken&quot;,
&quot;message&quot;: &quot;CompactToken parsing failed with error code: 80049217&quot;,
&quot;innerError&quot;: {
&quot;date&quot;: &quot;2020-09-23T22:13:54&quot;,
&quot;request-id&quot;: &quot;61be66ec-05e4-408f-9aa5-dec61829cea6&quot;,
&quot;client-request-id&quot;: &quot;d73219c9-d26e-4972-9598-2a0ca6b6b8df&quot;
}
}
}
at com.microsoft.graph.http.GraphServiceException.createFromConnection(GraphServiceException.java:501)
at com.microsoft.graph.http.CoreHttpProvider.handleErrorResponse(CoreHttpProvider.java:490)
at com.microsoft.graph.http.CoreHttpProvider.sendRequestInternal(CoreHttpProvider.java:410)
at com.microsoft.graph.http.CoreHttpProvider.send(CoreHttpProvider.java:207)
at com.microsoft.graph.http.CoreHttpProvider.send(CoreHttpProvider.java:187)
at com.microsoft.graph.http.BaseRequest.send(BaseRequest.java:345)
at com.microsoft.graph.requests.extensions.DriveItemRequest.get(DriveItemRequest.java:84)
at com.orion.FileAccess.graph.GraphConnectionTest.authError(GraphConnectionTest.java:73)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:69)
at com.intellij.rt.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:33)
at com.intellij.rt.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:220)
at com.intellij.rt.junit.JUnitStarter.main(JUnitStarter.java:53)
Process finished with exit code 255

答案1

得分: 0

这实际上是一个缺失的依赖项,用于解码 JSON 响应。NoClassDefFound 错误没有被传播。根本错误是未指定范围,一旦我将 org.json JAR 添加到类路径中,就会显现出来。我使用了作用域 https://graph.microsoft.com/.default

英文:

This turned out to be a missing dependency, responsible for decoding the JSON responses. The NoClassDefFound error wasn't getting propagated. The underlying error was that no scopes were specified, which came through once I added the org.json JAR to my classpath. I used the scope https://graph.microsoft.com/.default.

huangapple
  • 本文由 发表于 2020年9月25日 00:18:24
  • 转载请务必保留本文链接:https://go.coder-hub.com/64050433.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定