我正在使用Olingo客户端连接到Microsoft Dynamics 365 V9.0,以更新诸如帐户等的实体。
但是,Olingo客户端(最新的4.4.0)有时会返回ODataServerErrorException,并且仅显示服务器状态,例如“ HTTP / 1.1 500 Internal Server Error”。这并不能说明根本原因。我们需要的是http响应正文返回的详细错误消息。 代码段和堆栈跟踪如下:
try {
ODataBatchResponse response = batchManager.getAsyncResponse().get(2, TimeUnit.MINUTES)
...
} catch (Exception e) {
log.error("error: "+ e.getMessage(), e)
}
stacktrace:
13 Jul 2018 23:56:18,958 ERROR Thread-77378 exportimpl.MicrosoftDynamicsCrmExportJobImpl - error: java.util.concurrent.ExecutionException: org.apache.olingo.client.api.communication.ODataServerErrorException: HTTP/1.1 500 Internal Server Error
org.apache.olingo.client.api.http.HttpClientException: java.util.concurrent.ExecutionException: org.apache.olingo.client.api.communication.ODataServerErrorException: HTTP/1.1 500 Internal Server Error
at org.apache.olingo.client.core.communication.request.AbstractODataStreamManager.getHttpResponse(AbstractODataStreamManager.java:128) ~[odata-client-core-4.4.0.jar:?]
at org.apache.olingo.client.core.communication.request.batch.ODataBatchRequestImpl$BatchManagerImpl.getResponseInstance(ODataBatchRequestImpl.java:88) ~[odata-client-core-4.4.0.jar:?]
at org.apache.olingo.client.core.communication.request.batch.AbstractBatchManager.getResponse(AbstractBatchManager.java:115) ~[odata-client-core-4.4.0.jar:?]
at org.apache.olingo.client.core.communication.request.batch.AbstractBatchManager.getResponse(AbstractBatchManager.java:38) ~[odata-client-core-4.4.0.jar:?]
at org.apache.olingo.client.core.communication.request.AbstractODataStreamManager$1.get(AbstractODataStreamManager.java:179) ~[odata-client-core-4.4.0.jar:?]
at org.apache.olingo.client.core.communication.request.AbstractODataStreamManager$1.get(AbstractODataStreamManager.java:154) ~[odata-client-core-4.4.0.jar:?]
at java_util_concurrent_Future$get$0.call(Unknown Source) ~[?:?]
...
at sun.reflect.GeneratedMethodAccessor1189.invoke(Unknown Source) ~[?:?]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_121]
at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_121]
at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:93) [groovy-2.4.11.jar:2.4.11]
at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:325) [groovy-2.4.11.jar:2.4.11]
at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:294) [groovy-2.4.11.jar:2.4.11]
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1022) [groovy-2.4.11.jar:2.4.11]
at groovy.lang.Closure.call(Closure.java:414) [groovy-2.4.11.jar:2.4.11]
at groovy.lang.Closure.call(Closure.java:408) [groovy-2.4.11.jar:2.4.11]
at groovy.lang.Closure.run(Closure.java:495) [groovy-2.4.11.jar:2.4.11]
at java.lang.Thread.run(Thread.java:745) [?:1.8.0_121]
Caused by: java.util.concurrent.ExecutionException: org.apache.olingo.client.api.communication.ODataServerErrorException: HTTP/1.1 500 Internal Server Error
at java.util.concurrent.FutureTask.report(FutureTask.java:122) ~[?:1.8.0_121]
at java.util.concurrent.FutureTask.get(FutureTask.java:206) ~[?:1.8.0_121]
at org.apache.olingo.client.core.communication.request.AbstractODataStreamManager.getHttpResponse(AbstractODataStreamManager.java:125) ~[odata-client-core-4.4.0.jar:?]
... 57 more
Caused by: org.apache.olingo.client.api.communication.ODataServerErrorException: HTTP/1.1 500 Internal Server Error
at org.apache.olingo.client.core.communication.header.ODataErrorResponseChecker.checkResponse(ODataErrorResponseChecker.java:74) ~[odata-client-core-4.4.0.jar:?]
at org.apache.olingo.client.core.communication.request.AbstractRequest.checkResponse(AbstractRequest.java:54) ~[odata-client-core-4.4.0.jar:?]
at org.apache.olingo.client.core.communication.request.AbstractODataRequest.doExecute(AbstractODataRequest.java:310) ~[odata-client-core-4.4.0.jar:?]
at org.apache.olingo.client.core.communication.request.batch.ODataBatchRequestImpl.doExecute(ODataBatchRequestImpl.java:73) ~[odata-client-core-4.4.0.jar:?]
at org.apache.olingo.client.core.communication.request.streamed.AbstractODataStreamedRequest.access$300(AbstractODataStreamedRequest.java:51) ~[odata-client-core-4.4.0.jar:?]
at org.apache.olingo.client.core.communication.request.streamed.AbstractODataStreamedRequest$2.call(AbstractODataStreamedRequest.java:118) ~[odata-client-core-4.4.0.jar:?]
at org.apache.olingo.client.core.communication.request.streamed.AbstractODataStreamedRequest$2.call(AbstractODataStreamedRequest.java:115) ~[odata-client-core-4.4.0.jar:?]
at java.util.concurrent.FutureTask.run(FutureTask.java:266) ~[?:1.8.0_121]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) ~[?:1.8.0_121]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) ~[?:1.8.0_121]
... 1 more
答案 0 :(得分:1)
您是否正在使用Web Api端点?我会说您的安全令牌已过期,但这将是错误401。由于它是500,所以问题可能是动态。如果您有请求正文和标头,则应该打开一个票证。
您以前是否在v8.2上运行?它可以帮助缩小问题的范围。