Support Questions
Find answers, ask questions, and share your expertise

Unable to run MapReduce program with PhoenixMapReduceUtil

Highlighted

Unable to run MapReduce program with PhoenixMapReduceUtil

Hi All,

I am trying to run MR job with table as input using PhoenixMapReduceUtil. I followed below link https://phoenix.apache.org/phoenix_mr.html

I am getting below exception.

2016-04-27 12:24:34,729 WARN [main] org.apache.hadoop.mapred.YarnChild: Exception running child : java.lang.NullPointerException
	at com.google.common.base.Preconditions.checkNotNull(Preconditions.java:187)
	at org.apache.phoenix.mapreduce.util.PhoenixConfigurationUtil.getUpsertStatement(PhoenixConfigurationUtil.java:234)
	at org.apache.phoenix.mapreduce.PhoenixRecordWriter.<init>(PhoenixRecordWriter.java:51)
	at org.apache.phoenix.mapreduce.PhoenixOutputFormat.getRecordWriter(PhoenixOutputFormat.java:55)
	at org.apache.hadoop.mapred.MapTask$NewDirectOutputCollector.<init>(MapTask.java:647)
	at org.apache.hadoop.mapred.MapTask.runNewMapper(MapTask.java:767)
	at org.apache.hadoop.mapred.MapTask.run(MapTask.java:341)
	at org.apache.hadoop.mapred.YarnChild$2.run(YarnChild.java:168)
	at java.security.AccessController.doPrivileged(Native Method)
	at javax.security.auth.Subject.doAs(Subject.java:415)
	at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1657)
	at org.apache.hadoop.mapred.YarnChild.main(YarnChild.java:162)

Can anyone help me out?

Thanks,

Ashish

3 REPLIES 3
Highlighted

Re: Unable to run MapReduce program with PhoenixMapReduceUtil

This can come only when configuration object is null.. can you check , is anyhow you are setting configuration as null.

Re: Unable to run MapReduce program with PhoenixMapReduceUtil

Contributor

Based on what @asinghal said, check your configuration object. The code that's running behind the scenes is:

public static String getUpsertStatement(final Configuration configuration) throws SQLException {
   Preconditions.checkNotNull(configuration); // <-- THIS IS WHERE you're getting the error
   String upsertStmt = configuration.get(UPSERT_STATEMENT);
   if(isNotEmpty(upsertStmt)) {
      return upsertStmt;
   }
   ...

Just for kicks, try putting a stop break on your code:

final Configuration configuration = HBaseConfiguration.create();
final Job job = Job.getInstance(configuration, "phoenix-mr-job");

and look at your 'configuration' object and make sure the object is valid.

HTH

Highlighted

Re: Unable to run MapReduce program with PhoenixMapReduceUtil

Super Collaborator

@Ashish Gupta, I am getting the same exception. Did you get this right? Thanks