java集成kettle API报相关karaf的错误

发布于 2022-09-04 17:35:26 字数 6706 浏览 15 评论 0

测试代码:

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]

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文