我已经开发了java应用程序来连接ldap服务器,并基于用户参数以csv格式获取详细信息。结果csv文件将保存在hdfs(hadoop文件系统)中。
为了写入hdfs,我导入了 org.apache.hadoop.security.UserGroupInformation
并正确设置kerberos配置。下面是代码片段。
config.set("hadoop.security.authentication","Kerberos");
UserGroupInformation.setConfiguration(config);
UserGroupInformation.loginUserFromKeytab(Principal,KeyTabfile);
我们将keytab文件保存在poc环境的边缘服务器中。当我从边缘服务器运行java应用程序时,它正在读取运行良好的keytab文件,并将结果写入hdfs。
但是当我试图使用oozie调度这个应用程序时,我的问题就开始了。oozie将根据资源的可用性在集群中的任何数据节点中启动java操作,而oozie无法访问边缘服务器。因此,我在oozie中的java操作失败,出现安全异常,因为它无法读取边缘服务器中的keytab文件。
以下是例外详情。
java.io.IOException: Login failure for hdfs://namenode:8020 from keytab xxxxx@zz.yy.COM: javax.security.auth.login.LoginException: java.lang.IllegalArgumentException: Empty nameString not allowed
at sun.security.krb5.PrincipalName.validateNameStrings(PrincipalName.java:171)
at sun.security.krb5.PrincipalName.<init>(PrincipalName.java:393)
at sun.security.krb5.PrincipalName.<init>(PrincipalName.java:460)
at com.sun.security.auth.module.Krb5LoginModule.attemptAuthentication(Krb5LoginModule.java:650)
at com.sun.security.auth.module.Krb5LoginModule.login(Krb5LoginModule.java:617)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at javax.security.auth.login.LoginContext.invoke(LoginContext.java:755)
at javax.security.auth.login.LoginContext.access$000(LoginContext.java:195)
at javax.security.auth.login.LoginContext$4.run(LoginContext.java:682)
at javax.security.auth.login.LoginContext$4.run(LoginContext.java:680)
at java.security.AccessController.doPrivileged(Native Method)
at javax.security.auth.login.LoginContext.invokePriv(LoginContext.java:680)
at javax.security.auth.login.LoginContext.login(LoginContext.java:587)
at org.apache.hadoop.security.UserGroupInformation.loginUserFromKeytab(UserGroupInformation.java:967)
at RunLdap_Utility.ldapLookupLoop(RunLdap_Utility.java:142)
at RunLdap_Utility.main(RunLdap_Utility.java:72)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.apache.oozie.action.hadoop.JavaMain.run(JavaMain.java:56)
at org.apache.oozie.action.hadoop.LauncherMain.run(LauncherMain.java:47)
at org.apache.oozie.action.hadoop.JavaMain.main(JavaMain.java:35)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.apache.oozie.action.hadoop.LauncherMapper.map(LauncherMapper.java:241)
at org.apache.hadoop.mapred.MapRunner.run(MapRunner.java:54)
at org.apache.hadoop.mapred.MapTask.runOldMapper(MapTask.java:453)
at org.apache.hadoop.mapred.MapTask.run(MapTask.java:343)
at org.apache.hadoop.mapred.YarnChild$2.run(YarnChild.java:168)
at java.security.AccessController.doPrivileged(Native Method)
at javax.security.auth.Subject.doAs(Subject.java:422)
at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1709)
at org.apache.hadoop.mapred.YarnChild.main(YarnChild.java:162)
请给我建议这个问题的解决办法
暂无答案!
目前还没有任何答案,快来回答吧!