Home | About | Sematext search-lucene.com search-hadoop.com
NEW: Monitor These Apps!
elasticsearch, apache solr, apache hbase, hadoop, redis, casssandra, amazon cloudwatch, mysql, memcached, apache kafka, apache zookeeper, apache storm, ubuntu, centOS, red hat, debian, puppet labs, java, senseiDB
 Search Hadoop and all its subprojects:

Switch to Threaded View
MapReduce >> mail # user >> Issue in access static object in MapReduce


Copy link to this message
-
Issue in access static object in MapReduce


Hi,

I have a configuration JSON file which is accessed by MR job for every input.So , I created a class with a static block, load the JSON file in static Instance variable.

So everytime my mapper or reducer wants to access configuration can use this Instance variable. But on a single node cluster,when I run this as a jar, my mapper is executing fine,

But in reducer static Instance variable is retuning "null".

I get this mainly because mapper and reducer runs on separate jvms. How can I handle this situation gracefully. There are few ways that I can think of:

1.  Serialize the JSON load object and store it on HDFS and then deserialize and use in the code. Problem is obj is not too large so not be useful to store on HDFS

2. I load the JSON for every Input line of map reduce call. This is highly inefficient and  as Il be loading JSON for so many lines again and again.

How to resolve this issue.. Any Inputs  are welcome.

Note , same code works with eclipse well. :(

Thanks

Stuti

Regards,
Stuti Awasthi
HCL Comnet Systems and Services Ltd

::DISCLAIMER::
----------------------------------------------------------------------------------------------------------------------------------------------------

The contents of this e-mail and any attachment(s) are confidential and intended for the named recipient(s) only.
E-mail transmission is not guaranteed to be secure or error-free as information could be intercepted, corrupted,
lost, destroyed, arrive late or incomplete, or may contain viruses in transmission. The e mail and its contents
(with or without referred errors) shall therefore not attach any liability on the originator or HCL or its affiliates.
Views or opinions, if any, presented in this email are solely those of the author and may not necessarily reflect the
views or opinions of HCL or its affiliates. Any form of reproduction, dissemination, copying, disclosure, modification,
distribution and / or publication of this message without the prior written consent of authorized representative of
HCL is strictly prohibited. If you have received this email in error please delete it and notify the sender immediately.
Before opening any email and/or attachments, please check them for viruses and other defects.

----------------------------------------------------------------------------------------------------------------------------------------------------
NEW: Monitor These Apps!
elasticsearch, apache solr, apache hbase, hadoop, redis, casssandra, amazon cloudwatch, mysql, memcached, apache kafka, apache zookeeper, apache storm, ubuntu, centOS, red hat, debian, puppet labs, java, senseiDB