在Java中执行informatica工作流程

时间:2017-09-13 10:14:20

标签: java informatica

我正在尝试使用jlmapi从java运行Informatica工作流程。但是由于我收到错误,我无法自行建立连接。这是我的代码: -

public class executeWorkflow {

    public static void main(String[] args) {
        // TODO Auto-generated method stub
        IJLMDriver ld = null;
        IJLMConnection connection = null;

        try {
            ld = DriverFactory.getDriver("JLMDriver10");
        } catch (JLMException e) {
            e.printStackTrace();
        }
        try {
            ld.initialize("C:\\ExecuteWorkflow_WIN64_v1\\lib\\lib\\locale");
        } catch (JLMException e1) {

            e1.printStackTrace();
        }
        try {
            connection = ld.getConnection("domain_name",6005,180,null);
        } catch (JLMException e1) {
            e1.printStackTrace();
        } 
        try {
            connection.login("","Repository","admin","pwd",null);
        } catch (JLMException e1) {
            e1.printStackTrace();
        } 
        IJLMServerDetails srvdetails = null; 
        try {
        srvdetails =connection.getServerDetails(EJLMMonitorServerMode.ALL,null);
        } catch (JLMException e) {
            e.printStackTrace();
        } 
        System.out.println("Server Status: "+srvdetails.getStatus().toString()); 
        IJLMWorkflowDetails[] workflow = srvdetails.getWorkflows(); 
        System.out.println("Number of Workflows: " + workflow.length ); 
    }

}

我收到以下错误:

Error Code: -109 Error Message: Unable to establish connection with Informatica Server Message Context: IJLMDriver::getConnection(domain,6005,180)
    at com.informatica.powercenter.sdk.lm.JLMException.handleExceptionOrWarning(JLMException.java:545)
    at com.informatica.powercenter.sdk.lm.JLMDriver10.getConnection(JLMDriver10.java:197)
    at informatica.executeWorkflow.main(executeWorkflow.java:93)
Exception in thread "main" java.lang.NullPointerException
    at informatica.executeWorkflow.main(executeWorkflow.java:99)

我做错了什么?以及getConnection参数中端口号附近的180是什么?

1 个答案:

答案 0 :(得分:0)

上述代码无效,因为Informatica版本的API从10开始。这是9.6.1,因此与API不兼容。有一个解决方法。您可以使用pmcmd.batch文件来运行工作流。您可以从java代码中调用.exe文件。我也问过这个问题。您可以在此处找到代码 - Running pmcmd from java