<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>question Re: WebHDFS over Knox and Kerberos from Java in Archives of Support Questions (Read Only)</title>
    <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/WebHDFS-over-Knox-and-Kerberos-from-Java/m-p/135555#M27537</link>
    <description>&lt;P&gt;Hi Pavel -&lt;/P&gt;&lt;P&gt;From what I can tell from your description, it seems that you are developing a java application to consume WebHDFS APIs through Knox. We have samples that do this available in {GATEWAY_HOME}/samples directory. The Groovy scripts are based on java classes that leverage HttpClient to handle the basic challenge.&lt;/P&gt;&lt;P&gt;Look at samples/ExampleWebHdfsPutGet.groovy for an example that does a PUT and then a subsequent GET of a given file.&lt;/P&gt;&lt;P&gt;The following shows you how HttpClient is used:&lt;/P&gt;&lt;P&gt;&lt;A href="https://github.com/apache/knox/blob/master/gateway-shell/src/main/java/org/apache/hadoop/gateway/shell/Hadoop.java" target="_blank"&gt;https://github.com/apache/knox/blob/master/gateway-shell/src/main/java/org/apache/hadoop/gateway/shell/Hadoop.java&lt;/A&gt;&lt;/P&gt;&lt;P&gt;The following shows you the implementation of the HDFS Put command in our client shell classes which leverages the execute method of the AbstractRequest base class to interact with Knox through the above Hadoop class as the session:&lt;/P&gt;&lt;P&gt;&lt;A href="https://github.com/apache/knox/blob/master/gateway-shell/src/main/java/org/apache/hadoop/gateway/shell/hdfs/Put.java" target="_blank"&gt;https://github.com/apache/knox/blob/master/gateway-shell/src/main/java/org/apache/hadoop/gateway/shell/hdfs/Put.java&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Here is the base class that uses the Hadoop session class:&lt;/P&gt;&lt;P&gt;&lt;A href="https://github.com/apache/knox/blob/master/gateway-shell/src/main/java/org/apache/hadoop/gateway/shell/AbstractRequest.java" target="_blank"&gt;https://github.com/apache/knox/blob/master/gateway-shell/src/main/java/org/apache/hadoop/gateway/shell/AbstractRequest.java&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Bottom line: I would suggest that you use HttpClient to do the interactions.&lt;/P&gt;&lt;P&gt;HTH.&lt;/P&gt;&lt;P&gt;--larry&lt;/P&gt;</description>
    <pubDate>Sat, 07 May 2016 03:06:44 GMT</pubDate>
    <dc:creator>lmccay</dc:creator>
    <dc:date>2016-05-07T03:06:44Z</dc:date>
    <item>
      <title>WebHDFS over Knox and Kerberos from Java</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/WebHDFS-over-Knox-and-Kerberos-from-Java/m-p/135554#M27536</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;we are trying to use WebHDFS over Knox to access HDFS on our secured cluster from java. We are able to list files/folders there, but we are still struggling with the file creation.&lt;/P&gt;&lt;P&gt;The problem is probably in Oracle's Java library, where the streaming does not seem to be supported when authentication is required:. &lt;/P&gt;&lt;P&gt;In &lt;A href="http://sun.net.www.protocol.http.httpurlconnection.getinputstream0/"&gt;sun.net.www.protocol.http.HttpURLConnection.getInputStream0&lt;/A&gt;()&lt;/P&gt;&lt;P&gt;there is something like&lt;/P&gt;&lt;P&gt;if
