1

My Proton instance fails with a java.lang.NullPointerException whenever an event is sent by Orion

this is the Proton log:

proton_1 | 01-Jul-2016 09:46:03.117 INFO [http-nio-8080-exec-1] com.ibm.hrl.proton.webapp.providers.EventXmlNgsiMessageReader.readFrom started event message body reader
proton_1 | 01-Jul-2016 09:46:03.125 INFO [http-nio-8080-exec-1] com.ibm.hrl.proton.webapp.providers.EventXmlNgsiMessageReader.readFrom Event: ApeContextUpdate
proton_1 | 01-Jul-2016 09:46:03.126 SEVERE [http-nio-8080-exec-1] com.ibm.hrl.proton.webapp.providers.EventXmlNgsiMessageReader.readFrom Could not parse XML NGSI event java.lang.NullPointerException, reason: null
proton_1 |  last attribute name: null last value: null
proton_1 | 01-Jul-2016 09:46:03.130 INFO [http-nio-8080-exec-1] com.ibm.hrl.proton.webapp.providers.EventXmlNgsiMessageReader.readFrom finished event message body reader
proton_1 | 01-Jul-2016 09:46:03.131 INFO [http-nio-8080-exec-1] com.ibm.hrl.proton.webapp.resources.EventResource.submitNewEvent starting submitNewEvent
proton_1 | 01-Jul-2016 09:46:03.132 SEVERE [http-nio-8080-exec-1] com.ibm.hrl.proton.webapp.resources.EventResource.submitNewEvent Could not send event, reason: java.lang.NullPointerException, message: null

I've read the Appendix of the User guide and double checked the event name and the attributes list.

This is an xml sent by orion:

POST /ProtonOnWebServer/rest/events HTTP/1.1
User-Agent: orion/0.28.0 libcurl/7.19.7
Host: localhost:8080
Accept: application/xml, application/json
Content-length: 772
Content-type: application/xml

<notifyContextRequest>
<subscriptionId>57762eb9982959644644f9ee</subscriptionId>
<originator>localhost</originator>
<contextResponseList>
    <contextElementResponse>
    <contextElement>
        <entityId type="Ape" isPattern="false">
        <id>u1</id>
        </entityId>
        <contextAttributeList>
        <contextAttribute>
            <name>carsharing</name>
            <type>urn:x-ogc:def:trs:IDAS:1.0:ISO8601</type>
            <contextValue>2016-07-01T11:01:06</contextValue>
        </contextAttribute>
        </contextAttributeList>
    </contextElement>
    <statusCode>
        <code>200</code>
        <reasonPhrase>OK</reasonPhrase>
    </statusCode>
    </contextElementResponse>
</contextResponseList>
</notifyContextRequest>

This is the definition of the Proton project (BTW this is the project copied from the server filesystem because also the rest api fails with a NullPointerException)

{
"epn": {
    "events": [
    {
        "name": "ApeContextUpdate",
        "createdDate": "Fri Jul 01 2016",
        "attributes": [
        {
            "name": "entityId",
            "type": "String",
            "dimension": "0"
        },
        {
            "name": "entityType",
            "type": "String",
            "dimension": "0"
        },
        {
            "name": "carsharing",
            "type": "Date",
            "dimension": "0"
        }
        ]
    }
    ],
    "epas": [],
    "contexts": {
    "temporal": [],
    "segmentation": [],
    "composite": []
    },
    "consumers": [],
    "producers": [],
    "name": "t0"
}
}

and this is my docker-compose file:

mongo:
  image: mongo:2.6
  command: --smallfiles --quiet

proton:
  image: fiware/proactivetechnologyonline
  ports:
      - "8080:8080"

orion:
  image: fiware/orion:0.28
  links:
    - mongo
    - proton
  command: -dbhost mongo --silent
  ports:
      - "1026:1026"

I'm using Orion 0.28 (the last one that supports XML notifications) and the latest Proton

UPDATE 1 - catalina.log

07-Jul-2016 07:52:39.914 INFO [http-nio-8080-exec-1] com.ibm.hrl.proton.webapp.providers.EventXmlNgsiMessageReader.readFrom started event message body reader
07-Jul-2016 07:52:39.924 INFO [http-nio-8080-exec-1] com.ibm.hrl.proton.webapp.providers.EventXmlNgsiMessageReader.readFrom Event: ApeContextUpdate
07-Jul-2016 07:52:39.924 SEVERE [http-nio-8080-exec-1] com.ibm.hrl.proton.webapp.providers.EventXmlNgsiMessageReader.readFrom Could not parse XML NGSI event java.lang.NullPointerException, reason: null
 last attribute name: null last value: null
07-Jul-2016 07:52:39.928 INFO [http-nio-8080-exec-1] com.ibm.hrl.proton.webapp.providers.EventXmlNgsiMessageReader.readFrom finished event message body reader
07-Jul-2016 07:52:39.929 INFO [http-nio-8080-exec-1] com.ibm.hrl.proton.webapp.resources.EventResource.submitNewEvent starting submitNewEvent
07-Jul-2016 07:52:39.929 SEVERE [http-nio-8080-exec-1] com.ibm.hrl.proton.webapp.resources.EventResource.submitNewEvent Could not send event, reason: java.lang.NullPointerException, message: null
dvd
  • 1,014
  • 6
  • 12
  • As fas I have checked, the sent by Orion is well formed, so it doesn't seem to be a problem at Orion. – fgalan Jul 04 '16 at 10:00
  • OK, so you are aware of the incompatibility of JSON messages in the latest ORION release which is not yet supported by PROTON. Thanks for the details. Looking into the problem. – urishani Jul 04 '16 at 12:52

1 Answers1

1

The problem seems to be that your Proton instance is not actually configured with your project's JSON definition file, therefore when sending the POST of any type you will always get NullPointerException since no such event can be found in Proton's metadata.

Please try to configure your instance's admin interface, as described here: http://proactive-technology-online.readthedocs.io/en/latest/Proton-InstallationAndAdminGuide/index.html (Setup Apache Tomcat for management part)

And then run the following query: GET //<ip of the machine running Proton>:8080/ProtonOnWebServerAdmin/resources/definitions. This should return the all the project definitions this instance have... And then if you see this in the list, you can retrieve your specific project's definition by running: GET /<ip of the machine running Proton>:8080/resources/definitions/{definition_name}. I think this will either return nothing, or will be empty.

You can update the definitions by using RESTful interface as described here: http://forge.fiware.org/plugins/mediawiki/wiki/fiware/index.php/Complex_Event_Processing_Open_RESTful_API_Specification (under the Managing Definitions Repository part)

fgalan
  • 11,732
  • 9
  • 46
  • 89
inna
  • 11
  • 1
  • Unfortunately the API `/ProtonOnWebServerAdmin/resources/definitions` does not work; it also fails with a java.lang.NullPointerException. I wrote about this behaviour in the original question but probably it was overwhelmed by the pasted snippets – dvd Jul 04 '16 at 15:56
  • I would like to see the catalina.log of your Tomcat server... According to the symptoms you are describing , I am not sure the application is installed properly – inna Jul 07 '16 at 06:46
  • Added the relevant lines from catalina.log;But if it is a installation issue, it means that the docker image is broken? – dvd Jul 07 '16 at 08:06