java.lang.UnsupportedOperationException: This is supposed to be overridden by subclasses.
at com.google.protobuf.GeneratedMessage.getUnknownFields(GeneratedMessage.java:180)
at com.alibaba.otter.canal.protocol.CanalPacket$ClientAuth.getSerializedSize(CanalPacket.java:2045)
at com.google.protobuf.AbstractMessageLite.toByteString(AbstractMessageLite.java:49)
at com.alibaba.otter.canal.client.impl.SimpleCanalConnector.doConnect(SimpleCanalConnector.java:150)
at com.alibaba.otter.canal.client.impl.SimpleCanalConnector.connect(SimpleCanalConnector.java:97)
at com.alibaba.otter.canal.client.CanalConnector$connect.call(Unknown Source)
测试环境:canal server和client版本:v1.0.22;hbase-client版本:1.0.1.1
报错原因:canal 1.0.22版本依赖的protobuf版本为2.4.1,hbase依赖的protobuf版本为2.5.0,存在冲突。canal客户端连接canal server时,客户端classloader加载的版本为2.5.0,而服务端protobuf版本为2.4.1,导致请求报错。
解决方法:canal的protobuf版本升级为2.5.0。
步骤:重新生成protobuf java文件,并替换protocol/src/main/java/com/alibaba/otter/canal/protocol/;重新打canal-protocol包,替换client和server的canal-protocol依赖。
参考:https://github.com/alibaba/canal/issues/125
来源:oschina
链接:https://my.oschina.net/u/134474/blog/778762