数据挖掘 - java集成kettle API报相关karaf的错误
PHP中文网
PHP中文网 2017-04-18 10:51:36
0
0
2839

测试代码:

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/maven-v4_0_0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>com.firewarm</groupId>
    <artifactId>testKettle</artifactId>
    <packaging>war</packaging>
    <version>0.0.1-SNAPSHOT</version>
    <name>testKettle Maven Webapp</name>
    <url>http://maven.apache.org</url>
    <repositories>
        <repository>
            <id>mine</id>
            <name>public Releases</name>
            <layout>default</layout>
            <url>http://app.firewarm.com:8088/nexus/content/groups/public/</url>
        </repository>
    </repositories>
    <properties>
        <mysql-connector-java.version>5.1.9</mysql-connector-java.version>
        <kettle-version>7.0.0.3-59</kettle-version>
    </properties>
    <dependencies>
        <dependency>
            <groupId>cn.firewarm.utils</groupId>
            <artifactId>basicUtils</artifactId>
            <version>0.0.3-SNAPSHOT</version>
        </dependency>
        <dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
            <version>${mysql-connector-java.version}</version>
        </dependency>
        <dependency>
            <groupId>org.safehaus.jug</groupId>
            <artifactId>jug</artifactId>
            <version>2.0.0</version>
            <!-- the classifer is important!! -->
            <classifier>lgpl</classifier>
        </dependency>
        <dependency>
            <groupId>commons-pool</groupId>
            <artifactId>commons-pool</artifactId>
            <version>1.6</version>
        </dependency>
        <dependency>
            <groupId>commons-dbcp</groupId>
            <artifactId>commons-dbcp</artifactId>
            <version>1.4</version>
        </dependency>

        <dependency>
            <groupId>pentaho-kettle</groupId>
            <artifactId>kettle-core</artifactId>
            <version>${kettle-version}</version>
        </dependency>
        <dependency>
            <groupId>pentaho-kettle</groupId>
            <artifactId>kettle-engine</artifactId>
            <version>${kettle-version}</version>
        </dependency>
        <dependency>
            <groupId>pentaho</groupId>
            <artifactId>pdi-osgi-bridge-core</artifactId>
            <version>${kettle-version}</version>
        </dependency>
        <dependency>
            <groupId>pentaho</groupId>
            <artifactId>pentaho-platform-extensions</artifactId>
            <version>${kettle-version}</version>
            <exclusions>
                <exclusion>
                    <artifactId>xbean</artifactId>
                    <groupId>org.apache.xbean</groupId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>com.google.guava</groupId>
            <artifactId>guava</artifactId>
            <version>19.0</version>
        </dependency>
        <!-- logback 配置 -->
        <dependency>
            <groupId>ch.qos.logback</groupId>
            <artifactId>logback-classic</artifactId>
            <version>1.1.2</version>
        </dependency>
        <dependency>
            <groupId>ch.qos.logback</groupId>
            <artifactId>logback-core</artifactId>
            <version>1.1.2</version>
        </dependency>
        <!-- logback 配置, end -->


    </dependencies>
    <build>
        <finalName>testKettle</finalName>
    </build>
</project>

java文件

public class TestKettle {
    public static void main(String[] args) {
        runTransformation("C:/Users/lighting/Downloads/pdi-ce-7.0.0.0-25/data-integration/test.ktr");
    }

    public static void runTransformation(String filename) {
        try {
            System.setProperty("KETTLE_HOME", "C:/Users/lighting/Downloads/pdi-ce-7.0.0.0-25");
            KettleEnvironment.init();
            TransMeta transMeta = new TransMeta(filename);
            Trans trans = new Trans(transMeta);
            String[] pars = {};
            trans.execute(pars);
            trans.waitUntilFinished();
            if (trans.getErrors() > 0) {
                throw new RuntimeException("There were errors during transformation execution.");
            }
        } catch (KettleException e) {
            System.out.println(e);
        }
    }
}

报错信息:

11:29:15,963 WARN  [KarafBoot] Karaf not found in standard dir of './system/karaf' 
11:29:15,974 ERROR [KarafBoot] Error starting Karaf
java.io.FileNotFoundException: Source '.\system\karaf' does not exist
    at org.apache.commons.io.FileUtils.copyDirectory(FileUtils.java:866)
    at org.apache.commons.io.FileUtils.copyDirectory(FileUtils.java:814)
    at org.pentaho.platform.osgi.KarafBoot.startup(KarafBoot.java:187)
    at org.pentaho.di.osgi.registryExtension.OSGIPluginRegistryExtension.init(OSGIPluginRegistryExtension.java:105)
    at org.pentaho.di.core.plugins.PluginRegistry.init(PluginRegistry.java:558)
    at org.pentaho.di.core.KettleClientEnvironment.init(KettleClientEnvironment.java:101)
    at org.pentaho.di.core.KettleEnvironment.init(KettleEnvironment.java:96)
    at org.pentaho.di.core.KettleEnvironment.init(KettleEnvironment.java:74)
    at testKettle.TestKettle.runTransformation(TestKettle.java:24)
    at testKettle.TestKettle.main(TestKettle.java:18)
11:30:56,443 ERROR [KarafLifecycleListener] The Kettle Karaf Lifecycle Listener failed to execute properly after waiting for 100 seconds. Releasing lifecycle hold, but some services may be unavailable.
2017/03/23 11:30:56 - test - 为了转换解除补丁开始  [test]

查找了相关资料,不知道如何解决

PHP中文网
PHP中文网

认证0级讲师

모든 응답(0)
최신 다운로드
더>
웹 효과
웹사이트 소스 코드
웹사이트 자료
프론트엔드 템플릿