手动注册插件

问题描述 投票:1回答:1

[我正在尝试使用Java代码中嵌入的PDI运行转换,但是出现关于缺少插件的错误(看起来像是中止步骤)。

[我知道我可以使用KETTLE_PLUGIN_BASE_FOLDERS以便PDI自动加载它(可以工作),但是为了使我的应用程序更简单,我想使用Java手动注册此插件,我该怎么做?

我正在关注此处提供的示例https://github.com/pentaho/pdi-sdk-plugins/tree/master/kettle-sdk-embedding-samples

2019/08/14 17:03:07 - Could not find on destination DB.0 - ERROR (version 8.2.0.7-719, build 8.2.0.7-719 from 2019-06-24 02.06.35 by buildguy) : Can't run transformation due to plugin missing
2019/08/14 17:03:07 - Could not find on source DB.0 - ERROR (version 8.2.0.7-719, build 8.2.0.7-719 from 2019-06-24 02.06.35 by buildguy) : Can't run transformation due to plugin missing
2019/08/14 17:03:07 - Could not find on destination DB.0 - ERROR (version 8.2.0.7-719, build 8.2.0.7-719 from 2019-06-24 02.06.35 by buildguy) : Error initializing step [Could not find on destination DB]
2019/08/14 17:03:07 - Could not find on source DB.0 - ERROR (version 8.2.0.7-719, build 8.2.0.7-719 from 2019-06-24 02.06.35 by buildguy) : Error initializing step [Could not find on source DB]
2019/08/14 17:03:07 - Could not find on destination DB 2.0 - ERROR (version 8.2.0.7-719, build 8.2.0.7-719 from 2019-06-24 02.06.35 by buildguy) : Can't run transformation due to plugin missing
2019/08/14 17:03:07 - Could not find on destination DB 2.0 - ERROR (version 8.2.0.7-719, build 8.2.0.7-719 from 2019-06-24 02.06.35 by buildguy) : Error initializing step [Could not find on destination DB 2]
2019/08/14 17:03:07 - Abort.0 - ERROR (version 8.2.0.7-719, build 8.2.0.7-719 from 2019-06-24 02.06.35 by buildguy) : Can't run transformation due to plugin missing
2019/08/14 17:03:07 - Abort.0 - ERROR (version 8.2.0.7-719, build 8.2.0.7-719 from 2019-06-24 02.06.35 by buildguy) : Error initializing step [Abort]
plugins pentaho kettle pdi
1个回答
1
投票

要注册插件,必须在初始化KettleEnvironment之前,使用插件元类的完全限定类名设置系统属性KETTLE_PLUGIN_CLASSES。该属性可以是您要注册的所有插件的逗号分隔的字符串。

这是如何注册插件的示例:

  void initEnv() {
    // Register plugins here
    System.setProperty("KETTLE_PLUGIN_CLASSES","org.pentaho.di.trans.steps.jsoninput.JsonInputMeta");
    try {
      KettleEnvironment.init();
    } catch (KettleException e) {
      e.printStackTrace();
    }
  }

此示例注册了JSON Input步骤,它是一个核心插件。为了PDI成功加载插件,它的jar文件必须在类路径中可用。

© www.soinside.com 2019 - 2024. All rights reserved.