문제

i am trying to launch an oozie job using javacode but unable to do the same. the following code gives an exception "unhandled type oozieClientException" for a couple of lines like

String jobId = wc.run(conf);

i am new to java and am seeking for some help. here's my code:

    OozieClient wc = new OozieClient("http://host.com:11000/oozie");

    Properties conf = wc.createConfiguration();
    conf.setProperty(....)
    ...
    String jobId = wc.run(conf);
    System.out.println("Workflow job submitted");

    while (wc.getJobInfo(jobId).getStatus() == WorkflowJob.Status.RUNNING) {
       System.out.println("Workflow job running ...");
       Thread.sleep(10 * 1000);
    }
    System.out.println("Workflow job completed ...");


    System.out.println(wc.getJobInfo(jobId)); 
도움이 되었습니까?

해결책

You should close code in the try catch block

try{
    OozieClient wc = new OozieClient("http://host.com:11000/oozie");

    Properties conf = wc.createConfiguration();
    conf.setProperty(....)
    ...
    String jobId = wc.run(conf);
    System.out.println("Workflow job submitted");

    while (wc.getJobInfo(jobId).getStatus() == WorkflowJob.Status.RUNNING) {
       System.out.println("Workflow job running ...");
       Thread.sleep(10 * 1000);
    }
    System.out.println("Workflow job completed ...");


    System.out.println(wc.getJobInfo(jobId)); 
}catch(OozieClientException oozieClientException){
    oozieClientException.printStackTrace();
}

OozieClientException - thrown if the job could not be submitted

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top