Can’t get Kerberos realm

Time:2022-11-24

When using HDFS to connect to Hadoop, Keytab authentication is required, but an error is reported: Can’t get Kerberos realm

Solution: Add two lines of code to the configuration code

System.setProperty(“java.security.krb5.realm”, “XXX.COM”);
System.setProperty(“java.security.krb5.kdc”, “XXX.COM”);

XXX.COM is obtained from the krb5.cof configuration file

screenshot:
Can't get Kerberos realm