简体   繁体   English

AWS EMR上Spark集群模式下ObjectMapper中的NullPointerException

[英]NullPointerException in ObjectMapper in Spark Cluster Mode on AWS EMR

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) 我在此行中得到nullpointer异常(在aws emr上以群集模式(纱线)运行spark),但在客户端模式下运行良好(以master为本地)

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. @Ernest Kiwele发现了问题。 Its was because I was importing com.fasterxml.jackson.databind.ObjectMapper instead of com.cloudera.com.fasterxml.jackson.databind.ObjectMapper 这是因为我正在导入com.fasterxml.jackson.databind.ObjectMapper而不是com.cloudera.com.fasterxml.jackson.databind.ObjectMapper

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM