Aeronbroker / Aeron

Aeron is an Internet-of-Things middleware based on the OMA NGSI 9/10 standard.
Other
23 stars 9 forks source link

SubscribeContext to Orion Context Broker via IoT Broker has failed #14

Open onlyindreams opened 8 years ago

onlyindreams commented 8 years ago

Hi, I'd like to issue a subscribeContext message to an Orion Context Broker via an IoT Broker but it has failed.

According to IoT Broker's output log, IoT Broker post a invalid json request :"notifyCondition" to Orion Context Broker. Orion can receive not "notifyCondition" but "notifyConditions".

I hope that IoT Broker will support to post subscribeContext to Orion Context Broker.

2016-08-25 17:17:41 INFO  SubscriptionController:2108 - Subscription Id-------->070Ef-09bCe-48393-2Fb14-47a90-19aE5a5dd6349e42a79
2016-08-25 17:17:41 INFO  SubscriptionController:2149 - Current Duration: P0Y1M0DT0H0M0.000S
2016-08-25 17:17:41 DEBUG DurationUtils:40 - Old Duration in millisecond:2678400000
2016-08-25 17:17:41 DEBUG DurationUtils:46 - timeElapsed in millisecond:2210
2016-08-25 17:17:41 DEBUG DurationUtils:47 - remainingDuration in millisecond:2678397790
2016-08-25 17:17:41 DEBUG DurationUtils:59 - remainingDuration in Duration: P0Y0M30DT23H59M57.790S
2016-08-25 17:17:41 INFO  SubscriptionController:2153 - New Duration: P0Y0M30DT23H59M57.790S
2016-08-25 17:17:41 DEBUG AgentWrapper:119 - Sending Request:<?xml version="1.0" encoding="UTF-8"?><subscribeContextRequest>
  <entityIdList>
    <entityId type="order_camera" isPattern="false">
      <id>order_camera1</id>
    </entityId>
  </entityIdList>
  <attributeList>
    <attribute>resolution</attribute>
    <attribute>interval</attribute>
  </attributeList>
  <reference>http://100.98.202.1:8060/ngsi10</reference>
  <duration>P0Y0M30DT23H59M57.790S</duration>
  <notifyConditions>
    <notifyCondition>
      <type>ONCHANGE</type>
      <condValueList>
        <condValue>resolution</condValue>
      </condValueList>
    </notifyCondition>
  </notifyConditions>
  <throttling>P0Y0M0DT0H0M10.000S</throttling>
</subscribeContextRequest>
 : http://localhost:1027/ngsi10
2016-08-25 17:17:41 INFO  FullHttpRequester:79 - 
Sending 'POST' request to URL : http://localhost:1027/ngsi10/subscribeContext
Put parameters : {"reference":"http://100.98.202.1:8060/ngsi10/notify","duration":"P0Y0M30DT23H59M57.790S","notifyCondition":[{"type":"ONCHANGE","condValues":["resolution"]}],"throttling":"P0Y0M0DT0H0M10.000S","entities":[{"id":"order_camera1","type":"order_camera","isPattern":false}],"attributes":["resolution","interval"]}

2016-08-25 17:17:41 INFO  FullHttpRequester:120 - 
Response Code : 200
Response : {
  "subscribeError" : {
    "errorCode" : {
      "code" : "400",
      "reasonPhrase" : "Bad Request",
      "details" : "JSON Parse Error: unknown field: /notifyCondition"
    }
  }
}

2016-08-25 17:17:41 INFO  Southbound:238 - Incoming request Valid: true
2016-08-25 17:17:41 INFO  AgentWrapper:123 - ###################Receive Request:<?xml version="1.0" encoding="UTF-8"?><subscribeContextResponse>
  <subscribeError/>
</subscribeContextResponse>

Exception in thread "Thread-15" java.lang.NullPointerException
        at eu.neclab.iotplatform.iotbroker.core.subscription.SubscriptionController$8.run(SubscriptionController.java:2238)

Best Regards, Naoya

Aeronbroker commented 8 years ago

Hi Naoya,

we have found a problem in the ngsi.api Json specification regarding the notifyConditions. The latest commit in the GitHub addresses this problem allowing subscription to the Orion CB.

Please try again with the new commit Best Regards

Flavio

onlyindreams commented 8 years ago

I have confirmed that the problem about notifyConditions was fixed but my subscriber application never receive the notify message from IoT Broker.

Please confirm following IoT Broker log.

