Weird error message assitance
-
Hi all, I am trying to add a new board with some new sensors, but the board is crashing and I am getting this error in the server log. Can anyone point to a possible problem??
2018-12-25 20:23:58,538 ERROR [mc-th-pool-6] [org.mycontroller.standalone.db.dao.BaseAbstractDaoImpl:248] unable to add new item:[MetricsDoubleTypeDevice(sensorVariable=SensorVariable(id=97, sensor=Sensor(id=93, sensorId=humid-4-1, type=S_HUM, name=Bosch Sensor Humidity, lastSeen=1545765829635, node=Node(id=10, eui=ESP_2D5A26, gatewayTable=GatewayTable(id=1, enabled=true, name=ESP devices gateway, networkType=MY_CONTROLLER, timestamp=1486111527969, state=UP, statusMessage=Connected Successfully, statusSince=1545761094427, type=MQTT, properties={p=, qos=0, u=, bh=tcp://localhost:1883, txDelay=0, tp=in_esp, cid=esp_client, ts=out_esp}), name=McNode04d, version=1.1.0, type=S_ARDUINO_NODE, libVersion=1.0.0, batteryLevel=null, eraseConfig=null, firmware=null, state=UP, lastSeen=1545765838524, rssi=-68 dBm, properties={rssi=-68 dBm, rssiAsQuality=64, bssid=18:31:BF:45:CE:B0, gatewayIP=192.168.0.1, subnetMask=255.255.255.0, ssid=sniffer, hbTx=1545764104527, freeHeap=32304, macAddress=5C:CF:7F:2D:5A:26, hostname=ESP_2D5A26, flashChipSize=4194304, flashChipSpeed=40000000, vcc=3032 mV, flashChipRealSize=4194304, localIP=192.168.0.112, cycleCount=-1470310702, chipId=2972198}, parentNodeEui=null, registrationState=REGISTERED, smartSleepEnabled=false), room=null, variableTypes=[Humidity]), variableType=V_HUM, metricType=DOUBLE, timestamp=1545765838519, value=null, previousValue=null, unitType=U_HUMIDITY, readOnly=false, offset=0.0, priority=100, properties={marginRight=20, color=#ff7f0e, interpolate=linear, subType=line, marginBottom=60, useGlobal=true, type=lineChart, marginTop=5, marginLeft=65}), timestamp=1545765838519, samples=1, min=null, max=null, avg=null, aggregationType=RAW, start=null, end=null)] java.sql.SQLException: Unable to run insert stmt on object MetricsDoubleTypeDevice(sensorVariable=SensorVariable(id=97, sensor=Sensor(id=93, sensorId=humid-4-1, type=S_HUM, name=Bosch Sensor Humidity, lastSeen=1545765829635, node=Node(id=10, eui=ESP_2D5A26, gatewayTable=GatewayTable(id=1, enabled=true, name=ESP devices gateway, networkType=MY_CONTROLLER, timestamp=1486111527969, state=UP, statusMessage=Connected Successfully, statusSince=1545761094427, type=MQTT, properties={p=, qos=0, u=, bh=tcp://localhost:1883, txDelay=0, tp=in_esp, cid=esp_client, ts=out_esp}), name=McNode04d, version=1.1.0, type=S_ARDUINO_NODE, libVersion=1.0.0, batteryLevel=null, eraseConfig=null, firmware=null, state=UP, lastSeen=1545765838524, rssi=-68 dBm, properties={rssi=-68 dBm, rssiAsQuality=64, bssid=18:31:BF:45:CE:B0, gatewayIP=192.168.0.1, subnetMask=255.255.255.0, ssid=sniffer, hbTx=1545764104527, freeHeap=32304, macAddress=5C:CF:7F:2D:5A:26, hostname=ESP_2D5A26, flashChipSize=4194304, flashChipSpeed=40000000, vcc=3032 mV, flashChipRealSize=4194304, localIP=192.168.0.112, cycleCount=-1470310702, chipId=2972198}, parentNodeEui=null, registrationState=REGISTERED, smartSleepEnabled=false), room=null, variableTypes=[Humidity]), variableType=V_HUM, metricType=DOUBLE, timestamp=1545765838519, value=null, previousValue=null, unitType=U_HUMIDITY, readOnly=false, offset=0.0, priority=100, properties={marginRight=20, color=#ff7f0e, interpolate=linear, subType=line, marginBottom=60, useGlobal=true, type=lineChart, marginTop=5, marginLeft=65}), timestamp=1545765838519, samples=1, min=null, max=null, avg=null, aggregationType=RAW, start=null, end=null): INSERT INTO `metrics_double_type_device` (`sensorVariableId` ,`timestamp` ,`samples` ,`min` ,`max` ,`avg` ,`aggregationType` ) VALUES (?,?,?,?,?,?,?) at com.j256.ormlite.misc.SqlExceptionUtil.create(SqlExceptionUtil.java:25) at com.j256.ormlite.stmt.mapped.MappedCreate.insert(MappedCreate.java:137) at com.j256.ormlite.stmt.StatementExecutor.create(StatementExecutor.java:458) at com.j256.ormlite.dao.BaseDaoImpl.create(BaseDaoImpl.java:328) at org.mycontroller.standalone.db.dao.BaseAbstractDaoImpl.create(BaseAbstractDaoImpl.java:245) at org.mycontroller.standalone.metrics.engine.MetricEngineMyController.post(MetricEngineMyController.java:87) at org.mycontroller.standalone.provider.ExecuteMessageDependentTask.executeDependentTask(ExecuteMessageDependentTask.java:60) at org.mycontroller.standalone.provider.ExecuteMessageDependentTask.run(ExecuteMessageDependentTask.java:84) 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: org.h2.jdbc.JdbcSQLException: NULL not allowed for column "AVG"; SQL statement: INSERT INTO `metrics_double_type_device` (`sensorVariableId` ,`timestamp` ,`samples` ,`min` ,`max` ,`avg` ,`aggregationType` ) VALUES (?,?,?,?,?,?,?) [23502-194] at org.h2.message.DbException.getJdbcSQLException(DbException.java:345) at org.h2.message.DbException.get(DbException.java:179) at org.h2.message.DbException.get(DbException.java:155) at org.h2.table.Column.validateConvertUpdateSequence(Column.java:311) at org.h2.table.Table.validateConvertUpdateSequence(Table.java:793) at org.h2.command.dml.Insert.insertRows(Insert.java:151) at org.h2.command.dml.Insert.update(Insert.java:114) at org.h2.command.CommandContainer.update(CommandContainer.java:101) at org.h2.command.Command.executeUpdate(Command.java:258) at org.h2.jdbc.JdbcPreparedStatement.executeUpdateInternal(JdbcPreparedStatement.java:160) at org.h2.jdbc.JdbcPreparedStatement.executeUpdate(JdbcPreparedStatement.java:146) at com.j256.ormlite.jdbc.JdbcDatabaseConnection.insert(JdbcDatabaseConnection.java:183) at com.j256.ormlite.stmt.mapped.MappedCreate.insert(MappedCreate.java:91) ... 9 common frames omitted ```
-
@njbuch for some reason, SensorVariable data updated as NULL in MyController database,
SensorVariable(id=97, sensor=Sensor(id=93, sensorId=humid-4-1, type=S_HUM, name=Bosch Sensor Humidity, node=Node(id=10, eui=ESP_2D5A26, name=McNode04d)), variableType=V_HUM, metricType=DOUBLE, timestamp=1545765838519, value=null, previousValue=null, unitType=U_HUMIDITY)
Can you delete this sensor variable and try to add it again?
-
I think the bad version of the library from the other topic might be the problem here, as I think the device-code is presenting some vars that are newer posted values to. Will check this and return.