这是与此问题
相关的问题https://github.com/ging/fiware-cygnus/issues/6
我已经在docker上部署了物联网堆栈。这些是使用过的容器:
"Id": "sha256:b6baf1cbd18e6ba6ab5ec7d8e1d9c8a08bbc18b45037faa345e8465c890f454c",
"RepoTags": [ "ging/fiware-cygnus:latest" ],
"RepoDigests": [
"ging/fiware-cygnus@sha256:4fcf44666651ca63f1a74203bc12a7ffd9a1268f8d514dff1a83db269a1c6923"
],
"Created": "2018-10-17T15:52:19.749023834Z"
[和其他未涉及此问题的容器...]
当前图像 fiware / orion:2.0.0 正在发送标头,如下所示。
--------------------------------------------------
Standard FlowFile Attributes
Key: 'entryDate'
Value: 'Wed Oct 31 12:15:25 UTC 2018'
Key: 'lineageStartDate'
Value: 'Wed Oct 31 12:15:25 UTC 2018'
Key: 'fileSize'
Value: '144'
FlowFile Attribute Map Content
Key: 'Accept'
Value: 'application/json'
Key: 'Content-Length'
Value: '144'
Key: 'Content-Type'
Value: 'application/json; charset=UTF-8'
Key: 'Fiware-Correlator'
Value: 'a5a196d6-dd06-11e8-8f35-0242ac1c0004'
Key: 'Fiware-Service'
Value: 'testService'
Key: 'Fiware-Servicepath'
Value: '/testPath'
Key: 'Host'
Value: 'cygnus:5050'
Key: 'Ngsiv2-AttrsFormat'
Value: 'normalized'
Key: 'User-Agent'
Value: 'orion/2.0.0 libcurl/7.29.0'
Key: 'filename'
Value: '102283488692700'
Key: 'path'
Value: './'
Key: 'restlistener.remote.source.host'
Value: '172.28.0.4'
Key: 'restlistener.remote.user.dn'
Value: 'none'
Key: 'restlistener.request.uri'
Value: '/v2/notify'
Key: 'uuid'
Value: 'b20ecd8d-7d6e-4edd-be39-242a1ae1cc49'
--------------------------------------------------
具体来说,标头“ Fiware-Servicepath” 与该行代码所期望的不匹配。 “ fiware-servicepath”,“ Fiware-ServicePath”,“ fiware-servicepath”
这会导致以下错误:
`2018-10-31 12:15:41,201错误[计时器驱动的进程线程1] oanifi.processors.ngsi.NGSIToMongo NGSIToMongo [id = 8f96c89d-850a-3578-b512-2b3f5f4fdacd] java .lang.NullPointerException
我认为是此行引起的
String fiwareServicePath = (flowFile.getAttribute("fiware-servicepath")==null) ? flowFile.getAttribute("Fiware-ServicePath"):flowFile.getAttribute("fiware-servicepath");
IN
fiware-cygnus / nifi-ngsi-bundle / nifi-ngsi-processors / src / main / java / org / apache / nifi / processors / ngsi / NGSI / utils / NGSIUtils.java