博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Flume1.6.0之Error-protobuf-This is supposed to be overridden by subclasses
阅读量:5795 次
发布时间:2019-06-18

本文共 3824 字,大约阅读时间需要 12 分钟。

1.场景:

Apache Flume: Agent 【http-->memory-->hdfs(CDH4)】   (http发送请求,通过内存,然后写到cdh4的hdfs上)
当前flume agent机器有【CDH4】环境的文件(而没有Apache hadoop环境),
故 JAVA_HOME=/opt/cloudera/parcels/CDH/lib/hadoop

2.错误:
2016-05-21 19:31:27,756 (SinkRunner-PollingRunner-DefaultSinkProcessor) [INFO - org.apache.flume.sink.hdfs.BucketWriter.open(BucketWriter.java:234)] Creating hdfs://alish1-dataservice-01.mypna.cn:8022/testwjp/2016-05-21/19/FlumeData.1463830281582.tmp
2016-05-21 19:31:27,791 (SinkRunner-PollingRunner-DefaultSinkProcessor) [ERROR - org.apache.flume.sink.hdfs.HDFSEventSink.process(HDFSEventSink.java:459)] process failed
java.lang.UnsupportedOperationException: This is supposed to be overridden by subclasses.
        at com.google.protobuf.GeneratedMessage.getUnknownFields(GeneratedMessage.java:180)
        at org.apache.hadoop.hdfs.protocol.proto.HdfsProtos$FsPermissionProto.getSerializedSize(HdfsProtos.java:5407)
        at com.google.protobuf.CodedOutputStream.computeMessageSizeNoTag(CodedOutputStream.java:749)
        at com.google.protobuf.CodedOutputStream.computeMessageSize(CodedOutputStream.java:530)

3.分析:
java.lang.UnsupportedOperationException: This is supposed to be overridden by subclasses.
        at com.google.protobuf.GeneratedMessage.getUnknownFields(GeneratedMessage.java:180)

可能出现不同版本的protobuf包

 

4.验证:

[root@xxx-01 ~]# find / -name protobuf*.jar
/usr/lib/hadoop-hdfs/protobuf-java-2.4.0a.jar
/usr/share/cmf/lib/cdh4/protobuf-java-2.4.0a.jar
/data/01/local/apache-flume-1.6.0-bin/lib/protobuf-java-2.5.0.jar
/data/01/local/apache-tomcat-7.0.42/webapps/logshedcollector/WEB-INF/lib/protobuf-java-2.4.0a.jar
/opt/cloudera/parcels/CDH-4.7.1-1.cdh4.7.1.p0.47/lib/flume-ng/lib/protobuf-java-2.4.1.jar
/opt/cloudera/parcels/CDH-4.7.1-1.cdh4.7.1.p0.47/lib/oozie/libtools/protobuf-java-2.4.0a.jar
/opt/cloudera/parcels/CDH-4.7.1-1.cdh4.7.1.p0.47/lib/hadoop-0.20-mapreduce/lib/protobuf-java-2.4.0a.jar
/opt/cloudera/parcels/CDH-4.7.1-1.cdh4.7.1.p0.47/lib/hbase/lib/protobuf-java-2.4.0a.jar
/opt/cloudera/parcels/CDH-4.7.1-1.cdh4.7.1.p0.47/lib/hadoop-httpfs/webapps/webhdfs/WEB-INF/lib/protobuf-java-2.4.0a.jar
/opt/cloudera/parcels/CDH-4.7.1-1.cdh4.7.1.p0.47/lib/mahout/lib/protobuf-java-2.4.0a.jar
/opt/cloudera/parcels/CDH-4.7.1-1.cdh4.7.1.p0.47/lib/hadoop-hdfs/lib/protobuf-java-2.4.0a.jar
/opt/cloudera/parcels/CDH-4.7.1-1.cdh4.7.1.p0.47/lib/hadoop/client-0.20/protobuf-java-2.4.0a.jar
/opt/cloudera/parcels/CDH-4.7.1-1.cdh4.7.1.p0.47/lib/hadoop/client-0.20/protobuf-java.jar
/opt/cloudera/parcels/CDH-4.7.1-1.cdh4.7.1.p0.47/lib/hadoop/lib/protobuf-java-2.4.0a.jar
/opt/cloudera/parcels/CDH-4.7.1-1.cdh4.7.1.p0.47/lib/hadoop/client/protobuf-java-2.4.0a.jar
/opt/cloudera/parcels/CDH-4.7.1-1.cdh4.7.1.p0.47/lib/hadoop/client/protobuf-java.jar
/opt/cloudera/parcels/CDH-4.7.1-1.cdh4.7.1.p0.47/lib/hadoop-yarn/lib/protobuf-java-2.4.0a.jar
/opt/cloudera/parcels/CDH-4.7.1-1.cdh4.7.1.p0.47/lib/hcatalog/share/webhcat/svr/lib/protobuf-java-2.4.0a.jar
/opt/cloudera/parcels/CDH-4.7.1-1.cdh4.7.1.p0.47/lib/hadoop-mapreduce/lib/protobuf-java-2.4.0a.jar

