I am getting nullpointer exception in this line (running spark in cluster mode (yarn) on aws emr) but runs fine in client mode (with master as local)
Map<String, Object> json = (Map<String, Object>) mapper.readValue(line, Map.class);
This is the stacktrace of the executor:
18/04/17 12:33:16 ERROR executor.Executor: Exception in task 0.2 in stage 0.0 (TID 4)
java.lang.NullPointerException
at com.fasterxml.jackson.databind.util.LRUMap.get(LRUMap.java:47)
at com.fasterxml.jackson.databind.type.TypeFactory._fromClass(TypeFactory.java:707)
at com.fasterxml.jackson.databind.type.TypeFactory._constructType(TypeFactory.java:387)
at com.fasterxml.jackson.databind.type.TypeFactory.constructType(TypeFactory.java:354)
at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:2161)
I am using the following dependency:
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.9.5</version>
<scope>compile</scope>
</dependency>
@Ernest Kiwele Found the issue. Its was because I was importing
com.fasterxml.jackson.databind.ObjectMapperinstead ofcom.cloudera.com.fasterxml.jackson.databind.ObjectMapper