2016-08-30 20:34:24 DEBUG ThrottlingTask:101 - SubscriptionId from TrottlingTask ---------------->67bEc-79cC9-c8c95-4F813-47897-29bE5521649836561fe
2016-08-30 20:34:24 DEBUG ThrottlingTask:107 - Trotthling task ID ---------------->67bEc-79cC9-c8c95-4F813-47897-29bE5521649836561fe
2016-08-30 20:34:24 DEBUG ThrottlingTask:111 - Terminating notification task as there are no notifications to send.
2016-08-30 20:34:28 DEBUG FilterChainProxy:337 - /ngsi10/notify at position 1 of 12 in additional filter chain; firing Filter: 'ChannelProcessingFilter'
2016-08-30 20:34:28 DEBUG AntPathRequestMatcher:116 - Checking match of request : '/ngsi10/notify'; against '/admin*'2016-08-30 20:34:28 DEBUG FilterChainProxy:337 - /ngsi10/notify at position 2 of 12 in additional filter chain; firing Filter: 'SecurityContextPersistenceFilter'
2016-08-30 20:34:28 DEBUG HttpSessionSecurityContextRepository:127 - No HttpSession currently exists
2016-08-30 20:34:28 DEBUG HttpSessionSecurityContextRepository:85 - No SecurityContext was available from the HttpSession: null. A new one will be created.
2016-08-30 20:34:28 DEBUG FilterChainProxy:337 - /ngsi10/notify at position 3 of 12 in additional filter chain; firing Filter: 'ConcurrentSessionFilter'
2016-08-30 20:34:28 DEBUG FilterChainProxy:337 - /ngsi10/notify at position 4 of 12 in additional filter chain; firing Filter: 'LogoutFilter'
2016-08-30 20:34:28 DEBUG FilterChainProxy:337 - /ngsi10/notify at position 5 of 12 in additional filter chain; firing Filter: 'UsernamePasswordAuthenticationFilter'
2016-08-30 20:34:28 DEBUG FilterChainProxy:337 - /ngsi10/notify at position 6 of 12 in additional filter chain; firing Filter: 'BasicAuthenticationFilter'
2016-08-30 20:34:28 DEBUG FilterChainProxy:337 - /ngsi10/notify at position 7 of 12 in additional filter chain; firing Filter: 'RequestCacheAwareFilter'
2016-08-30 20:34:28 DEBUG FilterChainProxy:337 - /ngsi10/notify at position 8 of 12 in additional filter chain; firing Filter: 'SecurityContextHolderAwareRequestFilter'
2016-08-30 20:34:28 DEBUG FilterChainProxy:337 - /ngsi10/notify at position 9 of 12 in additional filter chain; firing Filter: 'AnonymousAuthenticationFilter'
2016-08-30 20:34:28 DEBUG AnonymousAuthenticationFilter:102 - Populated SecurityContextHolder with anonymous token: 'org.springframework.security.authentication.AnonymousAuthenticationToken@6faad796: Principal: anonymousUser; Credentials: [PROTECTED]; Authenticated: true; Details: org.springframework.security.web.authentication.WebAuthenticationDetails@ffffa64e: RemoteIpAddress: 100.98.202.1; SessionId: null; Granted Authorities: ROLE_ANONYMOUS'
2016-08-30 20:34:28 DEBUG FilterChainProxy:337 - /ngsi10/notify at position 10 of 12 in additional filter chain; firing Filter: 'SessionManagementFilter'
2016-08-30 20:34:28 DEBUG FilterChainProxy:337 - /ngsi10/notify at position 11 of 12 in additional filter chain; firing Filter: 'ExceptionTranslationFilter'
2016-08-30 20:34:28 DEBUG FilterChainProxy:337 - /ngsi10/notify at position 12 of 12 in additional filter chain; firing Filter: 'FilterSecurityInterceptor'
2016-08-30 20:34:28 DEBUG AntPathRequestMatcher:116 - Checking match of request : '/ngsi10/notify'; against '/admin*'2016-08-30 20:34:28 DEBUG AntPathRequestMatcher:116 - Checking match of request : '/ngsi10/notify'; against '/monitoring/**'
2016-08-30 20:34:28 DEBUG FilterSecurityInterceptor:185 - Public object - authentication not attempted
2016-08-30 20:34:28 DEBUG FilterChainProxy:323 - /ngsi10/notify reached end of additional filter chain; proceeding with original chain
2016-08-30 20:34:28 DEBUG DispatcherServlet:823 - DispatcherServlet with name 'spring' processing POST request for [/ngsi10/notify]
2016-08-30 20:34:28 DEBUG RequestMappingHandlerMapping:220 - Looking up handler method for path /ngsi10/notify
2016-08-30 20:34:28 DEBUG RequestMappingHandlerMapping:227 - Returning handler method [public org.springframework.http.ResponseEntity<eu.neclab.iotplatform.ngsi.api.datamodel.NotifyContextResponse> eu.neclab.iotplatform.iotbroker.restcontroller.RestProviderController.notifyContext(javax.servlet.http.HttpServletRequest,eu.neclab.iotplatform.ngsi.api.datamodel.NotifyContextRequest)]
2016-08-30 20:34:28 DEBUG DefaultListableBeanFactory:246 - Returning cached instance of singleton bean 'RestProviderController'
2016-08-30 20:34:28 DEBUG RequestResponseBodyMethodProcessor:132 - Reading [class eu.neclab.iotplatform.ngsi.api.datamodel.NotifyContextRequest] as "application/json;charset=utf-8" using [org.springframework.http.converter.json.MappingJacksonHttpMessageConverter@3f71b8c]
2016-08-30 20:34:28 DEBUG ExceptionHandlerExceptionResolver:132 - Resolving exception from handler [public org.springframework.http.ResponseEntity<eu.neclab.iotplatform.ngsi.api.datamodel.NotifyContextResponse> eu.neclab.iotplatform.iotbroker.restcontroller.RestProviderController.notifyContext(javax.servlet.http.HttpServletRequest,eu.neclab.iotplatform.ngsi.api.datamodel.NotifyContextRequest)]: org.springframework.http.converter.HttpMessageNotReadableException: Could not read JSON: Unrecognized field "type" (Class eu.neclab.iotplatform.ngsi.api.datamodel.ContextElement), not marked as ignorable
 at [Source: org.apache.catalina.connector.CoyoteInputStream@2b00fdab; line: 7, column: 19] (through reference chain: eu.neclab.iotplatform.ngsi.api.datamodel.NotifyContextRequest["contextResponses"]->eu.neclab.iotplatform.ngsi.api.datamodel.ContextElementResponse["contextElement"]->eu.neclab.iotplatform.ngsi.api.datamodel.ContextElement["type"]); nested exception is org.codehaus.jackson.map.exc.UnrecognizedPropertyException: Unrecognized field "type" (Class eu.neclab.iotplatform.ngsi.api.datamodel.ContextElement), not marked as ignorable
 at [Source: org.apache.catalina.connector.CoyoteInputStream@2b00fdab; line: 7, column: 19] (through reference chain: eu.neclab.iotplatform.ngsi.api.datamodel.NotifyContextRequest["contextResponses"]->eu.neclab.iotplatform.ngsi.api.datamodel.ContextElementResponse["contextElement"]->eu.neclab.iotplatform.ngsi.api.datamodel.ContextElement["type"])
