【TDengine 使用环境】
生产环境
【TDengine 版本】
3.3.5.8版本
【操作系统以及版本】
Windows 11 家庭中文版
【部署方式】容器
【集群节点数】
1
【集群副本数】
1
【描述业务影响】
插入的是整数类型 但是在执行过程会转byte类型报错。
使用java3.5.3版本插入数据时报错,
15:37:01.461 [messageConsumeTask1] DEBUG c.f.i.m.T.save - [debug,137] - ==> Preparing: insert into fastbee_log.device_D1ELV3A5TOJS using device_log tags (?) values ( ?, ?, ?, ?, ?, ?, ?, ?, ?);
15:37:01.480 [messageConsumeTask1] DEBUG c.f.i.m.T.save - [debug,137] - ==> Parameters: D1ELV3A5TOJS(String), 2025-11-03 15:37:01.458(Timestamp), 1(String), 1(Integer), 5(Integer), online(String), 3(Integer), 设备上线(String), 1(Long), admin(String)
【报错完整截图】
报错信息:
org.springframework.jdbc.UncategorizedSQLException:
Error updating database. Cause: java.sql.SQLException: Error
The error may exist in file [F:\project\kaiyuan\fastbee-dev\springboot\fastbee-service\fastbee-iot-service\target\classes\mapper\iot\TDDeviceLogMapper.xml]
The error may involve com.fastbee.iot.mapper.TDDeviceLogMapper.save-Inline
The error occurred while setting parameters
SQL: insert into fastbee_log.device_D1ELV3A5TOJS using device_log tags (?) values ( ?, ?, ?, ?, ?, ?, ?, ?, ?);
Cause: java.sql.SQLException: Error
; uncategorized SQLException; SQL state [null]; error code [0]; Error; nested exception is java.sql.SQLException: Error
at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:92)
at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:441)
at com.sun.proxy.$Proxy199.insert(Unknown Source)
at org.mybatis.spring.SqlSessionTemplate.insert(SqlSessionTemplate.java:272)
at com.baomidou.mybatisplus.core.override.MybatisMapperMethod.execute(MybatisMapperMethod.java:59)
at com.baomidou.mybatisplus.core.override.MybatisMapperProxy$PlainMethodInvoker.invoke(MybatisMapperProxy.java:148)
at com.baomidou.mybatisplus.core.override.MybatisMapperProxy.invoke(MybatisMapperProxy.java:89)
at com.sun.proxy.$Proxy260.save(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:344)
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:198)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163)
at org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.invoke(PersistenceExceptionTranslationInterceptor.java:137)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:215)
at com.sun.proxy.$Proxy261.save(Unknown Source)
at com.fastbee.iot.tsdb.service.impl.TdengineLogServiceImpl.saveDeviceLog(TdengineLogServiceImpl.java:69)
at com.fastbee.iot.tsdb.service.impl.TdengineLogServiceImpl$$FastClassBySpringCGLIB$$e0faf21c.invoke()
at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:218)
at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:793)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163)
at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:763)
at com.baomidou.dynamic.datasource.aop.DynamicDataSourceAnnotationInterceptor.invoke(DynamicDataSourceAnnotationInterceptor.java:57)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:763)
at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:708)
at com.fastbee.iot.tsdb.service.impl.TdengineLogServiceImpl$$EnhancerBySpringCGLIB$$f2878625.saveDeviceLog()
at com.fastbee.iot.service.impl.DeviceUpdateServiceImpl.updateDeviceStatusAndLocation(DeviceUpdateServiceImpl.java:166)
at com.fastbee.iot.service.impl.DeviceUpdateServiceImpl$$FastClassBySpringCGLIB$$17d7b1d6.invoke()
at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:218)
at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:793)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163)
at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:763)
at com.baomidou.dynamic.datasource.aop.DynamicLocalTransactionInterceptor$1.execute(DynamicLocalTransactionInterceptor.java:51)
at com.baomidou.dynamic.datasource.tx.TransactionalTemplate.doExecute(TransactionalTemplate.java:118)
at com.baomidou.dynamic.datasource.tx.TransactionalTemplate.execute(TransactionalTemplate.java:94)
at com.baomidou.dynamic.datasource.aop.DynamicLocalTransactionInterceptor.invoke(DynamicLocalTransactionInterceptor.java:59)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)
at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:763)
at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:708)
at com.fastbee.iot.service.impl.DeviceUpdateServiceImpl$$EnhancerBySpringCGLIB$$86f08ae9.updateDeviceStatusAndLocation()
at com.fastbee.iot.data.consumer.DeviceStatusConsumer.consume(DeviceStatusConsumer.java:111)
at com.fastbee.iot.data.listen.DeviceStatusListen.listen(DeviceStatusListen.java:28)
at com.fastbee.iot.data.listen.DeviceStatusListen$$FastClassBySpringCGLIB$$9b61bce7.invoke()
at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:218)
at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:793)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163)
at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:763)
at org.springframework.aop.interceptor.AsyncExecutionInterceptor.lambda$invoke$0(AsyncExecutionInterceptor.java:115)
at java.util.concurrent.FutureTask.run$$$capture(FutureTask.java:266)
at java.util.concurrent.FutureTask.run(FutureTask.java)
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:750)
Caused by: java.sql.SQLException: Error
at com.alibaba.druid.pool.DruidDataSource.handleConnectionException(DruidDataSource.java:1933)
at com.alibaba.druid.pool.DruidPooledConnection.handleException(DruidPooledConnection.java:124)
at com.alibaba.druid.pool.DruidPooledStatement.checkException(DruidPooledStatement.java:87)
at com.alibaba.druid.pool.DruidPooledPreparedStatement.execute(DruidPooledPreparedStatement.java:487)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.apache.ibatis.logging.jdbc.PreparedStatementLogger.invoke(PreparedStatementLogger.java:59)
at com.sun.proxy.$Proxy214.execute(Unknown Source)
at org.apache.ibatis.executor.statement.PreparedStatementHandler.update(PreparedStatementHandler.java:47)
at org.apache.ibatis.executor.statement.RoutingStatementHandler.update(RoutingStatementHandler.java:74)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.apache.ibatis.plugin.Plugin.invoke(Plugin.java:64)
at com.sun.proxy.$Proxy212.update(Unknown Source)
at org.apache.ibatis.executor.SimpleExecutor.doUpdate(SimpleExecutor.java:50)
at org.apache.ibatis.executor.BaseExecutor.update(BaseExecutor.java:117)
at org.apache.ibatis.executor.CachingExecutor.update(CachingExecutor.java:76)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.apache.ibatis.plugin.Invocation.proceed(Invocation.java:49)
at com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor.intercept(MybatisPlusInterceptor.java:106)
at org.apache.ibatis.plugin.Plugin.invoke(Plugin.java:62)
at com.sun.proxy.$Proxy211.update(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.apache.ibatis.plugin.Plugin.invoke(Plugin.java:64)
at com.sun.proxy.$Proxy211.update(Unknown Source)
at org.apache.ibatis.session.defaults.DefaultSqlSession.update(DefaultSqlSession.java:194)
at org.apache.ibatis.session.defaults.DefaultSqlSession.insert(DefaultSqlSession.java:181)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:427)
… 55 common frames omitted
Caused by: java.lang.ClassCastException: java.lang.Integer cannot be cast to java.lang.Byte
at com.taosdata.jdbc.common.SerializeBlock.SerializeNormalDataType(SerializeBlock.java:174)
at com.taosdata.jdbc.common.SerializeBlock.serializeColumn(SerializeBlock.java:103)
at com.taosdata.jdbc.common.SerializeBlock.getStmt2BindBlock(SerializeBlock.java:651)
at com.taosdata.jdbc.ws.TSWSPreparedStatement.executeBatchImpl(TSWSPreparedStatement.java:1083)
at com.taosdata.jdbc.ws.TSWSPreparedStatement.executeUpdate(TSWSPreparedStatement.java:195)
at com.taosdata.jdbc.ws.TSWSPreparedStatement.execute(TSWSPreparedStatement.java:131)
at com.alibaba.druid.filter.FilterChainImpl.preparedStatement_execute(FilterChainImpl.java:3462)
at com.alibaba.druid.filter.FilterEventAdapter.preparedStatement_execute(FilterEventAdapter.java:434)
at com.alibaba.druid.filter.FilterChainImpl.preparedStatement_execute(FilterChainImpl.java:3460)
at com.alibaba.druid.proxy.jdbc.PreparedStatementProxyImpl.execute(PreparedStatementProxyImpl.java:158)
at com.alibaba.druid.pool.DruidPooledPreparedStatement.execute(DruidPooledPreparedStatement.java:483)
… 93 common frames omitted
