问题描述
我尝试使用计时器重新登录,但这不起作用!
方法寄存器:
public static void register() throws IOException {
LogUtils.fatal("Kerberos!");
UserGroupInformation.loginUserFromKeytab(kbsName,kbsPath);
UserGroupInformation.getCurrentUser().checkTGTAndReloginFromKeytab();
registerTime.getAndIncrement();
LogUtils.fatal("success!");
}
计时器:
TimerTask task = new TimerTask() {
@SneakyThrows
@Override
public void run() {
UserGroupInformation ugi = UserGroupInformation.getCurrentUser();
ugi.doAs((PrivilegedAction<Boolean>) ()->{
try {
KerberosUtils.register();
} catch (Exception e) {
}
return true;
});
}
};
日志:
[FATAL] 2020-08-11 10:10:00,009
Kerberos!
[FATAL] 2020-08-11 10:10:00,013
success!
异常日志:
failed authentication due to: An error: (java.security.PrivilegedActionException: javax.security.sasl.SaslException: GSS initiate failed [Caused by GSSException: No valid credentials provided (Mechanism level: Failed to find any Kerberos tgt)]) occurred when evaluating SASL token received from the Kafka Broker. Kafka Client will go to AUTHENTICATION_FAILED state.
我认为它运行register方法。因为日志已被打印。 但这不起作用!
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)