當我嘗試使用下面的方法調用getstream API來保存活動(JSON)時,我得到以下異常。偶爾會發生此異常。我們如何解決這個問題?InvalidOrMissingInputException調用gestream API時
JSON:(activityTask){
"processingType": "PERSIST_AND_NOTIFY",
"carbookBaseActivity": {
"actor": "7d8d59d1-1997-4213-81c0-32de463466f6",
"verb": "favorite",
"object": "{\"city\":\"Weimar\",\"postcode\":\"99423\",\"street\":\" Ernst-Thälmann-Straße\",\"housenumber\":\"\",\"countrycode\":\"DE\",\"county\":\"\",\"suburb\":\"\",\"state\":\"\",\"geopoint\":{\"lon\":11.3224816,\"lat\":50.9887822,\"alt\":0.0}}",
"target": "NA",
"time": "2017-04-17T08:43:09.527",
"to": [],
"acted": false,
"timeToLive": 1492591389527,
"userClusterId": "f7e3e39e-22a3-48c5-a043-f439e23b9bb2",
"label": "OFFICE",
"pictureUrl": "NA",
"status": 0,
"addressType": "OFFICE",
"foreign_id": "8ad1b071-e45d-4993-b077-ca843f137322",
"carbookBaseType": "TASK"
}
}
方法:
CarbookBaseActivity response = flatActivityService.addActivity(activityTask);
io.getstream.client.exception.InvalidOrMissingInputException
at io.getstream.client.apache.repo.handlers.StreamExceptionHandler.handleResponseCode(StreamExceptionHandler.java:73) ~[stormjar.jar:?]
at io.getstream.client.apache.repo.StreamActivityRepository.handleResponseCode(StreamActivityRepository.java:266) ~[stormjar.jar:?]
at io.getstream.client.apache.repo.StreamActivityRepository.addActivity(StreamActivityRepository.java:103) ~[stormjar.jar:?]
at io.getstream.client.apache.repo.StreamRepositoryImpl.addActivity(StreamRepositoryImpl.java:199) ~[stormjar.jar:?]
at io.getstream.client.service.AbstractActivityService.addActivity(AbstractActivityService.java:69) ~[stormjar.jar:?]
at de.carbook.storm.activity.operation.ActivityOperation.handleLocationPredicitionTask(ActivityOperation.java:230) ~[stormjar.jar:?]
at de.carbook.storm.activity.operation.ActivityOperation.handleCarbookBaseActivity(ActivityOperation.java:115) ~[stormjar.jar:?]
at de.carbook.storm.activity.operation.ActivityOperation.handleActivity(ActivityOperation.java:73) ~[stormjar.jar:?]
at de.carbook.storm.activity.extract.ActivityBolt.execute(ActivityBolt.java:89) [stormjar.jar:?]
at backtype.storm.topology.BasicBoltExecutor.execute(BasicBoltExecutor.java:50) [storm-core-0.10.0.2.3.4.0-3485.jar:0.10.0.2.3.4.0-3485]
at backtype.storm.daemon.executor$fn__4273$tuple_action_fn__4275.invoke(executor.clj:670) [storm-core-0.10.0.2.3.4.0-3485.jar:0.10.0.2.3.4.0-3485]
at backtype.storm.daemon.executor$mk_task_receiver$fn__4196.invoke(executor.clj:426) [storm-core-0.10.0.2.3.4.0-3485.jar:0.10.0.2.3.4.0-3485]
at backtype.storm.disruptor$clojure_handler$reify__3772.onEvent(disruptor.clj:58) [storm-core-0.10.0.2.3.4.0-3485.jar:0.10.0.2.3.4.0-3485]
at backtype.storm.utils.DisruptorQueue.consumeBatchToCursor(DisruptorQueue.java:125) [storm-core-0.10.0.2.3.4.0-3485.jar:0.10.0.2.3.4.0-3485]
at backtype.storm.utils.DisruptorQueue.consumeBatchWhenAvailable(DisruptorQueue.java:99) [storm-core-0.10.0.2.3.4.0-3485.jar:0.10.0.2.3.4.0-3485]
at backtype.storm.disruptor$consume_batch_when_available.invoke(disruptor.clj:80) [storm-core-0.10.0.2.3.4.0-3485.jar:0.10.0.2.3.4.0-3485]
at backtype.storm.daemon.executor$fn__4273$fn__4286$fn__4337.invoke(executor.clj:808) [storm-core-0.10.0.2.3.4.0-3485.jar:0.10.0.2.3.4.0-3485]
at backtype.storm.util$async_loop$fn__543.invoke(util.clj:475) [storm-core-0.10.0.2.3.4.0-3485.jar:0.10.0.2.3.4.0-3485]
at clojure.lang.AFn.run(AFn.java:22) [clojure-1.6.0.jar:?]
at java.lang.Thread.run(Thread.java:745) [?:1.8.0_60]
2017-04-17 14:41:10.461 b.s.d.executor [ERROR]
io.getstream.client.exception.InvalidOrMissingInputException
at io.getstream.client.apache.repo.handlers.StreamExceptionHandler.handleResponseCode(StreamExceptionHandler.java:73) ~[stormjar.jar:?]
at io.getstream.client.apache.repo.StreamActivityRepository.handleResponseCode(StreamActivityRepository.java:266) ~[stormjar.jar:?]
at io.getstream.client.apache.repo.StreamActivityRepository.addActivity(StreamActivityRepository.java:103) ~[stormjar.jar:?]
at io.getstream.client.apache.repo.StreamRepositoryImpl.addActivity(StreamRepositoryImpl.java:199) ~[stormjar.jar:?]
at io.getstream.client.service.AbstractActivityService.addActivity(AbstractActivityService.java:69) ~[stormjar.jar:?]
at de.carbook.storm.activity.operation.ActivityOperation.handleLocationPredicitionTask(ActivityOperation.java:230) ~[stormjar.jar:?]
at de.carbook.storm.activity.operation.ActivityOperation.handleCarbookBaseActivity(ActivityOperation.java:115) ~[stormjar.jar:?]
at de.carbook.storm.activity.operation.ActivityOperation.handleActivity(ActivityOperation.java:73) ~[stormjar.jar:?]
at de.carbook.storm.activity.extract.ActivityBolt.execute(ActivityBolt.java:89) [stormjar.jar:?]
at backtype.storm.topology.BasicBoltExecutor.execute(BasicBoltExecutor.java:50) [storm-core-0.10.0.2.3.4.0-3485.jar:0.10.0.2.3.4.0-3485]
at backtype.storm.daemon.executor$fn__4273$tuple_action_fn__4275.invoke(executor.clj:670) [storm-core-0.10.0.2.3.4.0-3485.jar:0.10.0.2.3.4.0-3485]
at backtype.storm.daemon.executor$mk_task_receiver$fn__4196.invoke(executor.clj:426) [storm-core-0.10.0.2.3.4.0-3485.jar:0.10.0.2.3.4.0-3485]
at backtype.storm.disruptor$clojure_handler$reify__3772.onEvent(disruptor.clj:58) [storm-core-0.10.0.2.3.4.0-3485.jar:0.10.0.2.3.4.0-3485]
at backtype.storm.utils.DisruptorQueue.consumeBatchToCursor(DisruptorQueue.java:125) [storm-core-0.10.0.2.3.4.0-3485.jar:0.10.0.2.3.4.0-3485]
at backtype.storm.utils.DisruptorQueue.consumeBatchWhenAvailable(DisruptorQueue.java:99) [storm-core-0.10.0.2.3.4.0-3485.jar:0.10.0.2.3.4.0-3485]
at backtype.storm.disruptor$consume_batch_when_available.invoke(disruptor.clj:80) [storm-core-0.10.0.2.3.4.0-3485.jar:0.10.0.2.3.4.0-3485]
at backtype.storm.daemon.executor$fn__4273$fn__4286$fn__4337.invoke(executor.clj:808) [storm-core-0.10.0.2.3.4.0-3485.jar:0.10.0.2.3.4.0-3485]
at backtype.storm.util$async_loop$fn__543.invoke(util.clj:475) [storm-core-0.10.0.2.3.4.0-3485.jar:0.10.0.2.3.4.0-3485]
at clojure.lang.AFn.run(AFn.java:22) [clojure-1.6.0.jar:?]
at java.lang.Thread.run(Thread.java:745) [?:1.8.0_60]
響應:
InvalidOrMissingInputException
{statusCode=400, code=4, exception=InputException, detail=Errors for fields 'object'}
當您收到4xx錯誤時,您是否已經查看了響應主體?應該有一條JSON編碼的消息,其中包含有關活動負載中哪些內容無效的信息 –
我試過重新發送相同的JSON,在回覆中我收到了** _響應_ ** –
@TommasoBarbugli我發送的對象是json字符串。 –