天鹅座订阅错误的请求

时间:2018-10-31 16:41:20

标签: flume fiware-orion fiware-cygnus

在上下文代理中更新实体时,我已经在Orion中配置了对天鹅座的订阅。 Orion代理默认情况下具有记录器接收器。这是subscribeContext:

$ (curl localhost:1026/v1/subscribeContext -s -S --header 'Content-Type: application/json' --header 'Accept: application/json' -d @- | python -mjson.tool) <<EOF
{
"entities": [
    {
        "type": "Room",
        "isPattern": "false",
        "id": "Room1"
    }
],
"attributes": [
    "pressure",
    "temperature"
],
"reference": "http://172.17.0.3:5050/notify",
"duration": "P1M",
"notifyConditions": [
    {
        "type": "ONCHANGE",
        "condValues": [
            "pressure"
        ]
    }
],
"throttling": "PT1S"
}
EOF

当我更新实体Room1时,一个事件被发送到Cygnus,但是由于Json无效的语法,我有一个错误的请求:

  org.apache.flume.source.http.HTTPBadRequestException: Request has invalid JSON Syntax.
    at org.apache.flume.source.http.JSONHandler.getEvents(JSONHandler.java:119)
    at org.apache.flume.source.http.HTTPSource$FlumeHTTPServlet.doPost(HTTPSource.java:184)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:725)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:814)
    at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:511)
    at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:401)
    at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182)
    at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:766)
    at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
    at org.mortbay.jetty.Server.handle(Server.java:326)
    at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:542)
    at org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:945)
    at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:756)
    at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:218)
    at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404)
    at org.mortbay.jetty.bio.SocketConnector$Connection.run(SocketConnector.java:228)
    at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:582)
 Caused by: com.google.gson.JsonSyntaxException: java.lang.IllegalStateException: Expected BEGIN_ARRAY but was BEGIN_OBJECT at line 1 column 2
    at com.google.gson.Gson.fromJson(Gson.java:806)
    at com.google.gson.Gson.fromJson(Gson.java:761)
    at org.apache.flume.source.http.JSONHandler.getEvents(JSONHandler.java:117)
    ... 16 more
 Caused by: java.lang.IllegalStateException: Expected BEGIN_ARRAY but was BEGIN_OBJECT at line 1 column 2
    at com.google.gson.stream.JsonReader.expect(JsonReader.java:339)

有什么想法吗?

谢谢。

0 个答案:

没有答案