IOT项目启动 DeviceSimulatorApplication 设备模拟服务上报数据失败

IOT 未结 1 32
LikJ
LikJ 剑侠 2024-12-30 16:21

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

1. 根据文档,正确启动:基础服务、ServerApplication、BrokerApplication、DeviceSimulatorApplication和前端页面

2. 访问前端项目,发现设备正常在线,但是上报的历史数据看不到,如下图:image.pngimage.png

3.排查后台,发现DeviceSimulatorApplication服务正常上报数据

image.png

4.BrokerApplication服务控制台报错,如下图:image.png


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

期待可以正常看到历史上报的数据,实际看到的是历史数据保存时报错


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

在window10系统上运行 BladeX-Links:1.2.0 ,分支是master分支


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

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_event_jkerjk97oub_27oy29bmmln` USING `device_event` TAGS ('JkerjK97oub', '27OY29BMmLn') (`time`, `output`, `identifier`, `eventName`, `eventType`) 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_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 (?, ?, ?);]; 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 (1735546728725, '/blade/sys/JkerjK97oub/27OY29BMmLn/thing/event/property/post', '{"id":"189130b7161448b947dc31504e293c27","version":"1.0","params":{"LightSwitch":"1","BatteryLevel":20}}') `device_property_jkerjk97oub_27oy29bmmln` USING `device_property_jkerjk97oub` TAGS ('JkerjK97oub', '27OY29BMmLn') (`time`, `LightSwitch`, `BatteryLevel`) VALUES (1735546728725, '1', 20) `device_logger_jkerjk97oub_27oy29bmmln` USING `device_logger` TAGS ('JkerjK97oub', '27OY29BMmLn') (`time`, `topic`, `message`) VALUES (1735546728725, '/blade/sys/JkerjK97oub/27OY29BMmLn/thing/event/property/post', '{"id":"189130b7161448b947dc31504e293c27","version":"1.0","params":{"LightSwitch":"1","BatteryLevel":20}}') `device_event_jkerjk97oub_27oy29bmmln` USING `device_event` TAGS ('JkerjK97oub', '27OY29BMmLn') (`time`, `output`, `identifier`, `eventName`, `eventType`) VALUES (1735546728725, '{"BatteryLevel":20}', 'LowBatteyEvent', '电量低事件', 'alert') `device_command_jkerjk97oub_27oy29bmmln` USING `device_command` TAGS ('JkerjK97oub', '27OY29BMmLn') (`time`, `output`, `input`, `identifier`, `commandName`) VALUES (1735546728725, '{"RebootTime":1735544503327}', '{"RebootStatus":"true"}', 'Reboot', '重启服务') `device_logger_jkerjk97oub_27oy29bmmln` USING `device_logger` TAGS ('JkerjK97oub', '27OY29BMmLn') (`time`, `topic`, `message`) VALUES (1735546728725, '/blade/sys/JkerjK97oub/27OY29BMmLn/thing/event/LowBatteyEvent/post', '{"id":"b92bc94ea2928e75a6101cee070f1395","version":"1.0","params":{"output":"{\"BatteryLevel\":20}","eventName":"电量低事件","eventType":"alert"}}') `device_logger_jkerjk97oub_27oy29bmmln` USING `device_logger` TAGS ('JkerjK97oub', '27OY29BMmLn') (`time`, `topic`, `message`) VALUES (1735546728725, '/blade/sys/JkerjK97oub/27OY29BMmLn/thing/service/Reboot', '{"id":"a50eb84c272f169ae66f94a62633187f","version":"1.0","params":{"output":"{\"RebootTime\":1735544503327}","input":"{\"RebootStatus\":\"true\"}","commandName":"重启服务"}}') `device_logger_jkerjk97oub_27oy29bmmln` USING `device_logger` TAGS ('JkerjK97oub', '27OY29BMmLn') (`time`, `topic`, `message`) VALUES (1735546728725, '/blade/ext/ntp/JkerjK97oub/27OY29BMmLn/response', '{"deviceSendTime":"1735544503347","serverRecvTime":"1735546728725","serverSendTime":"1735546728725"}') `device_logger_jkerjk97oub_27oy29bmmln` USING `device_logger` TAGS ('JkerjK97oub', '27OY29BMmLn') (`time`, `topic`, `message`) VALUES (1735546728725, '/blade/ext/ntp/JkerjK97oub/27OY29BMmLn/request', '{"deviceSendTime":"1735544503347"}');, 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:842)

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 (1735546728725, '/blade/sys/JkerjK97oub/27OY29BMmLn/thing/event/property/post', '{"id":"189130b7161448b947dc31504e293c27","version":"1.0","params":{"LightSwitch":"1","BatteryLevel":20}}') `device_property_jkerjk97oub_27oy29bmmln` USING `device_property_jkerjk97oub` TAGS ('JkerjK97oub', '27OY29BMmLn') (`time`, `LightSwitch`, `BatteryLevel`) VALUES (1735546728725, '1', 20) `device_logger_jkerjk97oub_27oy29bmmln` USING `device_logger` TAGS ('JkerjK97oub', '27OY29BMmLn') (`time`, `topic`, `message`) VALUES (1735546728725, '/blade/sys/JkerjK97oub/27OY29BMmLn/thing/event/property/post', '{"id":"189130b7161448b947dc31504e293c27","version":"1.0","params":{"LightSwitch":"1","BatteryLevel":20}}') `device_event_jkerjk97oub_27oy29bmmln` USING `device_event` TAGS ('JkerjK97oub', '27OY29BMmLn') (`time`, `output`, `identifier`, `eventName`, `eventType`) VALUES (1735546728725, '{"BatteryLevel":20}', 'LowBatteyEvent', '电量低事件', 'alert') `device_command_jkerjk97oub_27oy29bmmln` USING `device_command` TAGS ('JkerjK97oub', '27OY29BMmLn') (`time`, `output`, `input`, `identifier`, `commandName`) VALUES (1735546728725, '{"RebootTime":1735544503327}', '{"RebootStatus":"true"}', 'Reboot', '重启服务') `device_logger_jkerjk97oub_27oy29bmmln` USING `device_logger` TAGS ('JkerjK97oub', '27OY29BMmLn') (`time`, `topic`, `message`) VALUES (1735546728725, '/blade/sys/JkerjK97oub/27OY29BMmLn/thing/event/LowBatteyEvent/post', '{"id":"b92bc94ea2928e75a6101cee070f1395","version":"1.0","params":{"output":"{\"BatteryLevel\":20}","eventName":"电量低事件","eventType":"alert"}}') `device_logger_jkerjk97oub_27oy29bmmln` USING `device_logger` TAGS ('JkerjK97oub', '27OY29BMmLn') (`time`, `topic`, `message`) VALUES (1735546728725, '/blade/sys/JkerjK97oub/27OY29BMmLn/thing/service/Reboot', '{"id":"a50eb84c272f169ae66f94a62633187f","version":"1.0","params":{"output":"{\"RebootTime\":1735544503327}","input":"{\"RebootStatus\":\"true\"}","commandName":"重启服务"}}') `device_logger_jkerjk97oub_27oy29bmmln` USING `device_logger` TAGS ('JkerjK97oub', '27OY29BMmLn') (`time`, `topic`, `message`) VALUES (1735546728725, '/blade/ext/ntp/JkerjK97oub/27OY29BMmLn/response', '{"deviceSendTime":"1735544503347","serverRecvTime":"1735546728725","serverSendTime":"1735546728725"}') `device_logger_jkerjk97oub_27oy29bmmln` USING `device_logger` TAGS ('JkerjK97oub', '27OY29BMmLn') (`time`, `topic`, `message`) VALUES (1735546728725, '/blade/ext/ntp/JkerjK97oub/27OY29BMmLn/request', '{"deviceSendTime":"1735544503347"}');, 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


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

1条回答
  • 2024-12-30 16:45

    用tdengine的话,比其他的时序库多一个超级表的概念,需要先创建超级表,后续的设备表日志表才会自动创建。

    而创建超级表的触发条件是给产品的物模型进行发布操作。

    具体可见:https://iot.bladex.cn/feature/device/product/tsl.html

    CleanShot20241230164627@2x.png

    0 讨论(0)
提交回复