BladeX-Links合并1.1.0版本代码后,启动Server后提示TDEngine错误

Blade 未结 3 288
HoChau
HoChau 剑童 2024-09-25 10:22

一、该问题的重现步骤是什么?

 BladeX-Links合并1.1.0版本代码后,启动Server后提示:


2024-09-25 10:14:07.212  INFO 17960 --- [           main] o.s.i.t.tdengine.dao.TDEngineTemplate    : TdEngine create database sql:CREATE DATABASE IF NOT EXISTS links PRECISION 'ms' CACHEMODEL 'last_value' KEEP 3650 DURATION 10 BUFFER 16 WAL_LEVEL 1


2024-09-25 10:14:08.351  INFO 17960 --- [           main] o.s.i.t.tdengine.dao.TDEngineTemplate    : TdEngine create STable sql:CREATE STABLE IF NOT EXISTS device_logger (`time` timestamp, `topic` NCHAR(128), `message` NCHAR(8192)) TAGS (`product_key` NCHAR(64), `device_name` NCHAR(64));

2024-09-25 10:14:08.354  INFO 17960 --- [           main] com.alibaba.druid.pool.DruidDataSource   : {dataSource-2} inited

2024-09-25 10:14:08.408 ERROR 17960 --- [           main] o.s.i.t.tdengine.dao.TDEngineTemplate    : TdEngine create STable error


org.springframework.jdbc.UncategorizedSQLException: StatementCallback; uncategorized SQLException for SQL [CREATE STABLE IF NOT EXISTS device_logger (`time` timestamp, `topic` NCHAR(128), `message` NCHAR(8192)) TAGS (`product_key` NCHAR(64), `device_name` NCHAR(64));]; SQL state []; error code [9794]; TDengine ERROR (0x2642): sql: CREATE STABLE IF NOT EXISTS device_logger (`time` timestamp, `topic` NCHAR(128), `message` NCHAR(8192)) TAGS (`product_key` NCHAR(64), `device_name` NCHAR(64));, desc: Invalid binary/nchar column length

at org.springframework.jdbc.core.JdbcTemplate.translateException(JdbcTemplate.java:1549)

at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:408)

at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:444)

at org.springblade.iot.tsdb.tdengine.dao.TDEngineTemplate.createSTable(TDEngineTemplate.java:318)

at org.springblade.iot.tsdb.tdengine.dao.TDEngineTemplate.afterSingletonsInstantiated(TDEngineTemplate.java:449)

at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:986)

at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:971)

at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:625)

at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:146)

at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:754)

at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:456)

at org.springframework.boot.SpringApplication.run(SpringApplication.java:335)

at org.springframework.boot.builder.SpringApplicationBuilder.run(SpringApplicationBuilder.java:149)

at org.springblade.core.launch.BladeApplication.run(BladeApplication.java:49)

at org.springblade.mqtt.broker.BrokerApplication.main(BrokerApplication.java:43)

Caused by: java.sql.SQLException: TDengine ERROR (0x2642): sql: CREATE STABLE IF NOT EXISTS device_logger (`time` timestamp, `topic` NCHAR(128), `message` NCHAR(8192)) TAGS (`product_key` NCHAR(64), `device_name` NCHAR(64));, desc: Invalid binary/nchar column length

at com.taosdata.jdbc.TSDBError.createSQLException(TSDBError.java:95)

at com.taosdata.jdbc.rs.RestfulStatement.execute(RestfulStatement.java:97)

at com.taosdata.jdbc.rs.RestfulStatement.execute(RestfulStatement.java:78)

at com.alibaba.druid.pool.DruidPooledStatement.execute(DruidPooledStatement.java:635)

at org.springframework.jdbc.core.JdbcTemplate$1ExecuteStatementCallback.doInStatement(JdbcTemplate.java:435)

at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:393)

... 13 common frames omitted

二、你期待的结果是什么?实际看到的又是什么?


三、你正在使用的是什么产品,什么版本?在什么操作系统上?

使用BladeX-Links,更新到1.1.0版本

四、请提供详细的错误堆栈信息,这很重要。


五、若有更多详细信息,请在下面提供。

