我無法將NGSI/XML格式的事件發送給我的Proton-CEP GE。用例是我需要Orion向CEP發送事件。Proton-CEP接收事件API NGSI/XML空指針異常
獵戶座被配置爲發送事件給質子,這是正確接收。但是,Proton在收到它們時報告NullPointerException
。
從catalina.out中的輸出是:
Nov 12, 2015 7:30:27 PM com.ibm.hrl.proton.webapp.providers.EventXmlNgsiMessageReader readFrom
INFO: started event message body reader
Nov 12, 2015 7:30:27 PM com.ibm.hrl.proton.webapp.providers.EventXmlNgsiMessageReader readFrom
INFO: Event: DeviceContextUpdate
Nov 12, 2015 7:30:27 PM com.ibm.hrl.proton.webapp.providers.EventXmlNgsiMessageReader readFrom
SEVERE: Could not parse XML NGSI event java.lang.NullPointerException, reason: null
last attribute name: null last value: null
Nov 12, 2015 7:30:27 PM com.ibm.hrl.proton.webapp.providers.EventXmlNgsiMessageReader readFrom
INFO: finished event message body reader
Nov 12, 2015 7:30:27 PM com.ibm.hrl.proton.webapp.resources.EventResource submitNewEvent
INFO: starting submitNewEvent
Nov 12, 2015 7:30:27 PM com.ibm.hrl.proton.webapp.resources.EventResource submitNewEvent
SEVERE: Could not send event, reason: java.lang.NullPointerException, message: null
直接發送以下JSON事件CEP的工作原理:
{"Name": "Device", "datacount5": "10", "lastupdate": "12/11/2015-17:09:08"}
INFO: starting submitNewEvent
Nov 12, 2015 7:31:39 PM com.ibm.hrl.proton.router.EventRouter routeTimedObject
INFO: routeTimedObject: forwarding event Device; EventId=32314f63-75d3-489f-9d8d-dbd0ba4a42b8; Chronon=null; DetectionTime=1447353099831; Name=Device; Certainty=0.0; Cost=0.0; lastupdate=1447344548000; EventSource=; OccurrenceTime=null; datacount5=10; Annotation=; Duration=0.0; ExpirationTime=null; to consumer...
Nov 12, 2015 7:31:39 PM com.ibm.hrl.proton.webapp.resources.EventResource submitNewEvent
INFO: events sent to proton runtime...
然而,在NGSI/XML發送它產生一個空指針異常如上。在發送的消息是:
<notifyContextRequest>
<subscriptionId>51a60c7a286043f73ce9606c</subscriptionId>
<originator>localhost</originator>
<contextResponseList>
<contextElementResponse>
<contextElement>
<entityId type="Device" isPattern="false">
<id>Device.imei2</id>
</entityId>
<contextAttributeList>
<contextAttribute>
<name>datacount5</name>
<contextValue>5</contextValue>
</contextAttribute>
</contextAttributeList>
</contextElement>
<statusCode>
<code>200</code>
<reasonPhrase>OK</reasonPhrase>
</statusCode>
</contextElementResponse>
</contextResponseList>
</notifyContextRequest>
注:我也曾嘗試發送在the documentation中發現的消息,我也得到同樣的NullPointerException異常,所以我知道這是不是一個XML格式的問題。
phqp JSON對象被接受的原因是什麼,但是NGSI/XML失敗了?
找到謝謝@Tal Haham,這十五分鐘前我發現。我希望他們在文檔中更清楚地標明這一點。 – Pedro