开发者社区> 问答> 正文

MAPReducer Driver运行报错Exception in thread "main" java.lang.RuntimeException: com.aliyun.odps.OdpsException: java.lang.ClassCastException: com.aliyun.odps.io.DoubleWritable cannot be cast to com.aliyun.odps.io.LongWritable

已解决

我是照着海量电力设备监测数据存储分析里面的海量电力设备监测数据存储分析实验步骤来的,代码这些都是和教程里面是一样的,在用eclipse运行TJDriver时候报错。
Exception in thread "main" java.lang.RuntimeException: com.aliyun.odps.OdpsException: java.lang.ClassCastException: com.aliyun.odps.io.DoubleWritable cannot be cast to com.aliyun.odps.io.LongWritable

at com.aliyun.odps.mapred.LocalJobRunner.submit(LocalJobRunner.java:163)
at com.aliyun.odps.mapred.JobClient.submitJob(JobClient.java:178)
at com.aliyun.odps.mapred.JobClient.runJob(JobClient.java:80)
at TJDriver.main(TJDriver.java:36)

Caused by: com.aliyun.odps.OdpsException: java.lang.ClassCastException: com.aliyun.odps.io.DoubleWritable cannot be cast to com.aliyun.odps.io.LongWritable

at com.aliyun.odps.mapred.LocalJobRunner.runJob(LocalJobRunner.java:206)
at com.aliyun.odps.mapred.LocalJobRunner.submit(LocalJobRunner.java:160)
... 3 more

Caused by: java.lang.ClassCastException: com.aliyun.odps.io.DoubleWritable cannot be cast to com.aliyun.odps.io.LongWritable

at com.aliyun.odps.mapred.bridge.WritableRecord.getBigint(WritableRecord.java:213)
at com.aliyun.odps.mapred.bridge.WritableRecord.getBigint(WritableRecord.java:223)
at TJReducer.reduce(TJReducer.java:57)
at com.aliyun.odps.mapred.local.ReduceDriver.run(ReduceDriver.java:232)
at com.aliyun.odps.mapred.LocalJobRunner.handleNonPipeMode(LocalJobRunner.java:371)
at com.aliyun.odps.mapred.LocalJobRunner.runJob(LocalJobRunner.java:203)
... 4 more

展开
收起
hjkhjk 2019-01-23 14:33:19 9043 0
1 条回答
写回答
取消 提交回答
  • 采纳回答

    格式转换出错,看一下格式出错的位置换成getDouble就行了

    2019-07-17 23:26:37
    赞同 展开评论 打赏
问答排行榜
最热
最新

相关电子书

更多
Spring Cloud Alibaba - 重新定义 Java Cloud-Native 立即下载
The Reactive Cloud Native Arch 立即下载
JAVA开发手册1.5.0 立即下载