刚开始使用oozie,使用简单的测试类(不是客户端)和webservices,但遇到身份验证问题。我相信服务器设置为进行简单的身份验证(继承这些配置)。
<property>
<name>oozie.authentication.simple.anonymous.allowed</name>
<value>true</value>
</property>
<property>
<name>oozie.authentication.type</name>
<value>simple</value>
</property>
但我不确定授权是如何运作的。在/etc/conf/adminusers.text下,有用户&#34; oozie&#34;。从documentation开始,我似乎应该通过&#34; user.name&#34;作为请求的一部分。尝试将其作为XML的一部分传递会导致401错误,将user.name=oozie
添加到查询字符串也是如此。
public void submitJob(String xmlJob) throws IOException {
HttpClient client = new HttpClient(HADOOP_CON_MGR);
String url = getJobsUrl();
PostMethod method = new PostMethod(url);
method.setRequestEntity(new StringRequestEntity(xmlJob, "application/xml", "UTF-8"));
int statusCode = client.executeMethod(method);
}
public static void main(String[] args) {
try {
new OozieClient().submitJob("<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +
"<configuration><property><name>user.name</name><value>oozie</value></property>" +
"<property><name>oozie.wf.application.path</name>" +
"<value>hdfs://10.1.2.88:50700/user/guest</value></property></configuration>"
);
}
catch (Exception e) {
e.printStackTrace();
}
finally {
System.exit(0);
}
}