有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

bash从JAVA客户端执行PMCMD命令

我想从JAVA启动工作流。我使用SSH连接到informatica服务器,并执行命令pmcmd以启动工作流

JSch js = new JSch();
        Session s = js.getSession("username", "host", 22);
        s.setPassword("password");
        Properties config = new Properties();
        config.put("StrictHostKeyChecking", "no");
        s.setConfig(config);
        s.connect();

        Channel c = s.openChannel("exec");
        ChannelExec ce = (ChannelExec) c;

        ce.setCommand("pmcmd startworkflow -sv integrationservice -d Domain_dwhetl -u user -p pass-usd hq -f dvl wf_test");
        //ce.setCommand("find -name PMCMD");
        ce.setErrStream(System.err);

        ce.connect();

        BufferedReader reader = new BufferedReader(new InputStreamReader(ce.getInputStream()));
        String line;
        while ((line = reader.readLine()) != null) {
          System.out.println(line);
        }

        ce.disconnect();
        s.disconnect();

        System.out.println("Exit code: " + ce.getExitStatus());

当我运行这个命令时,我得到一个错误:bash:pmcmd:command-notfound。 如果我将路径添加到pmcmd。exe:

  ce.setCommand("/PMRootDir/pmcmd startworkflow -sv integrationservice -d Domain_dwhetl -u user -p pass-usd hq -f dvl wf_test");

我在加载共享库时收到错误:/PMRootDir/pmcmd:error:libpmasrt。所以:无法打开共享对象文件:没有这样的文件或目录

但是,当我直接在informatica server中运行这些命令时,工作流将成功启动

有人能帮忙解决这个问题吗

谢谢大家!


共 (3) 个答案

  1. # 1 楼答案

    @Samik,谢谢你! 我加了这个

    "export INFA_HOME=<path Infa installation directory>; " +
                        "export PM_HOME=<path Infa installation directory>; " +
                        "export PATH=$PATH:<path Infa installation directory>/server/bin; " +
                        "export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:<path Infa installation directory>/server/bin; "
    

    它成功了

  2. # 2 楼答案

    您需要设置环境变量路径 示例

    export PATH=$PATH:/pwc/Informatica/10.2/server/bin export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/pwc/Informatica/10.2/server/bi

  3. # 3 楼答案

    您已经设置了Informatica的安装路径,或者更具体地说,设置了pmcmd可执行文件所在的目录。 在调用pmcmd之前添加export命令

    export PATH=<path Infa installation directory>:$PATH;