果然有两个版本:

/data/01/local/apache-flume-1.6.0-bin/lib/protobuf-java-2.5.0.jar
/opt/cloudera/parcels/CDH-4.7.1-1.cdh4.7.1.p0.47/lib/hadoop/lib/protobuf-java-2.4.0a.jar

5.解决方案
根据
返回"This is supposed to be overridden by subclasses"这句话是 高版本protobuf-java-2.5.0.jar才会有的,
那么将高版本jar包移除,重新启动flume,模拟数据http请求,就能写进hdfs了.

mv /data/01/local/apache-flume-1.6.0-bin/lib/protobuf-java-2.5.0.jar  /data/01/local/apache-flume-1.6.0-bin/lib/protobuf-java-2.5.0.jar.bak

 

6.反思,有个担忧

flume1.6.0 -->protobuf-java-2.5.0.jar
cdh4.8.6 -->protobuf-java-2.4.0a.jar
cdh5.4.8 -->protobuf-java-2.5.0.jar

把flume的protobuf-java-2.5.0.jar给移除了,相当于 flume使用了2.4.0包,

担忧1.6.0版本flume的会使用2.5.0版本的函数方法,那么到时就会抛错,故就只能等着看了.

7.建议
假如使用CDH的话,个人建议最好使用配套的版本flume,
  进cloudera查看对应版本

CDH4.8.6  --》 flume 1.4.0

CDH5.4.8  --》 flume 1.5.0
假如使用Apache Hadoop的话,还是要配套的版本flume.

转载地址:http://igbfx.baihongyu.com/

你可能感兴趣的文章
STL 算法
查看>>
分享:Backbone.js 样例站点与入门指南
查看>>
图的基本算法
查看>>
HTML基础(一)
查看>>
boost.circular_buffer简介
查看>>
Database Appliance并非Mini版的Exadata-还原真实的Oracle Unbreakable Database Appliance
查看>>
网页图片缩放(js)
查看>>
如何用Fiddler对Android应用进行抓包
查看>>
iOS为所需要的视图添加模糊效果--UIVisualEffectView
查看>>
HDU-1222 Wolf and Rabbit (欧几里得定理)
查看>>
Camera Calibration 相机标定:原理简介(五)
查看>>
ehcache实例
查看>>
python 匿名函数
查看>>
javascript实现-------------选择排序
查看>>
讲真:序列化必读
查看>>
centOS中VMware Tools 安装
查看>>
oracle中以dba_、user_、v$_、all_、session_、index_开头的常...
查看>>
leetcode 116- Populating Next Right Pointers in Each Node
查看>>
spring项目启动错误——java.lang.NoClassDefFoundError: org/springframework/context/ApplicationContext...
查看>>
iOS开发网络篇—GET请求和POST请求
查看>>