hadoop-mapreduce-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Nishanth S <chinchu2...@gmail.com>
Subject Re: Fwd: Properties file not loaded with hadoop jar command
Date Thu, 10 Sep 2015 22:15:20 GMT
Thanks.Yep its a  java issue.using Thread.contextclassloader would solve
this.

-Nishanth

On Fri, Jul 17, 2015 at 8:17 AM, Shahab Yunus <shahab.yunus@gmail.com>
wrote:

> This seems to be a Java issue rather than Hadoop?
>
> Have you seen these below, regarding intricacies involved in reading a
> resource file in Java jar?
>
> http://javarevisited.blogspot.com/2014/07/how-to-load-resources-from-classpath-in-java-example.html
>
> http://stackoverflow.com/questions/20389255/reading-a-resource-file-from-within-jar
>
> http://stackoverflow.com/questions/403256/how-do-i-read-a-resource-file-from-a-java-jar-file?rq=1
>
> Regards,
> Shahab
>
> On Fri, Jul 17, 2015 at 10:09 AM, Harshit Mathur <mathursharp@gmail.com>
> wrote:
>
>> Are you reading the file in map or reduce task?
>> On Jul 17, 2015 2:51 AM, "Nishanth S" <chinchu2884@gmail.com> wrote:
>>
>>> Hello,
>>> I have built a  jar file with maven as build tool which  reads
>>> properties from a  file.I am doing this  like  InputStream is =
>>> ClassLoader.getSystemResourceAsStream(("hadoop.properties")) on start
>>> iup.No qonce the jar is built  I could see that the properties get loaded
>>> when  I do java -jar but when I am trying to execute the map reduce with
>>>  hadoop jar  ClassLoader.getSystemResourceAsStream returns input stream
>>> null.I want to keep this property file  within the jar and is available  in
>>> the classpath.Please  advise  if any one has met this scenario before.
>>>
>>>
>>> -Chinchu
>>>
>>>
>

Mime
View raw message