'Couldn't create proxy provider class org.apache.hadoop.hdfs.server.namenode.ha.ConfiguredFailoverProxyProvider

I am trying to read to check if a file exists on HDFS. I am using eclipse IDE and have all the required hadoop jars and hadoop configuration in class path. When i execute the program i see the below exception.


    Configuration conf = new Configuration(true);
            conf.addResource(new File("core-site.xml").toURI().toURL());
            conf.addResource(new File("hdfs-site.xml").toURI().toURL());
            conf.addResource(new File("mapred-site.xml").toURI().toURL());
            FileSystem hdfs = FileSystem.get(conf);
            boolean isExists = hdfs.exists(source);

Exception:

java.io.IOException: Couldn't create proxy provider class org.apache.hadoop.hdfs.server.namenode.ha.ConfiguredFailoverProxyProvider
    at org.apache.hadoop.hdfs.server.namenode.ha.ConfiguredFailoverProxyProvider.<init>(ConfiguredFailoverProxyProvider.java:93)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)

Can anyone help me fix this issue?



Solution 1:[1]

<property>
<name>dfs.client.failover.proxy.provider.**your-cluster-name**</name>
<value>org.apache.hadoop.hdfs.server.namenode.ha.ConfiguredFailoverProxyProvider</value>
</property>

This should be your cluster name, I guess it is also case-sensitive.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 DennisLi