Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NullPointerException when use canal1.1.5 and mysql8.0.11 #3538

Closed
2 tasks done
xiaoma20082008 opened this issue May 19, 2021 · 3 comments
Closed
2 tasks done

NullPointerException when use canal1.1.5 and mysql8.0.11 #3538

xiaoma20082008 opened this issue May 19, 2021 · 3 comments
Assignees
Labels
Milestone

Comments

@xiaoma20082008
Copy link
Contributor

  • I have searched the issues of this repository and believe that this is not a duplicate.
  • I have checked the FAQ of this repository and believe that this is not a duplicate.

environment

  • 1.1.5
  • 8.0.11

Issue Description

NullPointerException

Steps to reproduce

I'm using otter and update otter's canal-1.1.4 to canal-1.1.5

Expected behaviour

the nameMaps doesnot has a key named COLUMN_NAME

Actual behaviour

If there is an exception, please attach the exception trace:

Caused by: com.google.common.util.concurrent.UncheckedExecutionException: java.lang.NullPointerException
	at com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2203)
	at com.google.common.cache.LocalCache.get(LocalCache.java:3937)
	at com.google.common.cache.LocalCache.getOrLoad(LocalCache.java:3941)
	at com.google.common.cache.LocalCache$LocalLoadingCache.get(LocalCache.java:4824)
	at com.google.common.cache.LocalCache$LocalLoadingCache.getUnchecked(LocalCache.java:4830)
	at com.alibaba.otter.canal.parse.inbound.mysql.dbsync.TableMetaCache.getTableMeta(TableMetaCache.java:195)
	at com.alibaba.otter.canal.parse.inbound.mysql.dbsync.LogEventConvert.getTableMeta(LogEventConvert.java:972)
	at com.alibaba.otter.canal.parse.inbound.mysql.dbsync.LogEventConvert.parseRowsEventForTableMeta(LogEventConvert.java:496)
	at com.alibaba.otter.canal.parse.inbound.mysql.dbsync.LogEventConvert.parseRowsEvent(LogEventConvert.java:529)
	at com.alibaba.otter.canal.parse.inbound.mysql.dbsync.LogEventConvert.parseRowsEvent(LogEventConvert.java:508)
	at com.alibaba.otter.canal.parse.inbound.mysql.dbsync.LogEventConvert.parse(LogEventConvert.java:128)
	at com.alibaba.otter.canal.parse.inbound.mysql.dbsync.LogEventConvert.parse(LogEventConvert.java:71)
	at com.alibaba.otter.canal.parse.inbound.AbstractEventParser.parseAndProfilingIfNecessary(AbstractEventParser.java:414)
	at com.alibaba.otter.canal.parse.inbound.AbstractEventParser$1$1.sink(AbstractEventParser.java:214)
	at com.alibaba.otter.canal.parse.inbound.mysql.MysqlConnection.dump(MysqlConnection.java:185)
	at com.alibaba.otter.canal.parse.inbound.AbstractEventParser$1.run(AbstractEventParser.java:276)
	at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.NullPointerException
	at com.alibaba.otter.canal.parse.inbound.mysql.dbsync.TableMetaCache.parseTableMetaByDesc(TableMetaCache.java:128)
	at com.alibaba.otter.canal.parse.inbound.mysql.dbsync.TableMetaCache.getTableMetaByDB(TableMetaCache.java:96)
	at com.alibaba.otter.canal.parse.inbound.mysql.dbsync.TableMetaCache.access$000(TableMetaCache.java:32)
	at com.alibaba.otter.canal.parse.inbound.mysql.dbsync.TableMetaCache$1.load(TableMetaCache.java:63)
	at com.alibaba.otter.canal.parse.inbound.mysql.dbsync.TableMetaCache$1.load(TableMetaCache.java:53)
	at com.google.common.cache.LocalCache$LoadingValueReference.loadFuture(LocalCache.java:3527)
	at com.google.common.cache.LocalCache$Segment.loadSync(LocalCache.java:2319)
	at com.google.common.cache.LocalCache$Segment.lockedGetOrLoad(LocalCache.java:2282)
	at com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2197)
	... 16 more

image

@kingsmile16
Copy link

同样的问题,不知道怎么解决

@hrwhat
Copy link

hrwhat commented Apr 28, 2022

同样的问题,不知道怎么解决

+1

@hrwhat
Copy link

hrwhat commented Apr 28, 2022

问题解决了,与mysql8不兼容,需要修改一个地方:com.alibaba.otter.canal.parse.inbound.mysql.dbsync.TableMetaCache ,把以下几个常量的值:

    public static final String              COLUMN_NAME    = "COLUMN_NAME";
    public static final String              COLUMN_TYPE    = "COLUMN_TYPE";
    public static final String              IS_NULLABLE    = "IS_NULLABLE";
    public static final String              COLUMN_KEY     = "COLUMN_KEY";
    public static final String              COLUMN_DEFAULT = "COLUMN_DEFAULT";
    public static final String              EXTRA          = "EXTRA";

改成:

    public static final String              COLUMN_NAME    = "Field";
    public static final String              COLUMN_TYPE    = "Type";
    public static final String              IS_NULLABLE    = "Null";
    public static final String              COLUMN_KEY     = "Key";
    public static final String              COLUMN_DEFAULT = "Default";
    public static final String              EXTRA          = "Extra";

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants