简体   繁体   English

Sqoop2 Rest API链接创建

[英]Sqoop2 Rest API Link Creation


I need your help! 我需要你的帮助!
3 days i can't create link by Sqoop Rest API. 3天,我无法通过Sqoop Rest API创建链接。
Sqoop2 Server installed on the Hadoop cluster of claudera 安装在claudera的Hadoop集群上的Sqoop2服务器
I send post request with body: 我发送带有正文的帖子请求:

{
    "link" : {
        "id" : -1,
        "enabled" : true,
        "update-date" : 1415287846371,
        "creation-date" : 1415287846371,
        "update-user" : "user",
        "creation-user" : "user",
        "name" : "JDBCtest_table",
        "connector-id" : 4,
        "link-config-values" : [{
                "id" : 9,
                "inputs" : [{
                        "id" : 18,
                        "overrides" : "",
                        "name" : "linkConfig.jdbcDriver",
                        "value" : "com.postgresql.jdbc.Driver",
                        "type" : "STRING",
                        "size" : 128,
                        "sensitive" : false
                    }, {
                        "id" : 19,
                        "overrides" : "",
                        "name" : "linkConfig.connectionString",
                        "value" : "jdbc:postgresql:\/\/11.11.111.1111:5432\/database",
                        "type" : "STRING",
                        "size" : 128,
                        "sensitive" : false
                    }, {
                        "id" : 20,
                        "overrides" : "",
                        "name" : "linkConfig.username",
                        "value" : "username",
                        "type" : "STRING",
                        "size" : 40,
                        "sensitive" : false
                    }, {
                        "id" : 21,
                        "overrides" : "",
                        "name" : "linkConfig.password",
                        "value" : "pass",
                        "type" : "STRING",
                        "size" : 40,
                        "sensitive" : false
                    }, {
                        "id" : 22,
                        "overrides" : "",
                        "name" : "linkConfig.jdbcProperties",
                        "value" : {
                            "useUnicode" : true
                        },
                        "type" : "MAP",
                        "sensitive" : false
                    }
                ],
                "name" : "JDBC_test_table_Input",
                "type" : "LINK"
            }
        ]
    }
}

The server returns error: 服务器返回错误:

{
  "message": "Detected incorrect link config structure",
  "error-code-class": "org.apache.sqoop.error.code.ServerError",
  "stack-trace": [
    {
      "file": "LinkRequestHandler.java",
      "line": 146,
      "class": "org.apache.sqoop.handler.LinkRequestHandler",
      "method": "createUpdateLink"
    },
    {
      "file": "LinkRequestHandler.java",
      "line": 68,
      "class": "org.apache.sqoop.handler.LinkRequestHandler",
      "method": "handleEvent"
    },
    {
      "file": "LinkServlet.java",
      "line": 72,
      "class": "org.apache.sqoop.server.v1.LinkServlet",
      "method": "handlePostRequest"
    },
    {
      "file": "SqoopProtocolServlet.java",
      "line": 63,
      "class": "org.apache.sqoop.server.SqoopProtocolServlet",
      "method": "doPost"
    },
    {
      "file": "HttpServlet.java",
      "line": 643,
      "class": "javax.servlet.http.HttpServlet",
      "method": "service"
    },
    {
      "file": "HttpServlet.java",
      "line": 723,
      "class": "javax.servlet.http.HttpServlet",
      "method": "service"
    },
    {
      "file": "ApplicationFilterChain.java",
      "line": 290,
      "class": "org.apache.catalina.core.ApplicationFilterChain",
      "method": "internalDoFilter"
    },
    {
      "file": "ApplicationFilterChain.java",
      "line": 206,
      "class": "org.apache.catalina.core.ApplicationFilterChain",
      "method": "doFilter"
    },
    {
      "file": "AuthenticationFilter.java",
      "line": 622,
      "class": "org.apache.hadoop.security.authentication.server.AuthenticationFilter",
      "method": "doFilter"
    },
    {
      "file": "DelegationTokenAuthenticationFilter.java",
      "line": 291,
      "class": "org.apache.hadoop.security.token.delegation.web.DelegationTokenAuthenticationFilter",
      "method": "doFilter"
    },
    {
      "file": "AuthenticationFilter.java",
      "line": 574,
      "class": "org.apache.hadoop.security.authentication.server.AuthenticationFilter",
      "method": "doFilter"
    },
    {
      "file": "ApplicationFilterChain.java",
      "line": 235,
      "class": "org.apache.catalina.core.ApplicationFilterChain",
      "method": "internalDoFilter"
    },
    {
      "file": "ApplicationFilterChain.java",
      "line": 206,
      "class": "org.apache.catalina.core.ApplicationFilterChain",
      "method": "doFilter"
    },
    {
      "file": "StandardWrapperValve.java",
      "line": 233,
      "class": "org.apache.catalina.core.StandardWrapperValve",
      "method": "invoke"
    },
    {
      "file": "StandardContextValve.java",
      "line": 191,
      "class": "org.apache.catalina.core.StandardContextValve",
      "method": "invoke"
    },
    {
      "file": "StandardHostValve.java",
      "line": 127,
      "class": "org.apache.catalina.core.StandardHostValve",
      "method": "invoke"
    },
    {
      "file": "ErrorReportValve.java",
      "line": 103,
      "class": "org.apache.catalina.valves.ErrorReportValve",
      "method": "invoke"
    },
    {
      "file": "StandardEngineValve.java",
      "line": 109,
      "class": "org.apache.catalina.core.StandardEngineValve",
      "method": "invoke"
    },
    {
      "file": "CoyoteAdapter.java",
      "line": 293,
      "class": "org.apache.catalina.connector.CoyoteAdapter",
      "method": "service"
    },
    {
      "file": "Http11Processor.java",
      "line": 861,
      "class": "org.apache.coyote.http11.Http11Processor",
      "method": "process"
    },
    {
      "file": "Http11Protocol.java",
      "line": 620,
      "class": "org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler",
      "method": "process"
    },
    {
      "file": "JIoEndpoint.java",
      "line": 489,
      "class": "org.apache.tomcat.util.net.JIoEndpoint$Worker",
      "method": "run"
    },
    {
      "file": "Thread.java",
      "line": 745,
      "class": "java.lang.Thread",
      "method": "run"
    }
  ],
  "error-code": "SERVER_0003",
  "class": "org.apache.sqoop.common.SqoopException"
}

I read the documentation and can't find solution for right structure of json. 我阅读了文档,找不到json正确结构的解决方案。

I had some json issue as well, i have found this workaround to be quite useful: go to the sqoop2 shell (i type sqoop2 in the prompt of the sqoop2 server machine) when in shell, create the link/job etc' using the shell eg 'create link' command the full doc is here sqoop2 command line shell 我也有一些json问题,我发现此解决方法非常有用:在shell中时,转到sqoop2 shell(我在sqoop2服务器计算机的提示符下键入sqoop2),使用shell创建链接/作业等。例如,“创建链接”命令的完整文档在此处sqoop2命令行外壳

now you can fetch the link using the rest api - /v1/link/[lid] 现在您可以使用其余api获取链接-/ v1 / link / [lid]

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM