otter Data truncation: Invalid JSON text: "Invalid encoding in string." at position 20

l2osamch  于 2022-12-31  发布在  其他
关注(0)|答案(3)|浏览(999)

pid:13 nid:1 exception:setl:com.alibaba.otter.node.etl.load.exception.LoadException: java.util.concurrent.ExecutionException: com.alibaba.otter.node.etl.load.exception.LoadException: com.alibaba.otter.node.etl.load.exception.LoadException: com.alibaba.otter.node.etl.load.exception.LoadException: org.springframework.dao.DataIntegrityViolationException: PreparedStatementCallback; SQL [insert into patient_live_video . navigation_resource ( area_id , column_id , navigation_id , resource_id , resource_type , resource_name , resource_info , sort , tag_id , tag_name , is_deleted , create_user , update_user , create_time , update_time , id ) values (? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ?) on duplicate key update area_id =values( area_id ) , column_id =values( column_id ) , navigation_id =values( navigation_id ) , resource_id =values( resource_id ) , resource_type =values( resource_type ) , resource_name =values( resource_name ) , resource_info =values( resource_info ) , sort =values( sort ) , tag_id =values( tag_id ) , tag_name =values( tag_name ) , is_deleted =values( is_deleted ) , create_user =values( create_user ) , update_user =values( update_user ) , create_time =values( create_time ) , update_time =values( update_time ) , id =values( id )]; Data truncation: Invalid JSON text: "Invalid encoding in string." at position 207 in value for column 'navigation_resource.resource_info'.; nested exception is com.mysql.jdbc.MysqlDataTruncation: Data truncation: Invalid JSON text: "Invalid encoding in string." at position 207 in value for column 'navigation_resource.resource_info'.
at org.springframework.jdbc.support.SQLStateSQLExceptionTranslator.doTranslate(SQLStateSQLExceptionTranslator.java:101)
at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:72)
at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:80)
at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:603)
at org.springframework.jdbc.core.JdbcTemplate.update(JdbcTemplate.java:812)
at org.springframework.jdbc.core.JdbcTemplate.update(JdbcTemplate.java:868)
at com.alibaba.otter.node.etl.load.loader.db.DbLoadAction$DbLoadWorker$2.doInTransaction(DbLoadAction.java:625)
at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:130)
at com.alibaba.otter.node.etl.load.loader.db.DbLoadAction$DbLoadWorker.doCall(DbLoadAction.java:617)
at com.alibaba.otter.node.etl.load.loader.db.DbLoadAction$DbLoadWorker.call(DbLoadAction.java:545)
at com.alibaba.otter.node.etl.load.loader.db.DbLoadAction.doTwoPhase(DbLoadAction.java:462)
at com.alibaba.otter.node.etl.load.loader.db.DbLoadAction.doLoad(DbLoadAction.java:275)
at com.alibaba.otter.node.etl.load.loader.db.DbLoadAction.load(DbLoadAction.java:161)
at com.alibaba.otter.node.etl.load.loader.db.DbLoadAction$$FastClassByCGLIB$$d932a4cb.invoke()
at net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:191)
at org.springframework.aop.framework.Cglib2AopProxy$DynamicAdvisedInterceptor.intercept(Cglib2AopProxy.java:618)
at com.alibaba.otter.node.etl.load.loader.db.DbLoadAction$$EnhancerByCGLIB$$80fd23c2.load()
at com.alibaba.otter.node.etl.load.loader.db.DataBatchLoader$2.call(DataBatchLoader.java:198)
at com.alibaba.otter.node.etl.load.loader.db.DataBatchLoader$2.call(DataBatchLoader.java:189)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Caused by: com.mysql.jdbc.MysqlDataTruncation: Data truncation: Invalid JSON text: "Invalid encoding in string." at position 207 in value for column 'navigation_resource.resource_info'.
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3976)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3914)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2530)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2683)
at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2495)
at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:1903)
at com.mysql.jdbc.PreparedStatement.executeUpdateInternal(PreparedStatement.java:2124)
at com.mysql.jdbc.PreparedStatement.executeUpdateInternal(PreparedStatement.java:2058)
at com.mysql.jdbc.PreparedStatement.executeLargeUpdate(PreparedStatement.java:5158)
at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2043)
at org.apache.commons.dbcp.DelegatingPreparedStatement.executeUpdate(DelegatingPreparedStatement.java:105)
at org.apache.commons.dbcp.DelegatingPreparedStatement.executeUpdate(DelegatingPreparedStatement.java:105)
at org.springframework.jdbc.core.JdbcTemplate$2.doInPreparedStatement(JdbcTemplate.java:818)
at org.springframework.jdbc.core.JdbcTemplate$2.doInPreparedStatement(JdbcTemplate.java:1)
at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:587)

... 21 more
  • PairId: 524 , TableId: 1,043 , EventType : U , Time : 1611351002000
  • Consistency : , Mode :

---Pks
EventColumn[index=0,columnType=-5,columnName=id,columnValue=374,isNull=false,isKey=true,isUpdate=true]
---oldPks

---Columns
EventColumn[index=1,columnType=-5,columnName=area_id,columnValue=0,isNull=false,isKey=false,isUpdate=true]
EventColumn[index=2,columnType=-5,columnName=column_id,columnValue=0,isNull=false,isKey=false,isUpdate=true]
EventColumn[index=3,columnType=-5,columnName=navigation_id,columnValue=15,isNull=false,isKey=false,isUpdate=true]
EventColumn[index=4,columnType=-5,columnName=resource_id,columnValue=1532412931435,isNull=false,isKey=false,isUpdate=true]
EventColumn[index=5,columnType=4,columnName=resource_type,columnValue=4,isNull=false,isKey=false,isUpdate=true]
EventColumn[index=6,columnType=12,columnName=resource_name,columnValue=脊柱侧弯的防治方法有哪些?,isNull=false,isKey=false,isUpdate=true]
EventColumn[index=7,columnType=12,columnName=resource_info,columnValue={"linkUrl": "https://patient.allinmed.cn/patientEducation/patientDetail?id=1532412931435", "coverUrl": "https://xxxxxxxxxx20/12/29/dxDcahfToMFsroVCJReZRgZXQgtJypWX.jpg", "authorName": "xxxxxx ", "hospitalName": "xxxxxx"},isNull=false,isKey=false,isUpdate=true]
EventColumn[index=8,columnType=4,columnName=sort,columnValue=280,isNull=false,isKey=false,isUpdate=true]
EventColumn[index=9,columnType=-5,columnName=tag_id,columnValue=0,isNull=false,isKey=false,isUpdate=true]
EventColumn[index=10,columnType=12,columnName=tag_name,columnValue=,isNull=false,isKey=false,isUpdate=true]
EventColumn[index=11,columnType=-7,columnName=is_deleted,columnValue=1,isNull=false,isKey=false,isUpdate=true]
EventColumn[index=12,columnType=12,columnName=create_user,columnValue=lishupeng,isNull=false,isKey=false,isUpdate=true]
EventColumn[index=13,columnType=12,columnName=update_user,columnValue=lishupeng,isNull=false,isKey=false,isUpdate=true]
EventColumn[index=14,columnType=93,columnName=create_time,columnValue=2020-12-29 16:31:08,isNull=false,isKey=false,isUpdate=true]
EventColumn[index=15,columnType=93,columnName=update_time,columnValue=2021-01-23 05:30:02,isNull=false,isKey=false,isUpdate=true]
---Sql

ttvkxqim

ttvkxqim1#

我知道是什么原因引起的了,但是不知道怎么解决。

我的表navigation_resource的resource_info列是json格式的

show create table navigation_resource \G
CREATE TABLE navigation_resource (
resource_info json DEFAULT NULL COMMENT '资源补充信息',
...
而otter在执行语句时,执行了这么个语句

update navigation_resource set resource_info='{"linkUrl": " https://patient.allinmed.cn/patientEducation/patientDetail?id=1532412931435 ", "coverUrl": " https://ixxxxxxxxcahfToMFsroVCJReZRgZXQgtJypWX.jpg ", "authorName": xxxx\t", "hospitalName": "xxxxxxx"}';

ERROR 3140 (22032): Invalid JSON text: "Invalid encoding in string." at position 207 in value for column 'navigation_resource .resource_info'.

但json格式的字段不能直接用普通的update语句。

看来是otter不支持json。真遗憾

我装的otter是最新版4.2.18

8yparm6h

8yparm6h2#

应该不是json的问题,而是特殊字符处理的问题。类似的字符: \t\r\n ,在接收到数据后,java表示应该是 \\t\\r\\n
升级canal-1.1.4至canal-1.1.5,问题不在出现!

jljoyd4f

jljoyd4f3#

请问,怎么升级otter里面的canal

相关问题