[Fiware-tech-help] Issue in reading ContextBroker input events

Tali Yatzkar-Haham TALI at il.ibm.com
Wed Nov 11 14:54:18 CET 2015


I'm very glad that you find the problem and solved it!

The ports defined in the Proton.properties are used for internal 
communication between the input/output adapters and the CEP engine (it was 
a design decision to allow the adapters to run on a different machine than 
the engine. In the current configuration the adapters and the engine run 
on the same machine, but communicate via sockets)

Best regards,
Tali

Tali Yatzkar Haham
Smart Decision Solutions
IBM Research - Haifa, Israel
tali at il.ibm.com 972-4-8296320
 



From:   Juan Hurtado <juan.hurtadotomero at gmail.com>
To:     Tali Yatzkar-Haham/Haifa/IBM at IBMIL
Date:   11/11/2015 03:43 PM
Subject:        Re: Issue in reading ContextBroker input events



Thanks Tali,

I managed to get the same result and I realized the problem was on the 
port I was using for the notification. I was using the ports defined in 
Proton.properties, 3002, as explained here
Configuring an engine instance
There are two files for configuring an engine instance. Both files are 
located in the Apache Tomcat directory under ./webapps/{instance_name}
 where {instance_name} is an identifier of a Proton instance , e.g. 
ProtonOnWebServer.
The file called Proton.properties contains two port properties for the 
input and output adapters. Each engine instance should have a different 
value for these properties. The other properties should not be manually 
configured.
In the file called logging.properties

If I sent the event to port 8080, it works, but if I sent the event to 
port 3002, it does not work, although this port is configured on 
Proton.properties for input. It seems it cannot be used. Can you please 
explain why?

Many thanks for your help


2015-11-11 13:08 GMT+01:00 Tali Yatzkar-Haham <TALI at il.ibm.com>:
Dear Juan,

In order to try to recreate your issue, I removed the CEP wars from 
tomcat, downloaded them from the git artifacts folder, added them again, 
changed the setting to use your definition file, and posted your event.

1. I also had your INFO message below. It is OK. 
2. Your log file seems to be fine. 
3. When I tried to POST your event, I got the following error message:
Could not send event, reason: java.lang.NullPointerException, message: 
null
This error usually means that the attributes in the input event doesn't 
match the attributes in the event definition.
4. I noticed that in your event STCSensorContextUpdate definition, the 
attribute entityId was defined as integer and not as String as specified 
in the user manual. I fixed that, but still got the same error message.
5. Since you have many attributes in your input event POST, and I 
suspected that some of them do not match the input event definition, I 
removed almost all and POST the event.
This time the event was successfully parsed by the CEP.

In any point during this process I didn't have your error of " the the 
input stream is down due to:invalid stream header: 504F5354", and we never 
saw this error before.



 Attached is your project definition with a fix in the input event and a 
consumer change that saves the output events to file instead of sending 
them to Orion



The event that I posted to the CEP:

POST http://localhost:8080/ProtonOnWebServer/rest/events
Content-Type: application/xml

<?xml version="1.0"?>
<notifyContextRequest>
  <subscriptionId>5627a36be4ea5f2df9a9eebd</subscriptionId>
  <originator>localhost</originator>
  <contextResponseList>
    <contextElementResponse>
      <contextElement>
        <entityId type="STCSensor" isPattern="false">
          <id>705222424</id>
        </entityId>
        <contextAttributeList>
          <contextAttribute>
            <name>Altitude</name>
            <type>integer</type>
            <contextValue>720</contextValue>
          </contextAttribute>
        </contextAttributeList>
      </contextElement>
      <statusCode>
        <code>200</code>
        <reasonPhrase>OK</reasonPhrase>
      </statusCode>
    </contextElementResponse>
  </contextResponseList>
</notifyContextRequest>