2016-08-30 20:34:28 DEBUG ResponseStatusExceptionResolver:132 - Resolving exception from handler [public org.springframework.http.ResponseEntity<eu.neclab.iotplatform.ngsi.api.datamodel.NotifyContextResponse> eu.neclab.iotplatform.iotbroker.restcontroller.RestProviderController.notifyContext(javax.servlet.http.HttpServletRequest,eu.neclab.iotplatform.ngsi.api.datamodel.NotifyContextRequest)]: org.springframework.http.converter.HttpMessageNotReadableException: Could not read JSON: Unrecognized field "type" (Class eu.neclab.iotplatform.ngsi.api.datamodel.ContextElement), not marked as ignorable
 at [Source: org.apache.catalina.connector.CoyoteInputStream@2b00fdab; line: 7, column: 19] (through reference chain: eu.neclab.iotplatform.ngsi.api.datamodel.NotifyContextRequest["contextResponses"]->eu.neclab.iotplatform.ngsi.api.datamodel.ContextElementResponse["contextElement"]->eu.neclab.iotplatform.ngsi.api.datamodel.ContextElement["type"]); nested exception is org.codehaus.jackson.map.exc.UnrecognizedPropertyException: Unrecognized field "type" (Class eu.neclab.iotplatform.ngsi.api.datamodel.ContextElement), not marked as ignorable
 at [Source: org.apache.catalina.connector.CoyoteInputStream@2b00fdab; line: 7, column: 19] (through reference chain: eu.neclab.iotplatform.ngsi.api.datamodel.NotifyContextRequest["contextResponses"]->eu.neclab.iotplatform.ngsi.api.datamodel.ContextElementResponse["contextElement"]->eu.neclab.iotplatform.ngsi.api.datamodel.ContextElement["type"])
