Hi,
How to read configuration file in Hadoop.
I tried by copying the file in HDFS and also placing within the jar file.
I tried like this in Map constructor
Configuration conf = new Configuration();
FileSystem fs = FileSystem.get(conf);
Path inFile = new Path("/file/path/configfile.txt");
FSDataInputStream in = fs.open(inFile);
properties.load(in);
in.close();
And also like this
//URL url = UserPattern2.class.getResource(commFile);
URL url = new URL("/file/path/configfile.txt");
if( url != null ) {
InputStream in = url.openStream();
properties.load(in);
in.close();
}
Looks like it is not finding the file seems, I am getting NullPointerException.
Here I am opening file and loading into Java Properties object.
Please let me know what might be the problem.
Thanks,
Senthil