Java Pentaho 异常 MongoDB

Posted

技术标签:

【中文标题】Java Pentaho 异常 MongoDB【英文标题】:Java Pentaho Exception MongoDB 【发布时间】:2017-01-16 12:51:07 【问题描述】:

我在 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: 

加载转换时发现缺少插件

步骤:MongoDbInput 在 org.pentaho.di.trans.TransMeta.loadXML(TransMeta.java:2931) 在 org.pentaho.di.trans.TransMeta.(TransMeta.java:2813) 在 org.pentaho.di.trans.TransMeta.(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)

这背后的原因是什么?

提前谢谢你

苏西拉

【问题讨论】:

【参考方案1】:

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

KETTLE_PLUGIN_BASE_FOLDERS = /Users/dir/kettel/Plugin

【讨论】:

以上是关于Java Pentaho 异常 MongoDB的主要内容,如果未能解决你的问题,请参考以下文章

Pentaho 数据集成 Google BigQuery Loader 异常

Pentaho 命令行空指针异常

使用 UDJC 在 Pentaho 中读取受密码保护的 PDF

Pentaho 框架尺寸 (17727647) 大于最大长度 (16384000)!

Pentaho 数据集成用户定义的 Java 类

Pentaho 文本文件输入步骤崩溃(内存不足)