我正在尝试模仿kerberos以连接到hive,但它正在给gss init异常。
UserGroupInformation ugi = kinit.generateKerberosTicket(configResources, keytab, principal);
serGroupInformation ugiProxy = UserGroupInformation.createProxyUser("shashi", ugi.getCurrentUser());
ugiProxy.doAs( new PrivilegedExceptionAction<Void>(){
@Override
public Void run() throws Exception {
Connection con = DriverManager.getConnection("jdbc:hive2://quickstart.cloudera:10000/default;principal=hive/quickstart.cloudera@CLOUDERA", "shashi", "");
Statement stmt = con.createStatement();
String sql = "show databases ";
ResultSet res = stmt.executeQuery(sql);
if (res.next()) {
System.out.println("DB names ---- >" +res.getString(1));
}
makeHiveJdbcConnection();
return null;
}
但是得到以下例外。
java.sql.SQLException: Could not open client transport with JDBC Uri: jdbc:hive2://quickstart.cloudera:10000/default;principal=hive/quickstart.cloudera@CLOUDERA: GSS initiate failed
这个问题的任何线索?
答案 0 :(得分:0)
首先取消设置hadoop代理用户,如果你没有先取消它,直线将会失败