CEP Proton The key was not in the map, reason: The

2019-08-10 04:22发布

I was trying to integrate Proton with Orion, but when Orion is sending events to Proton, I always get the same error:

com.ibm.hrl.proton.webapp.providers.EventJSONMessageReader readFrom SEVERE: Could not parse json event org.apache.wink.json4j.JSONException: The key [Name] was not in the map, reason: The key [Name] was not in the map

I have reviewed the attributes names and they are OK.

See below the attrNames seen by Cygnus (already integrated with Orion)

| 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 | [] |
+------------+-------------------------+----------+------------+------------------+----------+-----------+--------+

I also attach part of the project json exported.

{"epn":{"events":[{"name":"STCSensor","createdDate":"Mon Oct 12 2015","attributes":[
{"name":"entityType","type":"String","dimension":0},
{"name":"Serial","type":"Double","dimension":0},
{"name":"BatteryLevel","type":"Integer","dimension":0},
{"name":"CurrentRSSI","type":"Integer","dimension":0},
{"name":"LastPacketRSSI","type":"Integer","dimension":0},
{"name":"LastPacketSNR","type":"Integer","dimension":0},
{"name":"timestamp","type":"Integer","dimension":0},
{"name":"timestampDelta","type":"Integer","dimension":0},
{"name":"timestampDelta2","type":"Integer","dimension":0},
{"name":"Latitude","type":"Double","dimension":0},
{"name":"Longitude","type":"Double","dimension":0},
{"name":"Altitude","type":"Integer","dimension":0},
{"name":"Speed","type":"Integer","dimension":0},
{"name":"LatitudeDelta1","type":"Integer","dimension":0},
{"name":"LongitudeDelta1","type":"Integer","dimension":0},
{"name":"AltitudeDelta1","type":"Integer","dimension":0},
{"name":"SpeedDelta1","type":"Integer","dimension":0},
{"name":"LatitudeDelta2","type":"Integer","dimension":0},
{"name":"LongitudeDelta2","type":"Integer","dimension":0},
{"name":"AltitudeDelta2","type":"Integer","dimension":0},
{"name":"SpeedDelta2","type":"Integer","dimension":0},
{"name":"temperature","type":"Integer","dimension":0},
{"name":"pressure","type":"Integer","dimension":0},
{"name":"humidity","type":"Integer","dimension":0},
{"name":"temperatureCal","type":"Double","dimension":0},
{"name":"pressureCal","type":"Double","dimension":0},
{"name":"humidityCal","type":"Double","dimension":0},
{"name":"CO","type":"Integer","dimension":0},
{"name":"NO","type":"Integer","dimension":0},
{"name":"NO2","type":"Integer","dimension":0},
{"name":"Ozone","type":"Integer","dimension":0},
{"name":"COCal","type":"Double","dimension":0},
{"name":"NOCal","type":"Double","dimension":0},
{"name":"NO2Cal","type":"Double","dimension":0},
{"name":"OzoneCal","type":"Double","dimension":0},
{"name":"entityId","type":"Integer","dimension":"0"}]},

Can you help me out please?

Thanks beforehand

2条回答
够拽才男人
2楼-- · 2019-08-10 04:59

The integration between CEP Proactive Technology Online (Proton) and Orion uses the xml format (not json).

The Post from Orion needs to include

Content-Type: application/xml

The Appendix in the CEP Proactive Technology Online's user guide describes how to integrate between Orion and Proton.

Please note that the CEP event definition must have some attributes, and the name of the CEP input event must be [entity type]ContextUpdate, as described in the user guide's appendix

Make sure to export your updated definition and stop & start the CEP to make it run with your updated definition

查看更多
Animai°情兽
3楼-- · 2019-08-10 05:22

I have run in the same issue with the Docker instance. Despite the event definition respects the rules depicted in the Appendix A of the User Guide, the log continuously reports:

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

I decied to try with the .war files in the artifacts folder (editing the Dockerfile), instead of the ones used in the Dockerfile (the original one). Now everything works, without change the event definition.

By comparing the logs file, I noticed that the following parts are missing in the catalina.out of the original Docker instance:

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

Here the changes in the 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
查看更多
登录 后发表回答