CEP质子键不在地图中,原因是:键不在地图中

时间:2015-10-13 07:14:29

标签: fiware complex-event-processing

我试图将Proton与Orion集成,但当Orion向Proton发送事件时,我总是得到同样的错误:

com.ibm.hrl.proton.webapp.providers.EventJSONMessageReader readFrom 严重:无法解析json事件org.apache.wink.json4j.JSONException:键[Name]不在地图中,原因:键[Name]不在地图中

我已经查看了属性名称,但没关系。

见下面Cygnus看到的attrNames(已与Orion集成)

x

我还附加了json导出项目的一部分。

| 1444683578 | 2015-10-12T20:59:38.352 | sensor4 | STCSensor | Altitude | integer | 720 | [] |
| 1444683578 | 2015-10-12T20:59:38.352 | sensor4 | STCSensor | AltitudeDelta1 | integer | 720 | [] |
| 1444683578 | 2015-10-12T20:59:38.352 | sensor4 | STCSensor | AltitudeDelta2 | integer | 720 | [] |
| 1444683578 | 2015-10-12T20:59:38.352 | sensor4 | STCSensor | BatteryLevel | integer | 25 | [] |
| 1444683578 | 2015-10-12T20:59:38.352 | sensor4 | STCSensor | CO | integer | 720 | [] |
| 1444683578 | 2015-10-12T20:59:38.352 | sensor4 | STCSensor | COCal | float | 720 | [] |
| 1444683578 | 2015-10-12T20:59:38.352 | sensor4 | STCSensor | CurrentRSSI | integer | -110 | [] |
| 1444683578 | 2015-10-12T20:59:38.352 | sensor4 | STCSensor | LastPacketRSSI | integer | -40 | [] |
| 1444683578 | 2015-10-12T20:59:38.352 | sensor4 | STCSensor | LastPacketSNR | integer | 8 | [] |
| 1444683578 | 2015-10-12T20:59:38.352 | sensor4 | STCSensor | Latitude | float | 720 | [] |
| 1444683578 | 2015-10-12T20:59:38.352 | sensor4 | STCSensor | LatitudeDelta1 | integer | 720 | [] |
| 1444683578 | 2015-10-12T20:59:38.352 | sensor4 | STCSensor | LatitudeDelta2 | integer | 720 | [] |
| 1444683578 | 2015-10-12T20:59:38.352 | sensor4 | STCSensor | Longitude | float | 720 | [] |
| 1444683578 | 2015-10-12T20:59:38.352 | sensor4 | STCSensor | LongitudeDelta1 | integer | 720 | [] |
| 1444683578 | 2015-10-12T20:59:38.352 | sensor4 | STCSensor | LongitudeDelta2 | integer | 720 | [] |
| 1444683578 | 2015-10-12T20:59:38.352 | sensor4 | STCSensor | NO | integer | 720 | [] |
| 1444683578 | 2015-10-12T20:59:38.352 | sensor4 | STCSensor | NO2 | integer | 720 | [] |
| 1444683578 | 2015-10-12T20:59:38.352 | sensor4 | STCSensor | NO2Cal | float | 720 | [] |
| 1444683578 | 2015-10-12T20:59:38.352 | sensor4 | STCSensor | NOCal | float | 720 | [] |
| 1444683578 | 2015-10-12T20:59:38.352 | sensor4 | STCSensor | Ozone | integer | 720 | [] |
| 1444683578 | 2015-10-12T20:59:38.352 | sensor4 | STCSensor | OzoneCal | float | 720 | [] |
| 1444683578 | 2015-10-12T20:59:38.352 | sensor4 | STCSensor | Serial | float | 25 | [] |
| 1444683578 | 2015-10-12T20:59:38.352 | sensor4 | STCSensor | Speed | integer | 720 | [] |
| 1444683578 | 2015-10-12T20:59:38.352 | sensor4 | STCSensor | SpeedDelta1 | integer | 720 | [] |
| 1444683578 | 2015-10-12T20:59:38.352 | sensor4 | STCSensor | SpeedDelta2 | integer | 720 | [] |
| 1444683578 | 2015-10-12T20:59:38.352 | sensor4 | STCSensor | humidity | integer | 720 | [] |
| 1444683578 | 2015-10-12T20:59:38.352 | sensor4 | STCSensor | humidityCal | float | 720 | [] |
| 1444683578 | 2015-10-12T20:59:38.352 | sensor4 | STCSensor | pressure | integer | 720 | [] |
| 1444683578 | 2015-10-12T20:59:38.352 | sensor4 | STCSensor | pressureCal | float | 720 | [] |
| 1444683578 | 2015-10-12T20:59:38.352 | sensor4 | STCSensor | temperature | integer | 33 | [] |
| 1444683578 | 2015-10-12T20:59:38.352 | sensor4 | STCSensor | temperatureCal | float | 23 | [] |
| 1444683578 | 2015-10-12T20:59:38.352 | sensor4 | STCSensor | timestamp | integer | 140021212 | [] |
| 1444683578 | 2015-10-12T20:59:38.352 | sensor4 | STCSensor | timestampDelta | integer | 720 | [] |
| 1444683578 | 2015-10-12T20:59:38.352 | sensor4 | STCSensor | timestampDelta2 | integer | 23 | [] |
+------------+-------------------------+----------+------------+------------------+----------+-----------+--------+
你可以帮帮我吗?

