简体   繁体   English

从JAVA Client执行PMCMD命令

[英]Executing PMCMD command from JAVA Client

I want to start workflow from JAVA. 我想从JAVA开始工作流程。 I connect to informatica server using SSH and execute the command pmcmd to start workflow 我使用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());

When I run this I'm getting the error : bash: pmcmd: command not found. 运行此命令时出现错误:bash:pmcmd:命令未找到。 If I add path to pmcmd.exe: 如果我将路径添加到pmcmd.exe:

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

I get the error: /PMRootDir/pmcmd: error while loading shared libraries: libpmasrt.so: cannot open shared object file: No such file or directory 我收到错误:/ PMRootDir / pmcmd:加载共享库时出错:libpmasrt.so:无法打开共享库文件:没有这样的文件或目录

But when I run those commands in informatica server directly the workflow starts successfully. 但是,当我直接在Informatica服务器中运行这些命令时,工作流将成功启动。

Cand anyone help to solve this problem? 任何人都可以帮助解决这个问题吗?

Thank you! 谢谢!

You have set the PATH to where Informatica is installed, or more specifically the directory the pmcmd executable is present. 您已将PATH设置为Informatica的安装位置,或更具体地说是pmcmd可执行文件所在的目录。 Add the export command before calling pmcmd. 在调用pmcmd之前添加导出命令。

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

@Samik, Thank you! @Samik,谢谢! I've added this 我添加了这个

"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; "

and it worked 而且有效

You need to set Environment Variable Path Example 您需要设置环境变量路径示例

export PATH=$PATH:/pwc/Informatica/10.2/server/bin export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/pwc/Informatica/10.2/server/bi 导出PATH = $ PATH:/pwc/Informatica/10.2/服务器/ bin导出LD_LIBRARY_PATH = $ LD_LIBRARY_PATH:/pwc/Informatica/10.2/server/bi

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM