修改的依赖版本:
ch.qos.logback:logback-classic:1.2.8 ch.qos.logback:logback-core:1.2.8 com.h2database:h2:2.1.210 commons-beanutils:commons-beanutils:1.9.4 commons-collections:commons-collections:3.2.2 io.netty:netty-all:4.1.68.Final org.apache.commons:commons-compress:1.21 org.apache.kafka:kafka-clients:2.4.1 org.apache.rocketmq:rocketmq-client:4.8.0 org.apache.zookeeper:zookeeper:3.5.6 org.elasticsearch:elasticsearch:7.15.2 org.elasticsearch.client:transport:7.15.2 org.elasticsearch.client:elasticsearch-rest-client:7.15.2 org.elasticsearch.client:elasticsearch-rest-high-level-client:7.15.2 org.jboss.netty:netty:3.2.10.Final org.mybatis:mybatis:3.5.6 org.postgresql:postgresql:42.3.3 org.springframework:spring-core:5.3.9 org.springframework:spring-aop:5.3.9 org.yaml:snakeyaml:1.29
修改的部分代码: 1、com.alibaba.otter.canal.client.adapter.es6x.support包下的ESConnection 类和ESTemplate 类中的MappingMetaData改为MappingMetadata; 2、com.alibaba.otter.canal.client.adapter.es7x.support包下的ESConnection 和ESTemplate 中的MappingMetaData改为MappingMetadata; 3、com.alibaba.otter.canal.client.adapter.config.common包下的YamlProcessor类中的createDefaultMap()方法加一个参数createDefaultMap(int initSize); 4、com.alibaba.otter.canal.client.adapter.es6x包下的ES6xAdapter类引入import org.apache.lucene.search.TotalHits; 5、com.alibaba.otter.canal.client.adapter.es6x包下的ES6xAdapter类的count(String task)方法中的long rowCount = response.getHits().getTotalHits();改为TotalHits rowCount = response.getHits().getTotalHits(); 6、com.alibaba.otter.canal.client.adapter.es7x包下的ES6xAdapter类引入import org.apache.lucene.search.TotalHits; 7、com.alibaba.otter.canal.client.adapter.es7x包下的ES6xAdapter类的count(String task)方法中的long rowCount = response.getHits().getTotalHits();改为TotalHits rowCount = response.getHits().getTotalHits(); 8、com.alibaba.otter.canal.server.embedded包下的CanalServerWithEmbedded类,注释掉ack()方法的logger.info("ack successfully, clientId:{} batchId:{} position:{}"和getWithoutAck()方法的logger.debug("getWithoutAck successfully, clientId:{} batchSize:{} but result is null", clientIdentity.getClientId(), batchSize); 9、com.alibaba.otter.canal.server.netty.handler包下的SessionHandler类,注释掉messageReceived()方法的logger.info("message receives in session handler...");