&引用;java.lang.ClassCastException“;在创建事件时返回

&引用;java.lang.ClassCastException“;在创建事件时返回,java,sdk,microsoft-graph-api,Java,Sdk,Microsoft Graph Api,我正在尝试使用Microsoft Graph创建事件。 有时我会得到一个ClassCastException,但我不知道为什么 创建事件时返回“响应二进制”是什么情况 我的代码如下: ClientCredentialProvider authProvider = new GraphAuthProvider(accessToken); IGraphServiceClient graphClient = GraphServiceClient .builder()

我正在尝试使用Microsoft Graph创建事件。 有时我会得到一个ClassCastException,但我不知道为什么 创建事件时返回“响应二进制”是什么情况

我的代码如下:

ClientCredentialProvider authProvider = new GraphAuthProvider(accessToken);
IGraphServiceClient graphClient = GraphServiceClient
                .builder()
                .authenticationProvider(authProvider)
                .buildClient();

Event event = graphClient
                .users(USER)
                .events()
                .buildRequest(requestOptions)
                .post(event);
我得到了这个错误:

java.io.BufferedInputStream cannot be cast to com.microsoft.graph.models.extensions.Event"
java.lang.ClassCastException: java.io.BufferedInputStream cannot be cast to com.microsoft.graph.models.extensions.Event
        at com.microsoft.graph.requests.extensions.EventRequest.post(EventRequest.java:112)
        at com.microsoft.graph.requests.extensions.EventCollectionRequest.post(EventCollectionRequest.java:67)
graphClient.getLogger().setLoggingLevel(LoggerLevel.DEBUG)时已添加:

Starting to send request, URL https://graph.microsoft.com/v1.0/users/USER/events
com.microsoft.graph.logger.DefaultLogger logDebug
Request Method PATCH
com.microsoft.graph.logger.DefaultLogger logDebug
Sending com.microsoft.graph.models.extensions.Event as request body
com.microsoft.graph.logger.DefaultLogger logDebug
Serializing type Event
com.microsoft.graph.logger.DefaultLogger logDebug
Response code 200, OK
com.microsoft.graph.logger.DefaultLogger logDebug
Response binary
com.microsoft.graph.logger.DefaultLogger logDebug
Deserializing type Event
看着 用SDK登录,我猜如果返回“Response binary”,就会出现上述错误。 它只发生在远程计算机上,我无法在库中调试。 创建事件时返回“响应二进制”是什么情况

这是我正在使用的图书馆

<dependency>
    <groupId>com.microsoft.azure</groupId>
    <artifactId>msal4j</artifactId>
    <version>1.4.0</version>
</dependency>
<dependency>
    <groupId>com.microsoft.graph</groupId>
    <artifactId>microsoft-graph</artifactId>
    <version>1.7.0</version>
</dependency>

com.microsoft.azure
msal4j
1.4.0
com.microsoft.graph
微软图形
1.7.0
如果我的英语很难理解,我很抱歉。
如果您能给我一个答案,那会很有帮助。

我建议您只使用最新版本/SDK,而不要使用旧版本。即使它可能是一个错误或回归,这可能已经在以后的版本中修复。这就是为什么我总是使用最新的SDK/版本,看看您是否可以重新编写该问题。很高兴您尝试了它,而且它对您有效。

我尝试使用MS Graph explorer/POSTMAN创建事件,但未能重新编写该问题。所以我想知道你有没有试过?我试过Java代码,但我也无法重新处理这个问题。在使用microsoft graph 2.3.0时没有发生这种情况。如前所述,1.7.0版中发生了这种情况,原因不明。很高兴听到这个消息,我建议您只使用最新版本/SDK。看起来这可能是一个bug或回归,可能在以后的版本中已经修复。这就是为什么我总是使用最新的SDK/版本,看看你是否可以重新处理这个问题。考虑一下投票;因此,这可能对其他人有用。