事先谢谢

2 个答案:

答案 0 :(得分:1)

CEP Proactive Technology Online(Proton)和Orion之间的集成使用xml格式(而不是json)。

猎户座的帖子需要包括

Content-Type: application/xml

CEP Proactive Technology Online user guide中的附录描述了如何在Orion和Proton之间进行整合。

请注意,CEP事件定义必须具有一些属性,并且CEP输入事件的名称必须是[entity type] ContextUpdate,如user guide附录中所述

确保导出更新的定义并停止&启动CEP以使其与更新的定义一起运行

答案 1 :(得分:0)

我遇到了与Docker实例相同的问题。 尽管事件定义遵守用户指南附录A中描述的规则,但日志会不断报告:

INFO: started event message body reader
Oct 26, 2015 1:25:36 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
Oct 26, 2015 1:25:36 PM com.ibm.hrl.proton.webapp.providers.EventXmlNgsiMessageReader readFrom
INFO: finished event message body reader
Oct 26, 2015 1:25:36 PM com.ibm.hrl.proton.webapp.resources.EventResource submitNewEvent
INFO: starting submitNewEvent
Oct 26, 2015 1:25:36 PM com.ibm.hrl.proton.webapp.resources.EventResource submitNewEvent
SEVERE: Could not send event, reason: java.lang.NullPointerException, message: null

我决定尝试使用artifacts文件夹中的.war文件(编辑Dockerfile),而不是Dockerfile(原始文件)中使用的文件。现在一切正常,无需更改事件定义。

通过比较日志文件,我注意到原始Docker实例的catalina.out中缺少以下部分:

com.ibm.hrl.proton.server.executor.PropertiesParser loadProperties
INFO: Properties are : 
metadatFile =/tmp/defs/DoSAttack.json 
inputPortNumber =3002 
outputPortNumber =3302

这里是Dockerfile中的更改:

#WORKDIR /root/Proton/mvn-repo/com/ibm/hrl/proton/AuthoringTool/0.0.1
#RUN cp *war /var/lib/tomcat7/webapps/AuthoringTool.war
#WORKDIR /root/Proton/mvn-repo/com/ibm/hrl/proton/AuthoringToolWebServer/0.0.1
#RUN cp *war /var/lib/tomcat7/webapps/AuthoringToolWebServer.war
#WORKDIR /root/Proton/mvn-repo/com/ibm/hrl/proton/ProtonOnWebServer/0.0.1
#RUN cp *war /var/lib/tomcat7/webapps/ProtonOnWebServer.war
#WORKDIR /root/Proton/mvn-repo/com/ibm/hrl/proton/ProtonOnWebServerAdmin/0.0.1
#RUN cp *war /var/lib/tomcat7/webapps/ProtonOnWebServerAdmin.war
WORKDIR /root/Proton/artifacts
RUN cp AuthoringTool.war /var/lib/tomcat7/webapps/AuthoringTool.war
RUN cp AuthoringToolWebServer.war /var/lib/tomcat7/webapps/AuthoringToolWebServer.war 
RUN cp ProtonOnWebServer.war /var/lib/tomcat7/webapps/ProtonOnWebServer.war
RUN cp ProtonOnWebServerAdmin.war /var/lib/tomcat7/webapps/ProtonOnWebServerAdmin.war