Corrupted database?



  • I noticed the following errors in the mycontroller.log:

    2017-03-20 22:35:20,144 INFO [Quartz_Scheduler_Worker-5] [org.mycontroller.standalone.email.EmailUtils:57] EmailSettings(smtpHost=smtp.gmail.com, smtpPort=465, fromAddress=8768768@gmail.com, enableSsl=true, useStartTLS=false, smtpUsername=8768768)
    2017-03-20 22:35:22,231 ERROR [Quartz_Scheduler_Worker-5] [org.mycontroller.standalone.db.dao.BaseAbstractDaoImpl:279] unable to update item:[OperationTable(id=1, enabled=true, user=User(id=1, enabled=null, username=null, fullName=null, email=null, validity=null, permissions=[Super admin], allowedResources=AllowedResources(userId=1, gatewayIds=[-1], nodeIds=[-1], sensorIds=[-1], sensorVariableIds=[-1], mqttReadTopics=[], mqttWriteTopics=[])), name=Send notification email, type=SEND_EMAIL, lastExecution=1490042122174, properties={template=Event notification.html, toEmailAddress=8768768@gmail.com, templateBindings={notification=Rule definition: Disarm Alarm\nCondition: Script [ conditions/IsAlarmDisarmed.groovy <= {} ]\nPresent value: null\nTriggered at: Mar 20, 2017 10:35:20 PM IST\n--- www.mycontroller.org}, emailSubject=Motion sensor})]
    java.sql.SQLException: Unable to run update stmt on object OperationTable(id=1, enabled=true, user=User(id=1, enabled=null, username=null, fullName=null, email=null, validity=null, permissions=[Super admin], allowedResources=AllowedResources(userId=1, gatewayIds=[-1], nodeIds=[-1], sensorIds=[-1], sensorVariableIds=[-1], mqttReadTopics=[], mqttWriteTopics=[])), name=Send notification email, type=SEND_EMAIL, lastExecution=1490042122174, properties={template=Event notification.html, toEmailAddress=8768768@gmail.com, templateBindings={notification=Rule definition: Disarm Alarm
    Condition: Script [ conditions/IsAlarmDisarmed.groovy <= {} ]
    Present value: null
    Triggered at: Mar 20, 2017 10:35:20 PM IST
    --- www.mycontroller.org}, emailSubject=Motion sensor}): UPDATE `operation` SET `enabled` = ?, `userId` = ?, `name` = ?, `type` = ?, `lastExecution` = ?, `properties` = ? WHERE `id` = ?
        at com.j256.ormlite.misc.SqlExceptionUtil.create(SqlExceptionUtil.java:25)
        at com.j256.ormlite.stmt.mapped.MappedUpdate.update(MappedUpdate.java:129)
        at com.j256.ormlite.stmt.StatementExecutor.update(StatementExecutor.java:472)
        at com.j256.ormlite.dao.BaseDaoImpl.update(BaseDaoImpl.java:409)
        at org.mycontroller.standalone.db.dao.BaseAbstractDaoImpl.update(BaseAbstractDaoImpl.java:276)
        at org.mycontroller.standalone.operation.model.OperationSendEmail.execute(OperationSendEmail.java:148)
        at org.mycontroller.standalone.rule.McRuleBase.execute(McRuleBase.java:188)
        at org.easyrules.core.DefaultRulesEngine.applyRules(DefaultRulesEngine.java:162)
        at org.easyrules.core.DefaultRulesEngine.fireRules(DefaultRulesEngine.java:118)
        at org.mycontroller.standalone.rule.McRuleEngine.execute(McRuleEngine.java:97)
        at org.mycontroller.standalone.rule.McRuleEngine.doRun(McRuleEngine.java:128)
        at org.knowm.sundial.Job.execute(Job.java:57)
        at org.quartz.core.JobRunShell.run(JobRunShell.java:178)
        at org.quartz.core.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:515)
    Caused by: java.sql.SQLException: Could not write serialized object to byte array: {template=Event notification.html, toEmailAddress=8768768@gmail.com, templateBindings={notification=Rule definition: Disarm Alarm
    Condition: Script [ conditions/IsAlarmDisarmed.groovy <= {} ]
    Present value: null
    Triggered at: Mar 20, 2017 10:35:20 PM IST
    --- www.mycontroller.org}, emailSubject=Motion sensor}
        at com.j256.ormlite.misc.SqlExceptionUtil.create(SqlExceptionUtil.java:27)
        at com.j256.ormlite.field.types.SerializableType.javaToSqlArg(SerializableType.java:83)
        at com.j256.ormlite.field.FieldType.convertJavaFieldToSqlArgValue(FieldType.java:652)
        at com.j256.ormlite.field.FieldType.extractJavaFieldToSqlArgValue(FieldType.java:638)
        at com.j256.ormlite.stmt.mapped.BaseMappedStatement.getFieldObjects(BaseMappedStatement.java:45)
        at com.j256.ormlite.stmt.mapped.MappedUpdate.update(MappedUpdate.java:94)
        ... 12 common frames omitted
    Caused by: java.io.NotSerializableException: org.mycontroller.standalone.operation.Notification
        at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1184)
        at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:348)
        at java.util.HashMap.internalWriteEntries(HashMap.java:1785)
        at java.util.HashMap.writeObject(HashMap.java:1362)
        at sun.reflect.GeneratedMethodAccessor40.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at java.io.ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java:1028)
        at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1496)
        at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1432)
        at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1178)
        at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:348)
        at java.util.HashMap.internalWriteEntries(HashMap.java:1785)
        at java.util.HashMap.writeObject(HashMap.java:1362)
        at sun.reflect.GeneratedMethodAccessor40.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at java.io.ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java:1028)
        at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1496)
        at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1432)
        at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1178)
        at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:348)
        at com.j256.ormlite.field.types.SerializableType.javaToSqlArg(SerializableType.java:78)
        ... 16 common frames omitted
    2017-03-20 22:35:22,251 ERROR [Quartz_Scheduler_Worker-5] [org.mycontroller.standalone.db.dao.BaseAbstractDaoImpl:279] unable to update item:[OperationTable(id=1, enabled=true, user=User(id=1, enabled=null, username=null, fullName=null, email=null, validity=null, permissions=[Super admin], allowedResources=AllowedResources(userId=1, gatewayIds=[-1], nodeIds=[-1], sensorIds=[-1], sensorVariableIds=[-1], mqttReadTopics=[], mqttWriteTopics=[])), name=Send notification email, type=SEND_EMAIL, lastExecution=1490042122237, properties={template=Event notification.html, toEmailAddress=8768768@gmail.com, templateBindings={notification=Rule definition: Disarm Alarm\nCondition: Script [ conditions/IsAlarmDisarmed.groovy <= {} ]\nPresent value: null\nTriggered at: Mar 20, 2017 10:35:20 PM IST\n--- www.mycontroller.org}, emailSubject=Motion sensor})]
    java.sql.SQLException: Unable to run update stmt on object OperationTable(id=1, enabled=true, user=User(id=1, enabled=null, username=null, fullName=null, email=null, validity=null, permissions=[Super admin], allowedResources=AllowedResources(userId=1, gatewayIds=[-1], nodeIds=[-1], sensorIds=[-1], sensorVariableIds=[-1], mqttReadTopics=[], mqttWriteTopics=[])), name=Send notification email, type=SEND_EMAIL, lastExecution=1490042122237, properties={template=Event notification.html, toEmailAddress=8768768@gmail.com, templateBindings={notification=Rule definition: Disarm Alarm
    Condition: Script [ conditions/IsAlarmDisarmed.groovy <= {} ]
    Present value: null
    Triggered at: Mar 20, 2017 10:35:20 PM IST
    --- www.mycontroller.org}, emailSubject=Motion sensor}): UPDATE `operation` SET `enabled` = ?, `userId` = ?, `name` = ?, `type` = ?, `lastExecution` = ?, `properties` = ? WHERE `id` = ?
        at com.j256.ormlite.misc.SqlExceptionUtil.create(SqlExceptionUtil.java:25)
        at com.j256.ormlite.stmt.mapped.MappedUpdate.update(MappedUpdate.java:129)
        at com.j256.ormlite.stmt.StatementExecutor.update(StatementExecutor.java:472)
        at com.j256.ormlite.dao.BaseDaoImpl.update(BaseDaoImpl.java:409)
        at org.mycontroller.standalone.db.dao.BaseAbstractDaoImpl.update(BaseAbstractDaoImpl.java:276)
        at org.mycontroller.standalone.rule.McRuleBase.execute(McRuleBase.java:190)
        at org.easyrules.core.DefaultRulesEngine.applyRules(DefaultRulesEngine.java:162)
        at org.easyrules.core.DefaultRulesEngine.fireRules(DefaultRulesEngine.java:118)
        at org.mycontroller.standalone.rule.McRuleEngine.execute(McRuleEngine.java:97)
        at org.mycontroller.standalone.rule.McRuleEngine.doRun(McRuleEngine.java:128)
        at org.knowm.sundial.Job.execute(Job.java:57)
        at org.quartz.core.JobRunShell.run(JobRunShell.java:178)
        at org.quartz.core.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:515)
    Caused by: java.sql.SQLException: Could not write serialized object to byte array: {template=Event notification.html, toEmailAddress=8768768@gmail.com, templateBindings={notification=Rule definition: Disarm Alarm
    Condition: Script [ conditions/IsAlarmDisarmed.groovy <= {} ]
    Present value: null
    Triggered at: Mar 20, 2017 10:35:20 PM IST
    --- www.mycontroller.org}, emailSubject=Motion sensor}
        at com.j256.ormlite.misc.SqlExceptionUtil.create(SqlExceptionUtil.java:27)
        at com.j256.ormlite.field.types.SerializableType.javaToSqlArg(SerializableType.java:83)
        at com.j256.ormlite.field.FieldType.convertJavaFieldToSqlArgValue(FieldType.java:652)
        at com.j256.ormlite.field.FieldType.extractJavaFieldToSqlArgValue(FieldType.java:638)
        at com.j256.ormlite.stmt.mapped.BaseMappedStatement.getFieldObjects(BaseMappedStatement.java:45)
        at com.j256.ormlite.stmt.mapped.MappedUpdate.update(MappedUpdate.java:94)
        ... 11 common frames omitted
    Caused by: java.io.NotSerializableException: org.mycontroller.standalone.operation.Notification
        at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1184)
        at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:348)
        at java.util.HashMap.internalWriteEntries(HashMap.java:1785)
        at java.util.HashMap.writeObject(HashMap.java:1362)
        at sun.reflect.GeneratedMethodAccessor40.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at java.io.ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java:1028)
        at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1496)
        at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1432)
        at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1178)
        at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:348)
        at java.util.HashMap.internalWriteEntries(HashMap.java:1785)
        at java.util.HashMap.writeObject(HashMap.java:1362)
        at sun.reflect.GeneratedMethodAccessor40.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at java.io.ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java:1028)
        at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1496)
        at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1432)
        at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1178)
        at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:348)
        at com.j256.ormlite.field.types.SerializableType.javaToSqlArg(SerializableType.java:78)
        ... 15 common frames omitted
    

    Do I need to repair database?

    Is SQLite more reliable than default DB engine?
    How would I migrate?


  • ADMIN

    @benya

    Do I need to repair database?

    Thank you to report this issue!
    No, This is MyController issue. I have fixed it in this commit
    You can download this change from SNAPSHOT version.

    Is SQLite more reliable than default DB engine?
    How would I migrate?

    No, For now, MyController do not support for SQLite. Supports only for MySQL, MariaDB, PostgreSQL and H2 database.



  • Thanks. Your fix helped


Log in to reply