and the output file that was generated (I asked the CEP





Best regards,
Tali

Tali Yatzkar Haham
Smart Decision Solutions
IBM Research - Haifa, Israel
tali at il.ibm.com 972-4-8296320




From:        Juan Hurtado <juan.hurtadotomero at gmail.com>
To:        Tali Yatzkar-Haham/Haifa/IBM at IBMIL
Date:        11/11/2015 11:31 AM
Subject:        Re: [Proton] The key [Name] was not in the map, reason: 
The key [Name] was not in the map (#15)



Dear Tali,

Please also look at this

INFO: 
validateJarFile(/var/lib/tomcat7/webapps/AuthoringToolWebServer/WEB-INF/lib/javax.servlet-api-3.1.0.jar) 
- jar not loaded. See Servlet Spec 3.0, section 10.7.2. Offending class: 
javax/servlet/Servlet.class

Thanks

2015-11-11 10:13 GMT+01:00 Juan Hurtado <juan.hurtadotomero at gmail.com>:
Dear Tali,

I have migrated to a real Ubuntu 14.04 server.

I have installed tomcat7 and I have deployed CEP Proton. However, the 
result I get is the same.

Please see below the logs when tomcat restarts

Nov 11, 2015 9:57:57 AM 
com.ibm.hrl.proton.server.adapter.eventHandlers.RequestHandler run
INFO: run: could not process input request on the Proton server, the input 
stream is down due to:invalid stream header: 504F5354
Nov 11, 2015 9:58:16 AM org.apache.coyote.AbstractProtocol pause
INFO: Pausing ProtocolHandler ["http-bio-8080"]
Nov 11, 2015 9:58:16 AM org.apache.catalina.core.StandardService 
stopInternal
INFO: Stopping service Catalina
Nov 11, 2015 9:58:16 AM 
com.ibm.hrl.proton.webapp.ProtonServletContextListener contextDestroyed
INFO: shutting down ProtonServletContextListener
Nov 11, 2015 9:58:16 AM com.ibm.hrl.proton.server.adapter.InputServer run
INFO: Proton server has been shut down...
Nov 11, 2015 9:58:16 AM com.ibm.hrl.proton.server.adapter.OutputServer run
INFO: Proton server has been shut down ...
Nov 11, 2015 9:58:16 AM 
com.ibm.hrl.proton.server.timerService.TimerServiceFacade destroyTimers
INFO: TimerServiceFacade: destroying remaining timers...
Nov 11, 2015 9:58:16 AM 
com.ibm.hrl.proton.server.timerService.TimerServiceFacade destroyTimers
INFO: TimerServiceFacade: destroyed remaining timers...
Nov 11, 2015 9:58:16 AM 
com.ibm.hrl.proton.webapp.ProtonServletContextListener contextDestroyed
INFO: finished stopping servers successfully
Nov 11, 2015 9:58:16 AM 
com.ibm.hrl.proton.admin.webapp.ProtonAdminServletContextListener 
contextDestroyed
INFO: shutting down ProtonAdminServletContextListener
Nov 11, 2015 9:58:16 AM org.apache.coyote.AbstractProtocol stop
INFO: Stopping ProtocolHandler ["http-bio-8080"]
Nov 11, 2015 9:58:16 AM org.apache.coyote.AbstractProtocol destroy
INFO: Destroying ProtocolHandler ["http-bio-8080"]
Nov 11, 2015 9:58:18 AM org.apache.catalina.startup.ClassLoaderFactory 
validateFile
WARNING: Problem with directory [/usr/share/tomcat7/common/classes], 
exists: [false], isDirectory: [false], canRead: [false]
Nov 11, 2015 9:58:18 AM org.apache.catalina.startup.ClassLoaderFactory 
validateFile
WARNING: Problem with directory [/usr/share/tomcat7/common], exists: 
[false], isDirectory: [false], canRead: [false]
Nov 11, 2015 9:58:18 AM org.apache.catalina.startup.ClassLoaderFactory 
validateFile
WARNING: Problem with directory [/usr/share/tomcat7/server/classes], 
exists: [false], isDirectory: [false], canRead: [false]
Nov 11, 2015 9:58:18 AM org.apache.catalina.startup.ClassLoaderFactory 
validateFile
WARNING: Problem with directory [/usr/share/tomcat7/server], exists: 
[false], isDirectory: [false], canRead: [false]
Nov 11, 2015 9:58:18 AM org.apache.catalina.startup.ClassLoaderFactory 
validateFile
WARNING: Problem with directory [/usr/share/tomcat7/shared/classes], 
exists: [false], isDirectory: [false], canRead: [false]
Nov 11, 2015 9:58:18 AM org.apache.catalina.startup.ClassLoaderFactory 
validateFile
WARNING: Problem with directory [/usr/share/tomcat7/shared], exists: 
[false], isDirectory: [false], canRead: [false]
Nov 11, 2015 9:58:18 AM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["http-bio-8080"]
Nov 11, 2015 9:58:18 AM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 503 ms
Nov 11, 2015 9:58:18 AM org.apache.catalina.core.StandardService 
startInternal
INFO: Starting service Catalina
Nov 11, 2015 9:58:18 AM org.apache.catalina.core.StandardEngine 
startInternal
INFO: Starting Servlet Engine: Apache Tomcat/7.0.52 (Ubuntu)
Nov 11, 2015 9:58:18 AM org.apache.catalina.startup.HostConfig deployWAR
INFO: Deploying web application archive 
/var/lib/tomcat7/webapps/AuthoringTool.war
Nov 11, 2015 10:06:11 AM org.apache.catalina.util.SessionIdGenerator 
createSecureRandom
INFO: Creation of SecureRandom instance for session ID generation using 
[SHA1PRNG] took [471,548] milliseconds.
Nov 11, 2015 10:06:11 AM org.apache.catalina.startup.HostConfig deployWAR
INFO: Deploying web application archive 
/var/lib/tomcat7/webapps/AuthoringToolWebServer.war
Nov 11, 2015 10:06:11 AM org.apache.catalina.loader.WebappClassLoader 
validateJarFile
INFO: 
validateJarFile(/var/lib/tomcat7/webapps/AuthoringToolWebServer/WEB-INF/lib/javax.servlet-api-3.1.0.jar) 
- jar not loaded. See Servlet Spec 3.0, section 10.7.2. Offending class: 
javax/servlet/Servlet.class
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinderfor further 
details.
Nov 11, 2015 10:06:11 AM org.apache.catalina.startup.HostConfig deployWAR
INFO: Deploying web application archive 
/var/lib/tomcat7/webapps/ProtonOnWebServer.war
Nov 11, 2015 10:06:12 AM 
com.ibm.hrl.proton.webapp.ProtonServletContextListener contextInitialized
INFO: initializing ProtonServletContextListener
Nov 11, 2015 10:06:12 AM 
com.ibm.hrl.proton.webapp.ProtonServletContextListener$1 run
INFO: context real path = /var/lib/tomcat7/webapps/ProtonOnWebServer/
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinderfor further 
details.
Nov 11, 2015 10:06:12 AM 
com.ibm.hrl.proton.server.executor.PropertiesParser loadProperties
INFO: Properties are : 
 metadatFile =/var/lib/tomcat7/webapps/ProtonOnWebServer/STC.json 
 inputPortNumber =3002 
 outputPortNumber =3302
Nov 11, 2015 10:06:12 AM 
com.ibm.hrl.proton.webapp.ProtonServletContextListener$1 run
INFO: init: initializing metadata and all the system singletons
Nov 11, 2015 10:06:12 AM 
com.ibm.hrl.proton.webapp.ProtonServletContextListener$1 run
INFO: init: done initializing metadata, returned the following 
exceptions: 
Nov 11, 2015 10:06:12 AM 
com.ibm.hrl.proton.webapp.ProtonServletContextListener$1 run
INFO: init: done initializing singletons , starting the servers...
Nov 11, 2015 10:06:12 AM com.ibm.hrl.proton.server.adapter.OutputServer 
run
INFO: Proton output server started, listening on output port: 3302
Nov 11, 2015 10:06:12 AM com.ibm.hrl.proton.server.adapter.InputServer run
INFO: Proton server Started, listening on port: 3002
Nov 11, 2015 10:06:12 AM org.apache.catalina.startup.HostConfig deployWAR
INFO: Deploying web application archive 
/var/lib/tomcat7/webapps/ProtonOnWebServerAdmin.war
Nov 11, 2015 10:06:13 AM 
com.ibm.hrl.proton.admin.webapp.ProtonAdminServletContextListener 
contextInitialized
INFO: initializing ProtonAdminServletContextListener
Nov 11, 2015 10:06:13 AM 
com.ibm.hrl.proton.admin.webapp.ProtonAdminServletContextListener 
contextInitialized
INFO: created popertiesFileInputStream = 
java.io.ByteArrayInputStream at 5bf2ead1
Nov 11, 2015 10:06:13 AM 
com.ibm.hrl.proton.admin.webapp.ProtonAdminServletContextListener 
contextInitialized
INFO: getServletContext().getRealPath(/) = 
/var/lib/tomcat7/webapps/ProtonOnWebServerAdmin/
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinderfor further 
details.
Nov 11, 2015 10:06:13 AM org.apache.catalina.startup.HostConfig 
deployDirectory
INFO: Deploying web application directory /var/lib/tomcat7/webapps/manager
Nov 11, 2015 10:06:13 AM org.apache.catalina.startup.HostConfig 
deployDirectory
INFO: Deploying web application directory /var/lib/tomcat7/webapps/ROOT
Nov 11, 2015 10:06:13 AM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["http-bio-8080"]
Nov 11, 2015 10:06:13 AM org.apache.catalina.startup.Catalina start
INFO: Server startup in 475249 ms


I seen an error when loading the class 
"org.slf4j.impl.StaticLoggerBinder", but that's all.

In Proton.properties, I have included the json of my project.

Please, can you check if logs are fine?

Thanks

2015-11-10 10:11 GMT+01:00 Juan Hurtado <juan.hurtadotomero at gmail.com>:
Thanks Tali,

I already did it many times without success.
I'll try removing tomcat. 

I'll keep you posted.

Regards,

Juan


2015-11-10 10:07 GMT+01:00 Tali Yatzkar-Haham <TALI at il.ibm.com>:
Maybe you could restart the VM? Hope this will solve the issue.

Best regards,
Tali

Tali Yatzkar Haham
Smart Decision Solutions
IBM Research - Haifa, Israel
tali at il.ibm.com972-4-8296320




From:        Juan Hurtado <juan.hurtadotomero at gmail.com>
To:        Tali Yatzkar-Haham/Haifa/IBM at IBMIL
Date:        10/11/2015 11:00 AM
Subject:        Re: [Proton] The key [Name] was not in the map, reason: 
The key [Name] was not in the map (#15)



Thanks Tali,

Sorry for late response.

Since I run this on a virtual machine, I always stop and start tomcat, so 
that did not solve the issue. I could re-install tomcat if you think this 
could help.

Please, let me know your view.

Best regards,
Juan

2015-11-05 11:43 GMT+01:00 Tali Yatzkar-Haham <TALI at il.ibm.com>:
Dear Juan,

I discussed it with our dev lead and showed her where this exception is 
thrown. She said that it seems to be related to internal socket 
communication problem that might be related to inconsistency due to 
previous run incorrect termination. She said that it doesn't seem to be 
related to the application definition or to the event data. Her suggestion 
is to stop tomcat, make sure it is terminated, and restart it. 

Hope it will solve your problem

Best regards,
Tali

Tali Yatzkar Haham
Smart Decision Solutions
IBM Research - Haifa, Israel
tali at il.ibm.com972-4-8296320




From:        Tali Yatzkar-Haham/Haifa/IBM
To:        Juan Hurtado <juan.hurtadotomero at gmail.com>
Date:        29/10/2015 01:29 PM
Subject:        Re: [Proton] The key [Name] was not in the map, reason: 
The key [Name] was not in the map (#15)


Thank you for this check. Now we have a way to test it in our env.

I still didn't get answer from our dev lead that is on a business trip. 
Hope to get back to you soon after she is back.

Best regards,
Tali

Tali Yatzkar Haham
Smart Decision Solutions
IBM Research - Haifa, Israel
tali at il.ibm.com972-4-8296320





From:        Juan Hurtado <juan.hurtadotomero at gmail.com>
To:        Tali Yatzkar-Haham/Haifa/IBM at IBMIL
Date:        29/10/2015 12:18 PM
Subject:        Re: [Proton] The key [Name] was not in the map, reason: 
The key [Name] was not in the map (#15)



Hello Tali,

I have attached the POST sent directly to CEP. The result is the same. 
Could you please check if there is anything wrong?

Thanks beforehand

2015-10-28 11:34 GMT+01:00 Tali Yatzkar-Haham <TALI at il.ibm.com>:
Thank you for the clarification.

Can you please try my suggestion? to send the event POST directly to the 
CEP as if Orion sent it (with the same data and with the application/xml 
header)?

Something like the POST below, but with the right CEP url, and the right 
data?

Maybe this will give us a clue what is the problem


POST http://cep.lab.fi-ware.eu:8089/ProtonOnWebServer/rest/events
Content-Type: application/xml
Data:
<notifyContextRequest> ....
....
....
</notifyContextRequest>

Thanks
Tali

Tali Yatzkar Haham
Smart Decision Solutions
IBM Research - Haifa, Israel
tali at il.ibm.com972-4-8296320




From:        Juan Hurtado <juan.hurtadotomero at gmail.com>
To:        Tali Yatzkar-Haham/Haifa/IBM at IBMIL
Date:        28/10/2015 12:27 PM
Subject:        Re: [Proton] The key [Name] was not in the map, reason: 
The key [Name] was not in the map (#15)



Yes, you are right, sorry. Please find below the POST sent to Orion to get 
Proton subscribed

curl 192.168.90.4:1026/v1/subscribeContext?notifyFormat=xml-s -S --header 
'Content-Type: application/json' --header 'Accept: application/json' 
--header 'Fiware-Service: ct_stc' -d @- | python -mjson.tool)

notifyFormat is set to XML and I've checked that Orion is sending XML.

Thanks

2015-10-28 11:19 GMT+01:00 Tali Yatzkar-Haham <TALI at il.ibm.com>:
Thank you for the clarification.

In the STC.json I see that the CEP will send messages to Orion in the xml 
format. I understand that this direction works fine. Your issue is with 
the other direction, having the CEP process events that are sent from 
Orion. This is not part of the CEP definition file (STC.json).

Since you have the event data, could you please try to send it directly to 
the CEP (with the application/xml header) using curl or some browser 
extension (I'm using Postman extension for Chrome)?
Maybe this will give us some hint on the problem.

Thank you,
Tali

Tali Yatzkar Haham
Smart Decision Solutions
IBM Research - Haifa, Israel
tali at il.ibm.com972-4-8296320




From:        Juan Hurtado <juan.hurtadotomero at gmail.com>
To:        Tali Yatzkar-Haham/Haifa/IBM at IBMIL
Date:        28/10/2015 12:05 PM
Subject:        Re: [Proton] The key [Name] was not in the map, reason: 
The key [Name] was not in the map (#15)



Thanks for you message. I was having a look at the headers but this is 
sent by Orion and I do not think this can be modified or changed.

Aboout the info, it was part of the log I made, sorry for not removing it. 
And yes, Content-Type is application/xml as you can see in 
STC.json, {"name":"contentType","value":"application/xml"}

Thank you for your help

2015-10-28 10:42 GMT+01:00 Tali Yatzkar-Haham <TALI at il.ibm.com>:
Thank you.

Because the Java exception is invalid stream header: 504F5354, I'm wander 
if you know what were the header parameters. Can you see them?

Another question - do you know why the info below says "Este es el Json"? 
I want to make sure the data is sent with Content-Type: application/xml

Thanks,
Tali

Tali Yatzkar Haham
Smart Decision Solutions
IBM Research - Haifa, Israel
tali at il.ibm.com972-4-8296320




From:        Juan Hurtado <juan.hurtadotomero at gmail.com>
To:        Tali Yatzkar-Haham/Haifa/IBM at IBMIL
Date:        27/10/2015 06:00 PM
Subject:        Re: [Proton] The key [Name] was not in the map, reason: 
The key [Name] was not in the map (#15)



Please find below



[Wed, 21 Oct 2015 16:38:35 +0200] INFO 206:Este es el Json: 
<notifyContextRequest>
  <subscriptionId>5627a36be4ea5f2df9a9eebd</subscriptionId>
  <originator>localhost</originator>
  <contextResponseList>
    <contextElementResponse>
      <contextElement>
        <entityId type="STCSensor" isPattern="false">
          <id>705222424</id>
        </entityId>
        <contextAttributeList>
          <contextAttribute>
            <name>Altitude</name>
            <type>integer</type>
            <contextValue>720</contextValue>
          </contextAttribute>
          <contextAttribute>
            <name>AltitudeDelta1</name>
            <type>integer</type>
            <contextValue>720</contextValue>
          </contextAttribute>
          <contextAttribute>
            <name>AltitudeDelta2</name>
            <type>integer</type>
            <contextValue>720</contextValue>
          <contextAttribute>
            <name>BatteryLevel</name>
            <type>integer</type>
            <contextValue>2</contextValue>
          </contextAttribute>
          <contextAttribute>
            <name>CO</name>
            <type>integer</type>
            <contextValue>720</contextValue>
          </contextAttribute>
          <contextAttribute>
            <name>COCal</name>
            <type>float</type>
            <contextValue>720</contextValue>
          </contextAttribute>
          <contextAttribute>
            <name>CurrentRSSI</name>

And so on. Please let me know if you need the whole file.

Thanks

2015-10-27 13:52 GMT+01:00 Tali Yatzkar-Haham <TALI at il.ibm.com>:
Hi Juan,

I sent it to our development lead to see if she is familiar with this 
error.

Meanwhile, I looked in the subscription (at stackoverflow) - where in that 
subscription you specify that Proton expects the xml format?

Thanks,
Tali

Tali Yatzkar Haham
Smart Decision Solutions
IBM Research - Haifa, Israel
tali at il.ibm.com972-4-8296320




From:        Juan Hurtado <juan.hurtadotomero at gmail.com>
To:        Tali Yatzkar-Haham/Haifa/IBM at IBMIL
Date:        27/10/2015 11:16 AM
Subject:        Re: [Proton] The key [Name] was not in the map, reason: 
The key [Name] was not in the map (#15)




Dear Tali,

Please find enclosed the logs.

The action I wanted to do is the following:
- I have deployed Orion as a Docker instance in my localhost (Ubuntu 
14.04)
- I have deployed Proton on Tomcat7 (not using Docker).
- I have created a project (STC, also enclosed json file). This project 
consists of sending an alarm (STCAlarm event) to Orion if no STCevent has 
been received in the last 10 minutes)
- I have modified Proton.properties to point STC.json
- I have restarted Proton and I see Proton sends the STCAlarm to Orion if 
no events received.
- In parallel, Orion is trying to send Proton events, but Proton is 
rejecting those events due to: " the the input stream is down due 
to:invalid stream header: 504F5354"
- In Stackoverflow you can find the xml Orion is sending to Proton.

Please let me know if you need anything else.

Thanks beforehand[attachment "STC.json" deleted by Tali 
Yatzkar-Haham/Haifa/IBM] [attachment "catalina.out" deleted by Tali 
Yatzkar-Haham/Haifa/IBM] 







[attachment "notifyProton.sh" deleted by Tali Yatzkar-Haham/Haifa/IBM] 










-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.fiware.org/private/fiware-tech-help/attachments/20151111/5db2b0ae/attachment.html>


More information about the Fiware-tech-help mailing list

You can get more information about our cookies and privacy policies clicking on the following links: Privacy policy   Cookies policy