|
@@ -23,6 +23,7 @@ import java.io.FileOutputStream;
|
|
|
import java.io.IOException;
|
|
|
import java.io.InputStream;
|
|
|
import java.net.InetAddress;
|
|
|
+import java.net.URI;
|
|
|
import java.net.URL;
|
|
|
import java.net.URLConnection;
|
|
|
import java.security.PrivilegedExceptionAction;
|
|
@@ -30,11 +31,11 @@ import java.security.PrivilegedExceptionAction;
|
|
|
import org.apache.hadoop.conf.Configuration;
|
|
|
import org.apache.hadoop.fs.FileSystem;
|
|
|
import org.apache.hadoop.hdfs.DistributedFileSystem;
|
|
|
-import org.apache.hadoop.security.SecurityUtil;
|
|
|
import org.apache.hadoop.hdfs.security.token.delegation.DelegationTokenIdentifier;
|
|
|
import org.apache.hadoop.hdfs.server.namenode.DelegationTokenServlet;
|
|
|
import org.apache.hadoop.io.Text;
|
|
|
import org.apache.hadoop.security.Credentials;
|
|
|
+import org.apache.hadoop.security.SecurityUtil;
|
|
|
import org.apache.hadoop.security.UserGroupInformation;
|
|
|
import org.apache.hadoop.security.token.Token;
|
|
|
import org.apache.hadoop.util.StringUtils;
|
|
@@ -119,9 +120,9 @@ public class DelegationTokenFetcher {
|
|
|
dfs.getDelegationToken(new Text(fullName));
|
|
|
|
|
|
// Reconstruct the ip:port of the Namenode
|
|
|
+ URI uri = dfs.getDefaultUri(dfs.getConf());
|
|
|
String nnAddress =
|
|
|
- InetAddress.getByName(dfs.getUri().getHost()).getHostAddress()
|
|
|
- + ":" + dfs.getUri().getPort();
|
|
|
+ InetAddress.getByName(uri.getHost()).getHostAddress() + ":" + uri.getPort();
|
|
|
token.setService(new Text(nnAddress));
|
|
|
|
|
|
Credentials ts = new Credentials();
|