3条回答
  • 2024-09-25 10:32

    报的错误是这个:

    desc: Invalid binary/nchar column length

    超出设定的字段长度了,你的productKey和topic长度分别是多少。

    topic长度设定的是128,productKey和deviceName是64。如果确实超出了,可以自行修改一下tdengie的封装模块,放大字段的长度

    作者追问:2024-09-25 10:52

    具体在哪改的呢

    回答: 2024-09-25 10:54

    在红框的类,其他的字段长度以此类推

    CleanShot20240925105331@2x.png

    回答: 2024-09-25 10:55

    这是productKey和deviceName

    CleanShot20240925105454@2x.png

    作者追问:2024-09-25 11:21

    改了还是报错,你们用的是哪个版本的

    image.png


    回答: 2024-09-25 11:24

    3.3.0.3 Community

    0 讨论(0)
  • 2024-09-25 15:48

    把 message 字段的长度改小点试试,td 一个表有总字段长度限制,我们这边是拿 3.3 的开发测试的。

    你直接用 taos 客户端工具调整并执行这个 sql 试试:

    CREATE STABLE IF NOT EXISTS device_logger (
    	`time` TIMESTAMP,
    	`topic` NCHAR(128),
    	`message` NCHAR(8192)) 
    TAGS (
    	`product_key` NCHAR(64),
    	`device_name` NCHAR(64));

    调试 ok 了再去改 java 代码,也欢迎反馈一下具体结果。我们也尽量兼容一下。


    作者追问:2024-09-25 17:56

    调用如下方法,报错

    private final ITsDBDeviceDataService deviceDataService;

    deviceDataService.saveDeviceProperty(topicVariables, params);



    2024-09-25 17:50:21.483 ERROR 37260 --- [pool-2-thread-1] o.s.iot.core.task.BaseBatchTask          : 批量消费失败,数据可能会丢失


    org.springframework.jdbc.UncategorizedSQLException: PreparedStatementCallback; uncategorized SQLException for SQL [INSERT INTO `device_property_ynobza0rumw_05eamkxm3c2n9elf` USING `device_property_ynobza0rumw` TAGS ('YNobza0rUMW', '05eAmkXm3c2n9eLF') (`time`, `usedNetPort`, `usedSerialPort`, `tx`, `ifname`, `rx`, `DISK_OC`, `TOTAL_MEM`, `AVAILABLE_MEM`, `FREE_MEM`, `CPU_OC`) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) `device_property_f4cmyfwsqs8_sehlbqozxm3o0z43` USING `device_property_f4cmyfwsqs8` TAGS ('F4CmYFWSqS8', 'seHlBqozxM3O0z43') (`time`, `T_In_c`, `In`, `T_In_a`, `T_In_b`, `Et`, `T`, `w_Pt`, `E_r_a`, `PFa`, `Ua`, `PFc`, `Ub`, `PFb`, `Uc`, `a_Pt`, `T_b`, `T_a`, `Ia`, `Ib`, `T_c`, `Ic`, `Ea`, `Eb`, `Ec`, `PFt`, `gear`) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?);]; SQL state []; error code [9731]; TDengine ERROR (0x2603): sql: INSERT INTO `device_property_ynobza0rumw_05eamkxm3c2n9elf` USING `device_property_ynobza0rumw` TAGS ('YNobza0rUMW', '05eAmkXm3c2n9eLF') (`time`, `usedNetPort`, `usedSerialPort`, `tx`, `ifname`, `rx`, `DISK_OC`, `TOTAL_MEM`, `AVAILABLE_MEM`, `FREE_MEM`, `CPU_OC`) VALUES (1727257821300, '1/2', '2/5', '0', 'eth1', '0', 71, 3976568, 3804508, 3566352, 28) `device_property_f4cmyfwsqs8_sehlbqozxm3o0z43` USING `device_property_f4cmyfwsqs8` TAGS ('F4CmYFWSqS8', 'seHlBqozxM3O0z43') (`time`, `T_In_c`, `In`, `T_In_a`, `T_In_b`, `Et`, `T`, `w_Pt`, `E_r_a`, `PFa`, `Ua`, `PFc`, `Ub`, `PFb`, `Uc`, `a_Pt`, `T_b`, `T_a`, `Ia`, `Ib`, `T_c`, `Ic`, `Ea`, `Eb`, `Ec`, `PFt`, `gear`) VALUES (1727257821316, 0.0, 0.0, 32.5, 0.0, 0.0, 33.6, 0.0, 0.0, 1.0, 230.22, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);, desc: Table does not exist

    at org.springframework.jdbc.core.JdbcTemplate.translateException(JdbcTemplate.java:1549)

    at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:677)

    at org.springframework.jdbc.core.JdbcTemplate.update(JdbcTemplate.java:970)

    at org.springframework.jdbc.core.JdbcTemplate.update(JdbcTemplate.java:1014)

    at org.springframework.jdbc.core.JdbcTemplate.update(JdbcTemplate.java:1024)

    at org.springblade.iot.tsdb.tdengine.dao.TDEngineTemplate.saveBatch(TDEngineTemplate.java:84)

    at org.springblade.iot.core.task.BaseBatchTask.consumerQueueData(BaseBatchTask.java:72)

    at org.springblade.iot.core.task.BaseBatchTask$1.run(BaseBatchTask.java:53)

    at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539)

    at java.base/java.util.concurrent.FutureTask.run$$$capture(FutureTask.java:264)

    at java.base/java.util.concurrent.FutureTask.run(FutureTask.java)

    at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:304)

    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)

    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)

    at java.base/java.lang.Thread.run(Thread.java:833)

    Caused by: java.sql.SQLException: TDengine ERROR (0x2603): sql: INSERT INTO `device_property_ynobza0rumw_05eamkxm3c2n9elf` USING `device_property_ynobza0rumw` TAGS ('YNobza0rUMW', '05eAmkXm3c2n9eLF') (`time`, `usedNetPort`, `usedSerialPort`, `tx`, `ifname`, `rx`, `DISK_OC`, `TOTAL_MEM`, `AVAILABLE_MEM`, `FREE_MEM`, `CPU_OC`) VALUES (1727257821300, '1/2', '2/5', '0', 'eth1', '0', 71, 3976568, 3804508, 3566352, 28) `device_property_f4cmyfwsqs8_sehlbqozxm3o0z43` USING `device_property_f4cmyfwsqs8` TAGS ('F4CmYFWSqS8', 'seHlBqozxM3O0z43') (`time`, `T_In_c`, `In`, `T_In_a`, `T_In_b`, `Et`, `T`, `w_Pt`, `E_r_a`, `PFa`, `Ua`, `PFc`, `Ub`, `PFb`, `Uc`, `a_Pt`, `T_b`, `T_a`, `Ia`, `Ib`, `T_c`, `Ic`, `Ea`, `Eb`, `Ec`, `PFt`, `gear`) VALUES (1727257821316, 0.0, 0.0, 32.5, 0.0, 0.0, 33.6, 0.0, 0.0, 1.0, 230.22, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);, desc: Table does not exist

    at com.taosdata.jdbc.TSDBError.createSQLException(TSDBError.java:95)

    at com.taosdata.jdbc.rs.RestfulStatement.execute(RestfulStatement.java:97)

    at com.taosdata.jdbc.rs.RestfulStatement.execute(RestfulStatement.java:78)

    at com.taosdata.jdbc.rs.RestfulStatement.executeUpdate(RestfulStatement.java:56)

    at com.taosdata.jdbc.rs.RestfulPreparedStatement.executeUpdate(RestfulPreparedStatement.java:59)

    at com.alibaba.druid.pool.DruidPooledPreparedStatement.executeUpdate(DruidPooledPreparedStatement.java:241)

    at org.springframework.jdbc.core.JdbcTemplate.lambda$update$2(JdbcTemplate.java:975)

    at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:658)

    ... 13 common frames omitted


    作者追问:2024-09-26 09:05

    1.0.0版本,使用的是Influxdb时序库,调用deviceDataService.saveDeviceProperty(topicVariablesparams);都没问题的,为什么升级到1.1.0版本,使用TDengine时序库,调用deviceDataService.saveDeviceProperty(topicVariablesparams)就会报表不存在


    org.springframework.jdbc.UncategorizedSQLException: PreparedStatementCallback; uncategorized SQLException for SQL [INSERT INTO `device_property_ynobza0rumw_05eamkxm3c2n9elf` USING `device_property_ynobza0rumw` TAGS ('YNobza0rUMW', '05eAmkXm3c2n9eLF') (`time`, `usedNetPort`, `usedSerialPort`, `tx`, `ifname`, `rx`, `DISK_OC`, `TOTAL_MEM`, `AVAILABLE_MEM`, `FREE_MEM`, `CPU_OC`) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) `device_property_f4cmyfwsqs8_sehlbqozxm3o0z43` USING `device_property_f4cmyfwsqs8` TAGS ('F4CmYFWSqS8', 'seHlBqozxM3O0z43') (`time`, `T_In_c`, `In`, `T_In_a`, `T_In_b`, `Et`, `T`, `w_Pt`, `E_r_a`, `PFa`, `Ua`, `PFc`, `Ub`, `PFb`, `Uc`, `a_Pt`, `T_b`, `T_a`, `Ia`, `Ib`, `T_c`, `Ic`, `Ea`, `Eb`, `Ec`, `PFt`, `gear`) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?);]; SQL state []; error code [9731]; TDengine ERROR (0x2603): sql: INSERT INTO `device_property_ynobza0rumw_05eamkxm3c2n9elf` USING `device_property_ynobza0rumw` TAGS ('YNobza0rUMW', '05eAmkXm3c2n9eLF') (`time`, `usedNetPort`, `usedSerialPort`, `tx`, `ifname`, `rx`, `DISK_OC`, `TOTAL_MEM`, `AVAILABLE_MEM`, `FREE_MEM`, `CPU_OC`) VALUES (1727257821300, '1/2', '2/5', '0', 'eth1', '0', 71, 3976568, 3804508, 3566352, 28) `device_property_f4cmyfwsqs8_sehlbqozxm3o0z43` USING `device_property_f4cmyfwsqs8` TAGS ('F4CmYFWSqS8', 'seHlBqozxM3O0z43') (`time`, `T_In_c`, `In`, `T_In_a`, `T_In_b`, `Et`, `T`, `w_Pt`, `E_r_a`, `PFa`, `Ua`, `PFc`, `Ub`, `PFb`, `Uc`, `a_Pt`, `T_b`, `T_a`, `Ia`, `Ib`, `T_c`, `Ic`, `Ea`, `Eb`, `Ec`, `PFt`, `gear`) VALUES (1727257821316, 0.0, 0.0, 32.5, 0.0, 0.0, 33.6, 0.0, 0.0, 1.0, 230.22, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);, desc: Table does not exist

    作者追问:2024-09-26 09:48

    用了TDengine后需要发布物模型才会创建超级表,具体看这里:https://iot.bladex.cn/tech/prologue/tsdb/tsdb.html#%E4%BA%8C%E3%80%81tdengine-%E9%85%8D%E7%BD%AE


    CleanShot20240926094843@2x.png

    作者追问:2024-09-26 14:21

    image.png


    这里是什么意思,1.0.0版本使用的是influxdb,已创建物模型,设备数据可以正常入库的。现在升级到1.1.0版本,使用 TDEngine,编辑产品的物模型重新发布了,还是提示表不存在,要怎么处理?

    作者追问:2024-09-26 14:38

    1.1.0开始在发布物模型的时候tdengine会创建超级表,根据下面的图打断点看看表有没有创建成功,进入tdengine控制台看看超级表的目录有哪些。

    另外为了防止升级合并遗漏的可能性,建议临时下载一个git私服最新版然后运行。启动成功后进入对应的两个产品发布物模型,再用设备模拟器测试上报数据,看下是否能成功。

    CleanShot20240926143351@2x.png

    CleanShot20240926143437@2x.png

    作者追问:2024-09-26 15:00

    image.png


    执行了还是不行

    作者追问:2024-09-26 15:04

    image.png


    看到有这张表

    作者追问:2024-09-26 15:05

    tdengine版本是多少,用git私服最新的原版跑一下,看看结果是多少。如果原版在tdengine3.3.0.3以上版本跑都没有效果,麻烦录个视频,看下你的具体操作步骤。发到邮箱 bladejava@qq.com

    作者追问:2024-09-26 15:19

    SQL state []; error code [9731]; TDengine ERROR (0x2603): sql: INSERT INTO `device_property_ynobza0rumw_05eamkxm3c2n9elf` USING `device_property_ynobza0rumw` TAGS ('YNobza0rUMW', '05eAmkXm3c2n9eLF')


    这个表没创建:device_property_ynobza0rumw,你再操作下。你提供的信息有点多,把成功的表也贴出来当作错误日志了。

    0 讨论(0)
  • 2024-09-26 15:51

    tdengine版本是3.0.1.4,有没可能是版本低了,要求最低版本是多少。还有,没看明白“用git私服最新的原版跑一下”是什么意思

    作者追问:2024-09-26 15:53

    我们的回复好好看啊,不然只看个头或者尾巴很难解决问题的

    CleanShot20240926155149@2x.png

    回答: 2024-09-27 10:42

    拉了blade_dev版本下来,只修改了broker和simulator模块的yml配置文件,跑broker还是报表Table does not exist错误:


    1、rabbitmq错误

    com.rabbitmq.client.AuthenticationFailureException: ACCESS_REFUSED - Login was refused using authentication mechanism PLAIN. For details see the broker logfile.

    at com.rabbitmq.client.impl.AMQConnection.start(AMQConnection.java:395)

    at com.rabbitmq.client.impl.recovery.RecoveryAwareAMQConnectionFactory.newConnection(RecoveryAwareAMQConnectionFactory.java:71)

    at com.rabbitmq.client.impl.recovery.AutorecoveringConnection.init(AutorecoveringConnection.java:165)

    at com.rabbitmq.client.ConnectionFactory.newConnection(ConnectionFactory.java:1242)

    at com.rabbitmq.client.ConnectionFactory.newConnection(ConnectionFactory.java:1198)

    at com.rabbitmq.client.ConnectionFactory.newConnection(ConnectionFactory.java:1156)

    at com.rabbitmq.client.ConnectionFactory.newConnection(ConnectionFactory.java:1321)

    at org.springblade.mqtt.broker.data.relay.handler.ServerRelayHandler.lambda$getAmqpConnection$6(ServerRelayHandler.java:266)

    at java.base/java.util.concurrent.ConcurrentHashMap.computeIfAbsent(ConcurrentHashMap.java:1708)

    at org.springblade.mqtt.broker.data.relay.handler.ServerRelayHandler.getAmqpConnection(ServerRelayHandler.java:259)

    at org.springblade.mqtt.broker.data.relay.handler.ServerRelayHandler.getAmqpChannel(ServerRelayHandler.java:282)

    at org.springblade.mqtt.broker.data.relay.config.DefaultServerRelayManager.forwardMessage(DefaultServerRelayManager.java:96)

    at org.springblade.mqtt.broker.data.relay.config.DefaultServerRelayManager.lambda$execute$0(DefaultServerRelayManager.java:77)

    at java.base/java.lang.Iterable.forEach(Iterable.java:75)

    at org.springblade.mqtt.broker.data.relay.config.DefaultServerRelayManager.lambda$execute$1(DefaultServerRelayManager.java:71)

    at java.base/java.util.concurrent.ConcurrentHashMap.forEach(ConcurrentHashMap.java:1603)

    at org.springblade.mqtt.broker.data.relay.config.DefaultServerRelayManager.lambda$execute$2(DefaultServerRelayManager.java:69)

    at java.base/java.util.concurrent.ConcurrentHashMap.forEach(ConcurrentHashMap.java:1603)

    at org.springblade.mqtt.broker.data.relay.config.DefaultServerRelayManager.execute(DefaultServerRelayManager.java:65)

    at org.springblade.mqtt.broker.data.listener.BladeMqttMessageListener.executeServerRelayManager(BladeMqttMessageListener.java:98)

    at org.springblade.mqtt.broker.data.listener.BladeMqttMessageListener.onMessage(BladeMqttMessageListener.java:74)

    at org.springblade.mqtt.broker.data.listener.BladeMqttFunctionMessageListener.execMqttFunction(BladeMqttFunctionMessageListener.java:83)

    at org.springblade.mqtt.broker.data.listener.BladeMqttFunctionMessageListener.lambda$onMessage$0(BladeMqttFunctionMessageListener.java:70)

    at org.springblade.core.boot.tenant.TenantIdUtil.use(TenantIdUtil.java:74)

    at org.springblade.mqtt.broker.data.listener.BladeMqttFunctionMessageListener.onMessage(BladeMqttFunctionMessageListener.java:69)

    at net.dreamlu.iot.mqtt.core.server.support.DefaultMqttServerProcessor.lambda$invokeListenerForPublish$4(DefaultMqttServerProcessor.java:503)

    at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539)

    at java.base/java.util.concurrent.FutureTask.run$$$capture(FutureTask.java:264)


    2、插入设备属性数据错误

    2024-09-27 10:30:42.901 ERROR 35336 --- [pool-2-thread-1] o.s.iot.core.task.BaseBatchTask          : 批量消费失败,数据可能会丢失


    org.springframework.jdbc.UncategorizedSQLException: PreparedStatementCallback; uncategorized SQLException for SQL 

    [INSERT INTO `device_logger_jkerjk97oub_27oy29bmmln` USING `device_logger` TAGS ('JkerjK97oub', '27OY29BMmLn') 

    (`time`, `topic`, `message`) VALUES (?, ?, ?) `device_property_jkerjk97oub_27oy29bmmln` USING `device_property_jkerjk97oub` TAGS

     ('JkerjK97oub', '27OY29BMmLn') (`time`, `LightSwitch`, `BatteryLevel`) VALUES (?, ?, ?) 

    `device_logger_jkerjk97oub_27oy29bmmln` USING `device_logger` TAGS ('JkerjK97oub', '27OY29BMmLn') 

    (`time`, `topic`, `message`) VALUES (?, ?, ?) `device_logger_jkerjk97oub_27oy29bmmln` USING `device_logger`

     TAGS ('JkerjK97oub', '27OY29BMmLn') (`time`, `topic`, `message`) VALUES (?, ?, ?) `device_logger_jkerjk97oub_27oy29bmmln` 

    USING `device_logger` TAGS ('JkerjK97oub', '27OY29BMmLn') (`time`, `topic`, `message`) VALUES (?, ?, ?) 

    `device_command_jkerjk97oub_27oy29bmmln` USING `device_command` TAGS ('JkerjK97oub', '27OY29BMmLn')

     (`time`, `output`, `input`, `identifier`, `commandName`) VALUES (?, ?, ?, ?, ?)

     `device_logger_jkerjk97oub_27oy29bmmln` USING `device_logger` TAGS ('JkerjK97oub', '27OY29BMmLn')

     (`time`, `topic`, `message`) VALUES (?, ?, ?) `device_event_jkerjk97oub_27oy29bmmln` USING `device_event` 

    TAGS ('JkerjK97oub', '27OY29BMmLn') (`time`, `output`, `identifier`, `eventName`, `eventType`) VALUES (?, ?, ?, ?, ?)

     `device_logger_jkerjk97oub_27oy29bmmln` USING `device_logger` TAGS ('JkerjK97oub', '27OY29BMmLn') (`time`, `topic`, `message`)

     VALUES (?, ?, ?);]; SQL state []; error code [9731]; TDengine ERROR (0x2603): sql: INSERT INTO `device_logger_jkerjk97oub_27oy29bmmln` 

    USING `device_logger` TAGS ('JkerjK97oub', '27OY29BMmLn') (`time`, `topic`, `message`) VALUES (1727404242467, '/blade/sys/JkerjK97oub/27OY29BMmLn/thing/event/property/post', '{"id":"b1485004447468dfba726459bb9b5103","version":"1.0","params":{"LightSwitch":"1","BatteryLevel":20}}') `device_property_jkerjk97oub_27oy29bmmln` USING `device_property_jkerjk97oub` TAGS ('JkerjK97oub', '27OY29BMmLn') (`time`, `LightSwitch`, `BatteryLevel`) VALUES (1727404242467, '1', 20) `device_logger_jkerjk97oub_27oy29bmmln` USING `device_logger` TAGS ('JkerjK97oub', '27OY29BMmLn') (`time`, `topic`, `message`) VALUES (1727404242467, '/blade/sys/JkerjK97oub/27OY29BMmLn/thing/event/property/post', '{"id":"b1485004447468dfba726459bb9b5103","version":"1.0","params":{"LightSwitch":"1","BatteryLevel":20}}') `device_logger_jkerjk97oub_27oy29bmmln` USING `device_logger` TAGS ('JkerjK97oub', '27OY29BMmLn') (`time`, `topic`, `message`) VALUES (1727404242478, '/blade/ext/ntp/JkerjK97oub/27OY29BMmLn/response', '{"deviceSendTime":"1727404162904","serverRecvTime":"1727404242477","serverSendTime":"1727404242477"}') `device_logger_jkerjk97oub_27oy29bmmln` USING `device_logger` TAGS ('JkerjK97oub', '27OY29BMmLn') (`time`, `topic`, `message`) VALUES (1727404242478, '/blade/ext/ntp/JkerjK97oub/27OY29BMmLn/request', '{"deviceSendTime":"1727404162904"}') `device_command_jkerjk97oub_27oy29bmmln` USING `device_command` TAGS ('JkerjK97oub', '27OY29BMmLn') (`time`, `output`, `input`, `identifier`, `commandName`) VALUES (1727404242489, '{"RebootTime":1727404162848}', '{"RebootStatus":"true"}', 'Reboot', '重启服务') `device_logger_jkerjk97oub_27oy29bmmln` USING `device_logger` TAGS ('JkerjK97oub', '27OY29BMmLn') (`time`, `topic`, `message`) VALUES (1727404242489, '/blade/sys/JkerjK97oub/27OY29BMmLn/thing/service/Reboot', '{"id":"c27962752d26b862552a889a396cff89","version":"1.0","params":{"output":"{\"RebootTime\":1727404162848}","input":"{\"RebootStatus\":\"true\"}","commandName":"重启服务"}}') `device_event_jkerjk97oub_27oy29bmmln` USING `device_event` TAGS ('JkerjK97oub', '27OY29BMmLn') (`time`, `output`, `identifier`, `eventName`, `eventType`) VALUES (1727404242500, '{"BatteryLevel":20}', 'LowBatteyEvent', '电量低事件', 'alert') `device_logger_jkerjk97oub_27oy29bmmln` USING `device_logger` TAGS ('JkerjK97oub', '27OY29BMmLn') (`time`, `topic`, `message`) VALUES (1727404242500, '/blade/sys/JkerjK97oub/27OY29BMmLn/thing/event/LowBatteyEvent/post', '{"id":"e122e2386aba5e31a6cfef6d02c36769","version":"1.0","params":{"output":"{\"BatteryLevel\":20}","eventName":"电量低事件","eventType":"alert"}}');, desc: Table does not exist

    at org.springframework.jdbc.core.JdbcTemplate.translateException(JdbcTemplate.java:1549)

    at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:677)

    at org.springframework.jdbc.core.JdbcTemplate.update(JdbcTemplate.java:970)

    at org.springframework.jdbc.core.JdbcTemplate.update(JdbcTemplate.java:1014)

    at org.springframework.jdbc.core.JdbcTemplate.update(JdbcTemplate.java:1024)

    at org.springblade.iot.tsdb.tdengine.dao.TDEngineTemplate.saveBatch(TDEngineTemplate.java:84)

    at org.springblade.iot.core.task.BaseBatchTask.consumerQueueData(BaseBatchTask.java:72)

    at org.springblade.iot.core.task.BaseBatchTask$1.run(BaseBatchTask.java:53)

    at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539)

    at java.base/java.util.concurrent.FutureTask.run$$$capture(FutureTask.java:264)

    at java.base/java.util.concurrent.FutureTask.run(FutureTask.java)

    at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:304)

    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)

    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)

    at java.base/java.lang.Thread.run(Thread.java:833)

    Caused by: java.sql.SQLException: TDengine ERROR (0x2603): sql: INSERT INTO `device_logger_jkerjk97oub_27oy29bmmln` USING `device_logger` TAGS ('JkerjK97oub', '27OY29BMmLn') (`time`, `topic`, `message`) VALUES (1727404242467, '/blade/sys/JkerjK97oub/27OY29BMmLn/thing/event/property/post', '{"id":"b1485004447468dfba726459bb9b5103","version":"1.0","params":{"LightSwitch":"1","BatteryLevel":20}}') `device_property_jkerjk97oub_27oy29bmmln` USING `device_property_jkerjk97oub` TAGS ('JkerjK97oub', '27OY29BMmLn') (`time`, `LightSwitch`, `BatteryLevel`) VALUES (1727404242467, '1', 20) `device_logger_jkerjk97oub_27oy29bmmln` USING `device_logger` TAGS ('JkerjK97oub', '27OY29BMmLn') (`time`, `topic`, `message`) VALUES (1727404242467, '/blade/sys/JkerjK97oub/27OY29BMmLn/thing/event/property/post', '{"id":"b1485004447468dfba726459bb9b5103","version":"1.0","params":{"LightSwitch":"1","BatteryLevel":20}}') `device_logger_jkerjk97oub_27oy29bmmln` USING `device_logger` TAGS ('JkerjK97oub', '27OY29BMmLn') (`time`, `topic`, `message`) VALUES (1727404242478, '/blade/ext/ntp/JkerjK97oub/27OY29BMmLn/response', '{"deviceSendTime":"1727404162904","serverRecvTime":"1727404242477","serverSendTime":"1727404242477"}') `device_logger_jkerjk97oub_27oy29bmmln` USING `device_logger` TAGS ('JkerjK97oub', '27OY29BMmLn') (`time`, `topic`, `message`) VALUES (1727404242478, '/blade/ext/ntp/JkerjK97oub/27OY29BMmLn/request', '{"deviceSendTime":"1727404162904"}') `device_command_jkerjk97oub_27oy29bmmln` USING `device_command` TAGS ('JkerjK97oub', '27OY29BMmLn') (`time`, `output`, `input`, `identifier`, `commandName`) VALUES (1727404242489, '{"RebootTime":1727404162848}', '{"RebootStatus":"true"}', 'Reboot', '重启服务') `device_logger_jkerjk97oub_27oy29bmmln` USING `device_logger` TAGS ('JkerjK97oub', '27OY29BMmLn') (`time`, `topic`, `message`) VALUES (1727404242489, '/blade/sys/JkerjK97oub/27OY29BMmLn/thing/service/Reboot', '{"id":"c27962752d26b862552a889a396cff89","version":"1.0","params":{"output":"{\"RebootTime\":1727404162848}","input":"{\"RebootStatus\":\"true\"}","commandName":"重启服务"}}') `device_event_jkerjk97oub_27oy29bmmln` USING `device_event` TAGS ('JkerjK97oub', '27OY29BMmLn') (`time`, `output`, `identifier`, `eventName`, `eventType`) VALUES (1727404242500, '{"BatteryLevel":20}', 'LowBatteyEvent', '电量低事件', 'alert') `device_logger_jkerjk97oub_27oy29bmmln` USING `device_logger` TAGS ('JkerjK97oub', '27OY29BMmLn') (`time`, `topic`, `message`) VALUES (1727404242500, '/blade/sys/JkerjK97oub/27OY29BMmLn/thing/event/LowBatteyEvent/post', '{"id":"e122e2386aba5e31a6cfef6d02c36769","version":"1.0","params":{"output":"{\"BatteryLevel\":20}","eventName":"电量低事件","eventType":"alert"}}');, desc: Table does not exist

    at com.taosdata.jdbc.TSDBError.createSQLException(TSDBError.java:95)

    at com.taosdata.jdbc.rs.RestfulStatement.execute(RestfulStatement.java:97)

    at com.taosdata.jdbc.rs.RestfulStatement.execute(RestfulStatement.java:78)

    at com.taosdata.jdbc.rs.RestfulStatement.executeUpdate(RestfulStatement.java:56)

    at com.taosdata.jdbc.rs.RestfulPreparedStatement.executeUpdate(RestfulPreparedStatement.java:59)

    at com.alibaba.druid.pool.DruidPooledPreparedStatement.executeUpdate(DruidPooledPreparedStatement.java:241)

    at org.springframework.jdbc.core.JdbcTemplate.lambda$update$2(JdbcTemplate.java:975)

    at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:658)

    ... 13 common frames omitted



    代码分支

    image.png


    时序库版本

    image.png


    数据库已有相关表

    image.png

    作者追问:2024-09-27 10:53

     1. 下载master分支:https://center.javablade.com/blade/BladeX-Links

     2. tdengine 3.3以上版本

     3. 重新创建数据库后跑起前后端,然后进入产品管理,把物模型重新发布

     4. 查看tdengine有没有创建 device_property_xx 的表 (你的数据库只有device_comand、device_event、device_log,说明你没有操作物模型发布)

     5. 有了之后再测试数据上报

     6. 如果实在解决不了,可能难度有点高,建议你换回influxdb

    回答: 2024-09-29 09:15

    下载master分支需要登录,请问账号在哪里建的 :https://center.javablade.com/blade/BladeX-Links 


    image.png


    0 讨论(0)
提交回复