Hi all:
when I use oozie rest api to access kerberosd oozie server ,it response
error with :
"HttpResponseProxy{HTTP/1.1 401 Unauthorized [Server: Apache-Coyote/1.1,
WWW-Authenticate: Negotiate, Set-Cookie: hadoop.auth=; Version=1; Path=/;
Expires=Thu, 01-Jan-1970 00:00:00 GMT; HttpOnly, Content-Type:
text/html;charset=utf-8, Content-Length: 997, Date: Fri, 19 Feb 2016
09:56:07 GMT] ResponseEntityProxy{[Content-Type:
text/html;charset=utf-8,Content-Length: 997,Chunked: false]}}"
the java codes are below :
public String getCoordJobsInfo() {
try {
Subject subject = login("test");
String jobs = Subject.doAs(subject, new PrivilegedAction<String>() { //for
kerberos authorization.
@Override
public String run() {
String url="
http://node153-81-79-hadoop:11000/oozie/v2/jobs?jobtype=coordinator";
HttpGet httpGet = new HttpGet(url);
HttpResponse response;
try {
CloseableHttpClient httpclient = HttpClients.createDefault();
response = httpclient.execute(httpGet);
return response.toString();
} catch (IOException e) {
LOG.error("Exception in listStatus", e);
return null;
}
}
});
return jobs;
} catch (LoginException e) {
LOG.error("Failed to login", e);
return null;
}
}
*But when used curl ,I can access oozie successfully by *
*sudo -u test curl --negotiate -u : -b ~/cookiejar.txt -c ~/cookiejar.txt
http://node153-81-79-hadoop:11000/oozie/v2/jobs?jobtype=coordinator
<http://node153-81-79-hadoop:11000/oozie/v2/jobs?jobtype=coordinator>*
*response :*
"conf":null,"endTime":"Sat, 20 Feb 2016 07:04:00
GMT","executionPolicy":"FIFO","startTime":"Fri, 19 Feb 2016 04:00:00
GMT","timeUnit":"CRON","concurrency":1,
"coordJobId":"0000001-160219142032251-oozie-oozi-C","lastAction":"Sat, 20
Feb 2016 04:01:00
GMT","status":"RUNNING","acl":null,"mat_throttling":0,"timeOut":1440,
"nextMaterializedTime":"Sat, 20 Feb 2016 04:01:00
GMT","bundleId":null,"toString":"Coordinator application
id[0000001-160219142032251-oozie-oozi-C]
Is there any way to solve this problem ? thanks.