You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-user@hadoop.apache.org by Sivva <sv...@gmail.com> on 2011/09/22 00:36:03 UTC

Re: Java programmatic authentication of Hadoop Kerberos

Hi Lakshmi,
Were you able to resolve the below issue. Even I'm facing the same issue,
but couldn't resolve it.
Please do reply me if you have the solution.

Thanks in advance.
Regards,
Sivva.

Sari1983 wrote:
> 
> Hi,
> 
> Kerberos has been configured for our Hadoop file system. I wish to do the
> authentication through a Java program. I'm able to perform the
> authentication using a normal java application. But, if I've any HDFS
> operations in the Java program, it's succeeded in reading the Keytab file,
> but showing some problems...
> org.apache.hadoop.security.UserGroupInformation loginUserFromKeytab
> INFO: Login successful for user <principal name> using keytab file
> <keytab.>
> 
> The problems (Exceptions are) ...
> 
> 
> org.apache.hadoop.security.UserGroupInformation reloginFromKeytab
> INFO: Initiating logout for <principal name>
> Mar 21, 2011 8:56:32 AM org.apache.hadoop.security.UserGroupInformation
> reloginFromKeytab
> INFO: Initiating re-login for <principal name>
> Mar 21, 2011 8:56:34 AM org.apache.hadoop.security.UserGroupInformation
> hasSufficientTimeElapsed
> WARNING: Not attempting to re-login since the last re-login was attempted
> less than 600 seconds before.
> Mar 21, 2011 8:56:38 AM org.apache.hadoop.security.UserGroupInformation
> hasSufficientTimeElapsed
> WARNING: Not attempting to re-login since the last re-login was attempted
> less than 600 seconds before.
> ......
> Mar 21, 2011 8:56:51 AM org.apache.hadoop.security.UserGroupInformation
> hasSufficientTimeElapsed
> WARNING: Not attempting to re-login since the last re-login was attempted
> less than 600 seconds before.
> 
> Mar 21, 2011 8:57:13 AM org.apache.hadoop.ipc.Client$Connection$1 run
> WARNING: Couldn't setup connection for <Principal Name> to null
> Exception in thread "main" java.io.IOException: Call to <part of the
> principal name>/10.204.97.33:8020 failed on local exception:
> java.io.IOException: Couldn't setup connection for <principal name> to
> null
> 	at org.apache.hadoop.ipc.Client.wrapException(Client.java:1139)
> 	at org.apache.hadoop.ipc.Client.call(Client.java:1107)
> 	at org.apache.hadoop.ipc.RPC$Invoker.invoke(RPC.java:226)
> 	at $Proxy5.getProtocolVersion(Unknown Source)
> 	at org.apache.hadoop.ipc.RPC.getProxy(RPC.java:398)
> 	at org.apache.hadoop.ipc.RPC.getProxy(RPC.java:384)
> 	at org.apache.hadoop.hdfs.DFSClient.createRPCNamenode(DFSClient.java:111)
> 	at org.apache.hadoop.hdfs.DFSClient.<init>(DFSClient.java:213)
> 	at org.apache.hadoop.hdfs.DFSClient.<init>(DFSClient.java:180)
> 	at
> org.apache.hadoop.hdfs.DistributedFileSystem.initialize(DistributedFileSystem.java:89)
> 	at org.apache.hadoop.fs.FileSystem.createFileSystem(FileSystem.java:1514)
> 	at org.apache.hadoop.fs.FileSystem.access$200(FileSystem.java:67)
> 	at
> org.apache.hadoop.fs.FileSystem$Cache.getInternal(FileSystem.java:1548)
> 	at org.apache.hadoop.fs.FileSystem$Cache.get(FileSystem.java:1530)
> 	at org.apache.hadoop.fs.FileSystem.get(FileSystem.java:228)
> 	at org.apache.hadoop.fs.FileSystem.get(FileSystem.java:111)
> 	at Fil2.main(Fil2.java:27)
> Caused by: java.io.IOException: Couldn't setup connection for <principal
> name> to null
> 	at org.apache.hadoop.ipc.Client$Connection$1.run(Client.java:503)
> 	at java.security.AccessController.doPrivileged(Native Method)
> 	at javax.security.auth.Subject.doAs(Subject.java:396)
> 	at
> org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1115)
> 	at
> org.apache.hadoop.ipc.Client$Connection.handleSaslConnectionFailure(Client.java:456)
> 	at
> org.apache.hadoop.ipc.Client$Connection.setupIOstreams(Client.java:558)
> 	at org.apache.hadoop.ipc.Client$Connection.access$2300(Client.java:210)
> 	at org.apache.hadoop.ipc.Client.getConnection(Client.java:1244)
> 	at org.apache.hadoop.ipc.Client.call(Client.java:1075)
> 	... 15 more
> Caused by: java.io.IOException: Failed to specify server's Kerberos
> principal name
> 	at org.apache.hadoop.security.SaslRpcClient.<init>(SaslRpcClient.java:85)
> 	at
> org.apache.hadoop.ipc.Client$Connection.setupSaslConnection(Client.java:413)
> 	at org.apache.hadoop.ipc.Client$Connection.access$1100(Client.java:210)
> 	at org.apache.hadoop.ipc.Client$Connection$2.run(Client.java:551)
> 	at org.apache.hadoop.ipc.Client$Connection$2.run(Client.java:548)
> 	at java.security.AccessController.doPrivileged(Native Method)
> 	at javax.security.auth.Subject.doAs(Subject.java:396)
> 	at
> org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1115)
> 	at
> org.apache.hadoop.ipc.Client$Connection.setupIOstreams(Client.java:547)
> 	... 18 more
> 
> 
> Please help me in resolving this issue. It's very urgent. I'm new to
> Kerberos and Hadoop. I appreciate any help.
> 
> Thanks & Regards,
> Lakshmi
> 

