0

我在 Pentaho Data Integration ui 工具中设计了一个转换,并编写了一个 java 代码来执行转换。我照原样按照以下资源链接进行操作,

try {
      /**
       * Initialize the Kettle Enviornment
       */
      KettleEnvironment.init();

      /**
       * Create a trans object to properly assign the ktr metadata.
       * 
       * @filedb: The ktr file path to be executed.
       * 
       */
      TransMeta metadata = new TransMeta("Districts.ktr");
      Trans trans = new Trans(metadata);

      // Execute the transformation
      trans.execute(null);
      trans.waitUntilFinished();

      // checking for errors
      if (trans.getErrors() > 0) {
          System.out.println("Erroruting Transformation");
      }

  } catch (KettleException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
  }  

我的 POM.xml 在下面

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.test.kettle</groupId>
<artifactId>kettle-run</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<properties>
    <pentaho-kettle.version>5.0.0.1</pentaho-kettle.version>
    <postgres.version>9.2-1004-jdbc41</postgres.version>
</properties>

<repositories>
    <repository>
        <id>pentaho-releases</id>
        <url>http://repository.pentaho.org/artifactory/repo/</url>
    </repository>
</repositories>

<dependencies>
    <dependency>
        <groupId>pentaho-kettle</groupId>
        <artifactId>kettle-core</artifactId>
        <version>${pentaho-kettle.version}</version>
    </dependency>
    <dependency>
        <groupId>pentaho-kettle</groupId>
        <artifactId>kettle-dbdialog</artifactId>
        <version>${pentaho-kettle.version}</version>
    </dependency>
    <dependency>
        <groupId>commons-vfs</groupId>
        <artifactId>commons-vfs</artifactId>
        <version>1.0</version>
    </dependency>
    <dependency>
        <groupId>pentaho-kettle</groupId>
        <artifactId>kettle-engine</artifactId>
        <version>${pentaho-kettle.version}</version>
    </dependency>
    <dependency>
        <groupId>pentaho-kettle</groupId>
        <artifactId>kettle-ui-swt</artifactId>
        <version>${pentaho-kettle.version}</version>
    </dependency>
    <dependency>
        <groupId>pentaho-library</groupId>
        <artifactId>libformula</artifactId>
        <version>5.0.2</version>
        <exclusions>
            <exclusion>
                <groupId>commons-logging</groupId>
                <artifactId>commons-logging-api</artifactId>
            </exclusion>
        </exclusions>
    </dependency>
    <dependency>
        <groupId>org.codehaus.janino</groupId>
        <artifactId>janino</artifactId>
        <version>2.5.16</version>
    </dependency>
    <dependency>
        <groupId>org.mozilla</groupId>
        <artifactId>rhino</artifactId>
        <version>1.7R5</version>
    </dependency>
    <dependency>
        <groupId>javax.mail</groupId>
        <artifactId>javax.mail-api</artifactId>
        <version>1.4.7</version>
    </dependency>
    <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>slf4j-api</artifactId>
        <version>1.6.4</version>
    </dependency>

    <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>slf4j-log4j12</artifactId>
        <version>1.6.4</version>
    </dependency>

    <dependency>
        <groupId>org.postgresql</groupId>
        <artifactId>postgresql</artifactId>
        <version>${postgres.version}</version>
    </dependency>
    <dependency>
        <groupId>pentaho</groupId>
        <artifactId>pentaho-mongodb-plugin</artifactId>
        <version>5.0.4</version>
    </dependency>
    <dependency>
        <groupId>org.mongodb</groupId>
        <artifactId>mongo-java-driver</artifactId>
        <version>2.11.1</version>
    </dependency>
</dependencies>

我的转换有 Mongo DB 输入,然后插入到 postgresql。使用 pentaho 版本 5.0.0.1 它会引发以下错误

org.pentaho.di.core.exception.KettleMissingPluginsException: 

加载转换时发现缺少插件

步骤:在 org.pentaho.di.trans.TransMeta.(TransMeta.java:2813) 在 org.pentaho.di.trans.TransMeta 的 org.pentaho.di.trans.TransMeta.loadXML(TransMeta.java:2931) 的 MongoDbInput .(TransMeta.java:2774) 在 org.pentaho.di.trans.TransMeta.(TransMeta.java:2759) 在 org.pentaho.di.trans.TransMeta.(TransMeta.java:2744) 在 org.pentaho.di .trans.TransMeta.(TransMeta.java:2718) 在 org.pentaho.di.trans.TransMeta.(TransMeta.java:2690) 在 org.kettle.test.Execute.main(Execute.java:72)

这背后的原因可能是什么?

先感谢您

图西拉

4

1 回答 1

0

添加kettle.properties文件插件文件夹位置

KETTLE_PLUGIN_BASE_FOLDERS = /Users/dir/kettel/Plugin

于 2017-01-17T12:35:58.750 回答