Java Code Examples for org.apache.hadoop.security.authentication.client.AuthenticationException

Following code examples demonstrate how to use org.apache.hadoop.security.authentication.client.AuthenticationExceptionfrom hadoop. These examples are extracted from various highly rated open source projects. You can directly use these code snippets or view their entire linked source code. These snippets are extracted to provide contextual information about how to use this class in the real world. These samples also let you understand some good practices on how to use org.apache.hadoop.security.authentication.client.AuthenticationExceptionand various code implementation of this class.

    public static void main(String[] args) throws IOException, URISyntaxException, AuthenticationException {
        WebHDFSConnectionFactory webHDFSConnectionFactory = new WebHDFSConnectionFactory("172.16.2.96",50070, "hdfs",
                "123456", WebHDFSConnectionFactory.AuthenticationType.KERBEROS.name());
        WebHDFSConnection connection = webHDFSConnectionFactory.getConnection();
        String json = "";

        try {
            json = connection.delete("tmp/hdfs-site0g0.xml");
            System.out.println(json);
        } catch (IOException e) {
            e.printStackTrace();
        } catch (AuthenticationException e) {
            e.printStackTrace();
        }
    } 


    public static void testPseudo() {
        WebHDFSConnectionFactory webHDFSConnectionFactory = new WebHDFSConnectionFactory("172.16.1.35",50070, "hdfs",
                "123456", WebHDFSConnectionFactory.AuthenticationType.PSEUDO.name());
        WebHDFSConnection connection = webHDFSConnectionFactory.getConnection();

        try {
            String json = "";
            json = connection.delete("user/hdfs/core-site.xml006");
            System.out.println(json);
        } catch (IOException e) {
            e.printStackTrace();
        } catch (AuthenticationException e) {
            e.printStackTrace();
        }

    } 

Advertisement
Javadoc
Exception thrown when an authentication error occurs.
Advertisement