-- 
View this message in context: http://old.nabble.com/Java-programmatic-authentication-of-Hadoop-Kerberos-tp31198827p32503781.html
Sent from the Hadoop core-user mailing list archive at Nabble.com.


Re: Java programmatic authentication of Hadoop Kerberos

Posted by Vinod Kumar Vavilapalli <vi...@hortonworks.com>.
You may be missing the kerberos principal for the namenode in your
configuration used to connect to NameNode. Check your configuration for
dfs.namenode.kerberos.principal and set it to the same value as on NN.

HTH
+Vinod

On Thu, Sep 22, 2011 at 4:06 AM, Sivva <sv...@gmail.com> wrote:

>
> Hi Lakshmi,
> Were you able to resolve the below issue. Even I'm facing the same issue,
> but couldn't resolve it.
> Please do reply me if you have the solution.
>
> Thanks in advance.
> Regards,
> Sivva.
>
> Sari1983 wrote:
> >
> > Hi,
> >
> > Kerberos has been configured for our Hadoop file system. I wish to do the
> > authentication through a Java program. I'm able to perform the
> > authentication using a normal java application. But, if I've any HDFS
> > operations in the Java program, it's succeeded in reading the Keytab
> file,
> > but showing some problems...
> > org.apache.hadoop.security.UserGroupInformation loginUserFromKeytab
> > INFO: Login successful for user <principal name> using keytab file
> > <keytab.>
> >
> > The problems (Exceptions are) ...
> >
> >
> > org.apache.hadoop.security.UserGroupInformation reloginFromKeytab
> > INFO: Initiating logout for <principal name>
> > Mar 21, 2011 8:56:32 AM org.apache.hadoop.security.UserGroupInformation
> > reloginFromKeytab
> > INFO: Initiating re-login for <principal name>
> > Mar 21, 2011 8:56:34 AM org.apache.hadoop.security.UserGroupInformation
> > hasSufficientTimeElapsed
> > WARNING: Not attempting to re-login since the last re-login was attempted
> > less than 600 seconds before.
> > Mar 21, 2011 8:56:38 AM org.apache.hadoop.security.UserGroupInformation
> > hasSufficientTimeElapsed
> > WARNING: Not attempting to re-login since the last re-login was attempted
> > less than 600 seconds before.
> > ......
> > Mar 21, 2011 8:56:51 AM org.apache.hadoop.security.UserGroupInformation
> > hasSufficientTimeElapsed
> > WARNING: Not attempting to re-login since the last re-login was attempted
> > less than 600 seconds before.
> >
> > Mar 21, 2011 8:57:13 AM org.apache.hadoop.ipc.Client$Connection$1 run
> > WARNING: Couldn't setup connection for <Principal Name> to null
> > Exception in thread "main" java.io.IOException: Call to <part of the
> > principal name>/10.204.97.33:8020 failed on local exception:
> > java.io.IOException: Couldn't setup connection for <principal name> to
> > null
> >       at org.apache.hadoop.ipc.Client.wrapException(Client.java:1139)
> >       at org.apache.hadoop.ipc.Client.call(Client.java:1107)
> >       at org.apache.hadoop.ipc.RPC$Invoker.invoke(RPC.java:226)
> >       at $Proxy5.getProtocolVersion(Unknown Source)
> >       at org.apache.hadoop.ipc.RPC.getProxy(RPC.java:398)
> >       at org.apache.hadoop.ipc.RPC.getProxy(RPC.java:384)
> >       at
> org.apache.hadoop.hdfs.DFSClient.createRPCNamenode(DFSClient.java:111)
> >       at org.apache.hadoop.hdfs.DFSClient.<init>(DFSClient.java:213)
> >       at org.apache.hadoop.hdfs.DFSClient.<init>(DFSClient.java:180)
> >       at
> >
> org.apache.hadoop.hdfs.DistributedFileSystem.initialize(DistributedFileSystem.java:89)
> >       at
> org.apache.hadoop.fs.FileSystem.createFileSystem(FileSystem.java:1514)
> >       at org.apache.hadoop.fs.FileSystem.access$200(FileSystem.java:67)
> >       at
> > org.apache.hadoop.fs.FileSystem$Cache.getInternal(FileSystem.java:1548)
> >       at org.apache.hadoop.fs.FileSystem$Cache.get(FileSystem.java:1530)
> >       at org.apache.hadoop.fs.FileSystem.get(FileSystem.java:228)
> >       at org.apache.hadoop.fs.FileSystem.get(FileSystem.java:111)
> >       at Fil2.main(Fil2.java:27)
> > Caused by: java.io.IOException: Couldn't setup connection for <principal
> > name> to null
> >       at org.apache.hadoop.ipc.Client$Connection$1.run(Client.java:503)
> >       at java.security.AccessController.doPrivileged(Native Method)
> >       at javax.security.auth.Subject.doAs(Subject.java:396)
> >       at
> >
> org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1115)
> >       at
> >
> org.apache.hadoop.ipc.Client$Connection.handleSaslConnectionFailure(Client.java:456)
> >       at
> > org.apache.hadoop.ipc.Client$Connection.setupIOstreams(Client.java:558)
> >       at
> org.apache.hadoop.ipc.Client$Connection.access$2300(Client.java:210)
> >       at org.apache.hadoop.ipc.Client.getConnection(Client.java:1244)
> >       at org.apache.hadoop.ipc.Client.call(Client.java:1075)
> >       ... 15 more
> > Caused by: java.io.IOException: Failed to specify server's Kerberos
> > principal name
> >       at
> org.apache.hadoop.security.SaslRpcClient.<init>(SaslRpcClient.java:85)
> >       at
> >
> org.apache.hadoop.ipc.Client$Connection.setupSaslConnection(Client.java:413)
> >       at
> org.apache.hadoop.ipc.Client$Connection.access$1100(Client.java:210)
> >       at org.apache.hadoop.ipc.Client$Connection$2.run(Client.java:551)
> >       at org.apache.hadoop.ipc.Client$Connection$2.run(Client.java:548)
> >       at java.security.AccessController.doPrivileged(Native Method)
> >       at javax.security.auth.Subject.doAs(Subject.java:396)
> >       at
> >
> org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1115)
> >       at
> > org.apache.hadoop.ipc.Client$Connection.setupIOstreams(Client.java:547)
> >       ... 18 more
> >
> >
> > Please help me in resolving this issue. It's very urgent. I'm new to
> > Kerberos and Hadoop. I appreciate any help.
> >
> > Thanks & Regards,
> > Lakshmi
> >
>
> --
> View this message in context:
> http://old.nabble.com/Java-programmatic-authentication-of-Hadoop-Kerberos-tp31198827p32503781.html
> Sent from the Hadoop core-user mailing list archive at Nabble.com.
>
>