Я мог бы решить эту проблему, используя приведенный ниже код: Java код:
Конфигурация hadoopConfiguration = sparkSession.sparkContext (). HadoopConfiguration ();log.info ("CredentialProviderFactory.CREDENTIAL_PROVIDER_PATH:" + hadoopConfiguration.get (CredentialProviderFactory.CREDENTIAL_PROVIDER_PATH));String accessKey = new String (hadoopConfiguration.getPassword ("fs.s3a.access.key"));String secretKey = новая строка (hadoopConfiguration.getPassword ("fs.s3a.secret.key"));
Scala Code:
val hadoopConfiguration = sparkSession.sparkContext.hadoopConfiguration hadoopConfiguration.set (CredentialProviderFactory.CREDENTIAL_PROVIDER_PATH, keyFileHdfsPath);val access_Key = hadoopConfiguration.getPassword ("fs.s3a.access.key"). mkString val secret_Key = hadoopConfiguration.getPassword ("fs.s3a.secret.key"). mkString