I am trying to connect to HDFS using Kerberos authentication in a JakartaEE application. The connection code appears to be set up correctly, but I am encountering the following error when attempting to load a file list from HDFS:
14:41:17,006 ERROR [com.hdfs.HdfsFileBrowserBean] (default task-1) Failed to load file list for path: /: java.io.IOException: DestHost:destPort yava-bdr01.ecc.com:8020, LocalHost:localPort localhost.localdomain/127.0.0.1:0. Failed on local exception: java.io.IOException: Couldn't set up IO streams: java.lang.IllegalArgumentException: Parameter 'callbackHandler' may not be null
This suggests that there is an issue with the callbackHandler. I have verified the keytab and principal details but am unsure how to resolve this specific error.
Configuration conf = new Configuration();
setClusterConfig(conf, peerCrawler.getClusterConfig(url, username, password, "hdfs-site"));
setClusterConfig(conf, peerCrawler.getClusterConfig(url, username, password, "core-site"));
String keytabPath = "/opt/wildfly-34.0.0.Final/keytabs/yarn.service.keytab";
String principal = "yarn/[email protected]";
org.apache.hadoop.conf.Configuration hadoopConfig = new org.apache.hadoop.conf.Configuration();
hadoopConfig.set("hadoop.security.authentication", "kerberos");
UserGroupInformation.setConfiguration(hadoopConfig);
UserGroupInformation.loginUserFromKeytab(principal, keytabPath);
String currentUser = UserGroupInformation.getCurrentUser().getUserName();
logger.info("Login successful with principal: " + currentUser);
// Get FileSystem instance
this.fileSystem = FileSystem.get(new URI(hdfsUri), conf);
Could anyone help me understand why I’m receiving this error and how to resolve it? Any insights on the callbackHandler
parameter would be greatly appreciated.
ilham hitam is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.