2016-08-30 20:34:28 DEBUG DefaultHandlerExceptionResolver:132 - Resolving exception from handler [public org.springframework.http.ResponseEntity<eu.neclab.iotplatform.ngsi.api.datamodel.NotifyContextResponse> eu.neclab.iotplatform.iotbroker.restcontroller.RestProviderController.notifyContext(javax.servlet.http.HttpServletRequest,eu.neclab.iotplatform.ngsi.api.datamodel.NotifyContextRequest)]: org.springframework.http.converter.HttpMessageNotReadableException: Could not read JSON: Unrecognized field "type" (Class eu.neclab.iotplatform.ngsi.api.datamodel.ContextElement), not marked as ignorable
 at [Source: org.apache.catalina.connector.CoyoteInputStream@2b00fdab; line: 7, column: 19] (through reference chain: eu.neclab.iotplatform.ngsi.api.datamodel.NotifyContextRequest["contextResponses"]->eu.neclab.iotplatform.ngsi.api.datamodel.ContextElementResponse["contextElement"]->eu.neclab.iotplatform.ngsi.api.datamodel.ContextElement["type"]); nested exception is org.codehaus.jackson.map.exc.UnrecognizedPropertyException: Unrecognized field "type" (Class eu.neclab.iotplatform.ngsi.api.datamodel.ContextElement), not marked as ignorable
 at [Source: org.apache.catalina.connector.CoyoteInputStream@2b00fdab; line: 7, column: 19] (through reference chain: eu.neclab.iotplatform.ngsi.api.datamodel.NotifyContextRequest["contextResponses"]->eu.neclab.iotplatform.ngsi.api.datamodel.ContextElementResponse["contextElement"]->eu.neclab.iotplatform.ngsi.api.datamodel.ContextElement["type"])
2016-08-30 20:34:28 DEBUG HttpSessionSecurityContextRepository:269 - SecurityContext is empty or contents are anonymous - context will not be stored in HttpSession.
2016-08-30 20:34:28 DEBUG DispatcherServlet:999 - Null ModelAndView returned to DispatcherServlet with name 'spring': assuming HandlerAdapter completed request handling
2016-08-30 20:34:28 DEBUG DispatcherServlet:966 - Successfully completed request
2016-08-30 20:34:28 DEBUG ExceptionTranslationFilter:115 - Chain processed normally
2016-08-30 20:34:28 DEBUG SecurityContextPersistenceFilter:97 - SecurityContextHolder now cleared, as request processing completed
2016-08-30 20:34:28 DEBUG [localhost]:852 - Processing ErrorPage[errorCode=400, location=/WEB-INF/errors/400.html]
2016-08-30 20:34:28 DEBUG DispatcherServlet:823 - DispatcherServlet with name 'spring' processing POST request for [//WEB-INF/errors/400.html]
2016-08-30 20:34:28 DEBUG RequestMappingHandlerMapping:220 - Looking up handler method for path //WEB-INF/errors/400.html
2016-08-30 20:34:28 DEBUG RequestMappingHandlerMapping:230 - Did not find handler method for [//WEB-INF/errors/400.html]
2016-08-30 20:34:28 DEBUG SimpleUrlHandlerMapping:169 - Matching patterns for request [//WEB-INF/errors/400.html] are [/**]
2016-08-30 20:34:28 DEBUG SimpleUrlHandlerMapping:194 - URI Template variables for request [//WEB-INF/errors/400.html] are {}
2016-08-30 20:34:28 DEBUG SimpleUrlHandlerMapping:124 - Mapping [//WEB-INF/errors/400.html] to HandlerExecutionChain with handler [org.springframework.web.servlet.resource.DefaultServletHttpRequestHandler@596d9b69] and 1 interceptor
2016-08-30 20:34:28 DEBUG [default]:852 -  Disabling the response for futher output
2016-08-30 20:34:28 DEBUG DispatcherServlet:999 - Null ModelAndView returned to DispatcherServlet with name 'spring': assuming HandlerAdapter completed request handling
2016-08-30 20:34:28 DEBUG DispatcherServlet:966 - Successfully completed request
2016-08-30 20:34:28 DEBUG [spring]:852 -  Disabling the response for futher output

Does IoT Broker have any other problems?

Best Regards, Naoya