(j == 401) {&lt;/P&gt;&lt;P&gt;/*
1635 */           if (streaming()) {&lt;/P&gt;&lt;P&gt;/*
1636 */             disconnectInternal();&lt;/P&gt;&lt;P&gt;/*
1637 */thrownew
HttpRetryException("cannot retry due to server
authentication, in streaming mode",
401);&lt;/P&gt;&lt;P&gt;/* 
    */           }&lt;/P&gt;&lt;P&gt;The streaming is not needed for some operation, like list/delete (and therefore it works), but it is required for file creation.&lt;/P&gt;&lt;P&gt;Any suggestions how to handle this?&lt;/P&gt;&lt;P&gt;Thanks a lot,&lt;/P&gt;&lt;P&gt;Pavel&lt;/P&gt;</description>
      <pubDate>Sat, 07 May 2016 01:25:40 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/WebHDFS-over-Knox-and-Kerberos-from-Java/m-p/135554#M27536</guid>
      <dc:creator>pavel_benes</dc:creator>
      <dc:date>2016-05-07T01:25:40Z</dc:date>
    </item>
    <item>
      <title>Re: WebHDFS over Knox and Kerberos from Java</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/WebHDFS-over-Knox-and-Kerberos-from-Java/m-p/135555#M27537</link>
      <description>&lt;P&gt;Hi Pavel -&lt;/P&gt;&lt;P&gt;From what I can tell from your description, it seems that you are developing a java application to consume WebHDFS APIs through Knox. We have samples that do this available in {GATEWAY_HOME}/samples directory. The Groovy scripts are based on java classes that leverage HttpClient to handle the basic challenge.&lt;/P&gt;&lt;P&gt;Look at samples/ExampleWebHdfsPutGet.groovy for an example that does a PUT and then a subsequent GET of a given file.&lt;/P&gt;&lt;P&gt;The following shows you how HttpClient is used:&lt;/P&gt;&lt;P&gt;&lt;A href="https://github.com/apache/knox/blob/master/gateway-shell/src/main/java/org/apache/hadoop/gateway/shell/Hadoop.java" target="_blank"&gt;https://github.com/apache/knox/blob/master/gateway-shell/src/main/java/org/apache/hadoop/gateway/shell/Hadoop.java&lt;/A&gt;&lt;/P&gt;&lt;P&gt;The following shows you the implementation of the HDFS Put command in our client shell classes which leverages the execute method of the AbstractRequest base class to interact with Knox through the above Hadoop class as the session:&lt;/P&gt;&lt;P&gt;&lt;A href="https://github.com/apache/knox/blob/master/gateway-shell/src/main/java/org/apache/hadoop/gateway/shell/hdfs/Put.java" target="_blank"&gt;https://github.com/apache/knox/blob/master/gateway-shell/src/main/java/org/apache/hadoop/gateway/shell/hdfs/Put.java&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Here is the base class that uses the Hadoop session class:&lt;/P&gt;&lt;P&gt;&lt;A href="https://github.com/apache/knox/blob/master/gateway-shell/src/main/java/org/apache/hadoop/gateway/shell/AbstractRequest.java" target="_blank"&gt;https://github.com/apache/knox/blob/master/gateway-shell/src/main/java/org/apache/hadoop/gateway/shell/AbstractRequest.java&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Bottom line: I would suggest that you use HttpClient to do the interactions.&lt;/P&gt;&lt;P&gt;HTH.&lt;/P&gt;&lt;P&gt;--larry&lt;/P&gt;</description>
      <pubDate>Sat, 07 May 2016 03:06:44 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/WebHDFS-over-Knox-and-Kerberos-from-Java/m-p/135555#M27537</guid>
      <dc:creator>lmccay</dc:creator>
      <dc:date>2016-05-07T03:06:44Z</dc:date>
    </item>
    <item>
      <title>Re: WebHDFS over Knox and Kerberos from Java</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/WebHDFS-over-Knox-and-Kerberos-from-Java/m-p/135556#M27538</link>
      <description>&lt;P&gt;Hi Larry,&lt;/P&gt;&lt;P&gt;yes, the Apache HttpClient works like a charm.&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Pavel&lt;/P&gt;</description>
      <pubDate>Mon, 09 May 2016 14:06:06 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/WebHDFS-over-Knox-and-Kerberos-from-Java/m-p/135556#M27538</guid>
      <dc:creator>pavel_benes</dc:creator>
      <dc:date>2016-05-09T14:06:06Z</dc:date>
    </item>
  </channel>
</rss>

