开发者社区> 问答> 正文

内嵌的canal不支持mysql5.7 json类型

msyql5.7 json类型的字段会报错 java.lang.ClassCastException: java.lang.String cannot be cast to [B

详细堆栈: com.alibaba.otter.canal.parse.exception.CanalParseException: com.alibaba.otter.canal.parse.exception.CanalParseException: parse row data failed. Caused by: com.alibaba.otter.canal.parse.exception.CanalParseException: parse row data failed. Caused by: java.lang.ClassCastException: java.lang.String cannot be cast to [B at com.alibaba.otter.canal.parse.inbound.mysql.dbsync.LogEventConvert.parseOneRow(LogEventConvert.java:554) ~[canal.parse-1.0.22.jar:na] at com.alibaba.otter.canal.parse.inbound.mysql.dbsync.LogEventConvert.parseRowsEvent(LogEventConvert.java:371) ~[canal.parse-1.0.22.jar:na] at com.alibaba.otter.canal.parse.inbound.mysql.dbsync.LogEventConvert.parse(LogEventConvert.java:108) ~[canal.parse-1.0.22.jar:na] at com.alibaba.otter.canal.parse.inbound.mysql.dbsync.LogEventConvert.parse(LogEventConvert.java:62) ~[canal.parse-1.0.22.jar:na] at com.alibaba.otter.canal.parse.inbound.AbstractEventParser.parseAndProfilingIfNecessary(AbstractEventParser.java:327) ~[canal.parse-1.0.22.jar:na] at com.alibaba.otter.canal.parse.inbound.AbstractEventParser$3$1.sink(AbstractEventParser.java:177) ~[canal.parse-1.0.22.jar:na] at com.alibaba.otter.canal.parse.inbound.mysql.MysqlConnection.dump(MysqlConnection.java:121) ~[canal.parse-1.0.22.jar:na] at com.alibaba.otter.canal.parse.inbound.AbstractEventParser$3.run(AbstractEventParser.java:210) ~[canal.parse-1.0.22.jar:na] at java.lang.Thread.run(Thread.java:745) [na:1.8.0_101]

尝试将pom.xml的 otter_canal_version 从1.0.22替换为canal的最新版本1.0.23-SNAPSHOT,重新编译。 替换已经工作的node节点,会冲突,报错如下: Exception in thread "main" java.lang.ExceptionInInitializerError at com.alibaba.otter.node.deployer.OtterLauncher.main(OtterLauncher.java:39) Caused by: com.alibaba.otter.shared.common.model.config.ConfigException: ERROR ## Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'messageParser' defined in URL [jar:file:/data/app/otter/node/lib/node.etl-4.2.13.jar!/spring/otter-node-select.xml]: Initialization of bean failed; nested exception is java.lang.VerifyError: class com.alibaba.otter.canal.protocol.CanalEntry$Entry overrides final method getUnknownFields.()Lcom/google/protobuf/UnknownFieldSet; at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:527) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456) at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:294) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:225) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:291) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:193) at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:609) at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:918) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:469) at org.springframework.context.support.ClassPathXmlApplicationContext.(ClassPathXmlApplicationContext.java:139) at org.springframework.context.support.ClassPathXmlApplicationContext.(ClassPathXmlApplicationContext.java:83) at com.alibaba.otter.node.etl.OtterContextLocator$1.(OtterContextLocator.java:39) at com.alibaba.otter.node.etl.OtterContextLocator.(OtterContextLocator.java:39) at com.alibaba.otter.node.deployer.OtterLauncher.main(OtterLauncher.java:39) Caused by: java.lang.VerifyError: class com.alibaba.otter.canal.protocol.CanalEntry$Entry overrides final method getUnknownFields.()Lcom/google/protobuf/UnknownFieldSet; at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:763) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142) at java.net.URLClassLoader.defineClass(URLClassLoader.java:467) at java.net.URLClassLoader.access$100(URLClassLoader.java:73) at java.net.URLClassLoader$1.run(URLClassLoader.java:368) at java.net.URLClassLoader$1.run(URLClassLoader.java:362) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:361) at java.lang.ClassLoader.loadClass(ClassLoader.java:424) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331) at java.lang.ClassLoader.loadClass(ClassLoader.java:357) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:348) at sun.reflect.generics.factory.CoreReflectionFactory.makeNamedType(CoreReflectionFactory.java:114) at sun.reflect.generics.visitor.Reifier.visitClassTypeSignature(Reifier.java:125) at sun.reflect.generics.tree.ClassTypeSignature.accept(ClassTypeSignature.java:49) at sun.reflect.generics.visitor.Reifier.reifyTypeArguments(Reifier.java:68) at sun.reflect.generics.visitor.Reifier.visitClassTypeSignature(Reifier.java:138) at sun.reflect.generics.tree.ClassTypeSignature.accept(ClassTypeSignature.java:49) at sun.reflect.generics.repository.ConstructorRepository.getParameterTypes(ConstructorRepository.java:94) at java.lang.reflect.Executable.getGenericParameterTypes(Executable.java:283) at java.lang.reflect.Method.getGenericParameterTypes(Method.java:283) at java.beans.FeatureDescriptor.getParameterTypes(FeatureDescriptor.java:387) at java.beans.MethodDescriptor.setMethod(MethodDescriptor.java:116) at java.beans.MethodDescriptor.(MethodDescriptor.java:72) at java.beans.MethodDescriptor.(MethodDescriptor.java:56) at java.beans.Introspector.getTargetMethodInfo(Introspector.java:1205) at java.beans.Introspector.getBeanInfo(Introspector.java:426) at java.beans.Introspector.getBeanInfo(Introspector.java:173) at org.springframework.beans.CachedIntrospectionResults.(CachedIntrospectionResults.java:224) at org.springframework.beans.CachedIntrospectionResults.forClass(CachedIntrospectionResults.java:149) at org.springframework.beans.BeanWrapperImpl.getCachedIntrospectionResults(BeanWrapperImpl.java:324) at org.springframework.beans.BeanWrapperImpl.getPropertyDescriptors(BeanWrapperImpl.java:331) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.unsatisfiedNonSimpleProperties(AbstractAutowireCapableBeanFactory.java:1217) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireByName(AbstractAutowireCapableBeanFactory.java:1133) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1086) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:517) ... 13 more

原提问者GitHub用户 yjp211

展开
收起
大圣东游 2023-06-21 16:44:31 98 0
1 条回答
写回答
取消 提交回答
  • 1、otter要升级一个版本,升级protobuf版本

    2、json解析这块目前1.0.23-SNAPSHOT还有bug,已修复

    原回答者GitHub用户agapple

    2023-06-21 17:57:27
    赞同 展开评论 打赏
问答排行榜
最热
最新

相关电子书

更多
One Box: 解读事务与分析一体化数据库 HybridDB for MySQL 立即下载
One Box:解读事务与分析一体化数据库HybridDB for MySQL 立即下载
如何支撑HTAP场景-HybridDB for MySQL系统架构和技术演进 立即下载

相关镜像