我试图冒充 kerberos 以连接到配置单元,但它给出了 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
这个问题有什么线索吗?