alibaba/canal · error · CanalParseException
Unsupported connection type : + connection.getClass().getSi
Error message
Unsupported connection type : + connection.getClass().getSimpleName()
What it means
MysqlEventParser.preDump(ErosaConnection) only handles MysqlConnection instances. If the supplied ErosaConnection is any other concrete type, it throws CanalParseException naming the actual class. This is a defensive type check at the boundary where canal's abstract ErosaConnection (designed to also support Oracle) meets the MySQL-specific implementation.
Source
Thrown at parse/src/main/java/com/alibaba/otter/canal/parse/inbound/mysql/MysqlEventParser.java:80
private TableMetaCache tableMetaCache; // 对应meta
private int fallbackIntervalInSeconds = 60; // 切换回退时间
private BinlogFormat[] supportBinlogFormats; // 支持的binlogFormat,如果设置会执行强校验
private BinlogImage[] supportBinlogImages; // 支持的binlogImage,如果设置会执行强校验
// update by yishun.chen,特殊异常处理参数
private int dumpErrorCount = 0; // binlogDump失败异常计数
private int dumpErrorCountThreshold = 2; // binlogDump失败异常计数阀值
private boolean rdsOssMode = false;
private boolean autoResetLatestPosMode = false; // binlog被删除之后,自动按最新的数据订阅
private boolean multiStreamEnable; // support for polardbx binlog-x
protected ErosaConnection buildErosaConnection() {
return buildMysqlConnection(this.runningInfo);
}
protected void preDump(ErosaConnection connection) {
if (!(connection instanceof MysqlConnection)) {
throw new CanalParseException("Unsupported connection type : " + connection.getClass().getSimpleName());
}
if (binlogParser != null && binlogParser instanceof LogEventConvert) {
metaConnection = (MysqlConnection) connection.fork();
try {
metaConnection.connect();
} catch (IOException e) {
throw new CanalParseException(e);
}
if (supportBinlogFormats != null && supportBinlogFormats.length > 0) {
BinlogFormat format = ((MysqlConnection) metaConnection).getBinlogFormat();
boolean found = false;
for (BinlogFormat supportFormat : supportBinlogFormats) {
if (supportFormat != null && format == supportFormat) {
found = true;
break;
}View on GitHub (pinned to 87be50e876)
Solutions
- Ensure buildErosaConnection() returns a MysqlConnection (the default buildMysqlConnection does).
- If you wrote a custom connection type, use the matching AbstractEventParser subclass, not MysqlEventParser.
- Check canal.instance.parser.type / the parser bean class is MysqlEventParser for MySQL sources.
Defensive patterns
Strategy: type-guard
Type guard
private static boolean isMysqlConnection(ErosaConnection c) {
return c != null && c instanceof MysqlConnection;
} Prevention
- Ensure buildErosaConnection() returns a MysqlConnection.
- Use the correct parser subclass for non-MySQL backends.
- Do not wrap MysqlConnection in a non-MysqlConnection adapter.
When it happens
Trigger: A subclass of MysqlEventParser or a custom AbstractEventParser wiring returns a non-MysqlConnection ErosaConnection from buildErosaConnection(), and preDump receives it.
Common situations: Extending the parser for a different DB backend but routing it through MysqlEventParser; misconfigured parser class in instance properties; a custom ErosaConnection wrapper that does not extend MysqlConnection.
Related errors
- Unable to unwrap {} to com.mysql.jdbc.ConnectionImpl
- Get null field:{}#io
- connect failure
- can't create socket!
- Not implement yet
AI-assisted analysis of alibaba/canal@87be50e876 (2026-08-14).
Data as JSON: /api/errors/fa15cc6556aecb2d.
Report an issue: GitHub.