Streamsets Javascript 加载脚本错误 JQuery

Streamsets Javascript scripting error loading JQuery

我正在尝试在 Streamsets Javascript Scripting Origin 中加载 JQuery 以查询 rest api 并收到错误。代码如下所示,java 加载权限在 /etc/sdc/sdc-security.policy 中给出。任何人都有示例 Streamsets java 脚本代码来查询 rest api?

load('file:///opt/streamsets-datacollector/resources/jquery-3.5.1.min.js');

var settings = {
  "url": "https://example.com/abc?parm1=123&parm2=456",
  "method": "GET",
  "timeout": 0,
  "headers": {
    "Accept": "application/vnd.mds.provider+json;version=0.3",
    "Authorization": "Bearer some-token-xxxxx"
  },
};

$.ajax(settings).done(function (response) {
  console.log(response);
});

下面是堆栈错误:

com.streamsets.pipeline.api.StageException: SCRIPTING_10 - Script error in user script: javax.script.ScriptException: TypeError: Cannot read property "createElement" from undefined in file:/opt/streamsets-datacollector/resources/jquery-3.5.1.min.js at line number 2
    at com.streamsets.pipeline.stage.origin.scripting.AbstractScriptingSource.produce(AbstractScriptingSource.java:137)
    at com.streamsets.pipeline.api.base.configurablestage.DPushSource.produce(DPushSource.java:44)
    at com.streamsets.datacollector.runner.StageRuntime.lambda$execute(StageRuntime.java:270)
    at com.streamsets.datacollector.runner.StageRuntime.execute(StageRuntime.java:244)
    at com.streamsets.datacollector.runner.StageRuntime.execute(StageRuntime.java:279)
    at com.streamsets.datacollector.runner.SourcePipe.process(SourcePipe.java:79)
    at com.streamsets.datacollector.execution.runner.common.ProductionPipelineRunner.runPushSource(ProductionPipelineRunner.java:426)
    at com.streamsets.datacollector.execution.runner.common.ProductionPipelineRunner.run(ProductionPipelineRunner.java:388)
    at com.streamsets.datacollector.runner.Pipeline.run(Pipeline.java:533)


JQuery通常用于HTML文档遍历。您应该考虑使用 HTTP Client origin 来调用 REST API 端点。

干杯, 破折号