MangoES won't start up
-
My MangoES box has been running good for a couple of months but when I went to access it today it had crashed.
When I try to start Mango I get the following error:ERROR 2019-11-29T12:12:05,183 (com.serotonin.m2m2.Main.main:162) - Error during initialization
com.serotonin.ShouldNeverHappenException: org.springframework.jdbc.BadSqlGrammarException: StatementC allback; bad SQL grammar [ALTER TABLE users ADD COLUMN organization varchar(80); ]; nested exception is org.h2.jdbc.JdbcSQLSyntaxErrorException: Duplicate column name "ORGANIZATION"; SQL statement:
ALTER TABLE users ADD COLUMN organization varchar(80); [42121-199]
at com.serotonin.m2m2.db.upgrade.DBUpgrade.checkUpgrade(DBUpgrade.java:104) ~[mango-3.7.1.jar :?]
at com.serotonin.m2m2.db.upgrade.DBUpgrade.checkUpgrade(DBUpgrade.java:36) ~[mango-3.7.1.jar: ?]
at com.serotonin.m2m2.db.AbstractDatabaseProxy.initialize(AbstractDatabaseProxy.java:154) ~[m ango-3.7.1.jar:?]
at com.serotonin.m2m2.Lifecycle.databaseInitialize(Lifecycle.java:732) ~[ma-priv-3.7.1.jar:?]
at com.serotonin.m2m2.Lifecycle.initialize(Lifecycle.java:285) ~[ma-priv-3.7.1.jar:?]
at com.serotonin.m2m2.Main.main(Main.java:159) ~[ma-priv-3.7.1.jar:?]
Caused by: org.springframework.jdbc.BadSqlGrammarException: StatementCallback; bad SQL grammar [ALTER TABLE users ADD COLUMN organization varchar(80); ]; nested exception is org.h2.jdbc.JdbcSQLSyntaxErr orException: Duplicate column name "ORGANIZATION"; SQL statement:
ALTER TABLE users ADD COLUMN organization varchar(80); [42121-199]
at org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator.doTranslate(SQLErrorCo deSQLExceptionTranslator.java:234) ~[spring-jdbc-5.1.7.RELEASE.jar:5.1.7.RELEASE]
at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(Abstract FallbackSQLExceptionTranslator.java:72) ~[spring-jdbc-5.1.7.RELEASE.jar:5.1.7.RELEASE]
at org.springframework.jdbc.core.JdbcTemplate.translateException(JdbcTemplate.java:1442) ~[sp ring-jdbc-5.1.7.RELEASE.jar:5.1.7.RELEASE]
at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:387) ~[spring-jdbc-5. 1.7.RELEASE.jar:5.1.7.RELEASE]
at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:417) ~[spring-jdbc-5. 1.7.RELEASE.jar:5.1.7.RELEASE]
at com.serotonin.m2m2.db.H2Proxy.runScript(H2Proxy.java:281) ~[mango-3.7.1.jar:?]
at com.serotonin.m2m2.db.upgrade.DBUpgrade.runScript(DBUpgrade.java:136) ~[mango-3.7.1.jar:?]
at com.serotonin.m2m2.db.upgrade.DBUpgrade.runScript(DBUpgrade.java:160) ~[mango-3.7.1.jar:?]
at com.serotonin.m2m2.db.upgrade.Upgrade28.upgrade(Upgrade28.java:87) ~[mango-3.7.1.jar:?]
at com.serotonin.m2m2.db.upgrade.DBUpgrade.checkUpgrade(DBUpgrade.java:100) ~[mango-3.7.1.jar :?]
... 5 more
Caused by: org.h2.jdbc.JdbcSQLSyntaxErrorException: Duplicate column name "ORGANIZATION"; SQL stateme nt:
ALTER TABLE users ADD COLUMN organization varchar(80); [42121-199]
at org.h2.message.DbException.getJdbcSQLException(DbException.java:451) ~[h2-1.4.199.jar:1.4. 199]
at org.h2.message.DbException.getJdbcSQLException(DbException.java:427) ~[h2-1.4.199.jar:1.4. 199]
at org.h2.message.DbException.get(DbException.java:205) ~[h2-1.4.199.jar:1.4.199]
at org.h2.message.DbException.get(DbException.java:181) ~[h2-1.4.199.jar:1.4.199]
at org.h2.table.Table.setColumns(Table.java:447) ~[h2-1.4.199.jar:1.4.199]
at org.h2.table.TableBase.<init>(TableBase.java:75) ~[h2-1.4.199.jar:1.4.199]
at org.h2.table.RegularTable.<init>(RegularTable.java:126) ~[h2-1.4.199.jar:1.4.199]
at org.h2.table.PageStoreTable.<init>(PageStoreTable.java:58) ~[h2-1.4.199.jar:1.4.199]
at org.h2.schema.Schema.createTable(Schema.java:708) ~[h2-1.4.199.jar:1.4.199]
at org.h2.command.ddl.AlterTableAlterColumn.cloneTableStructure(AlterTableAlterColumn.java:39 9) ~[h2-1.4.199.jar:1.4.199]
at org.h2.command.ddl.AlterTableAlterColumn.copyData(AlterTableAlterColumn.java:286) ~[h2-1.4 .199.jar:1.4.199]
at org.h2.command.ddl.AlterTableAlterColumn.update(AlterTableAlterColumn.java:201) ~[h2-1.4.1 99.jar:1.4.199]
at org.h2.command.CommandContainer.update(CommandContainer.java:133) ~[h2-1.4.199.jar:1.4.199 ]
at org.h2.command.Command.executeUpdate(Command.java:267) ~[h2-1.4.199.jar:1.4.199]
at org.h2.jdbc.JdbcStatement.executeInternal(JdbcStatement.java:233) ~[h2-1.4.199.jar:1.4.199 ]
at org.h2.jdbc.JdbcStatement.execute(JdbcStatement.java:205) ~[h2-1.4.199.jar:1.4.199]
at org.springframework.jdbc.core.JdbcTemplate$1ExecuteStatementCallback.doInStatement(JdbcTem plate.java:408) ~[spring-jdbc-5.1.7.RELEASE.jar:5.1.7.RELEASE]
at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:375) ~[spring-jdbc-5. 1.7.RELEASE.jar:5.1.7.RELEASE]
at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:417) ~[spring-jdbc-5. 1.7.RELEASE.jar:5.1.7.RELEASE]
at com.serotonin.m2m2.db.H2Proxy.runScript(H2Proxy.java:281) ~[mango-3.7.1.jar:?]
at com.serotonin.m2m2.db.upgrade.DBUpgrade.runScript(DBUpgrade.java:136) ~[mango-3.7.1.jar:?]
at com.serotonin.m2m2.db.upgrade.DBUpgrade.runScript(DBUpgrade.java:160) ~[mango-3.7.1.jar:?]
at com.serotonin.m2m2.db.upgrade.Upgrade28.upgrade(Upgrade28.java:87) ~[mango-3.7.1.jar:?]
at com.serotonin.m2m2.db.upgrade.DBUpgrade.checkUpgrade(DBUpgrade.java:100) ~[mango-3.7.1.jar :?]
... 5 more
INFO 2019-11-29T12:12:05,184 (com.serotonin.m2m2.Lifecycle.terminate:400) - Mango Lifecycle terminat ing...
INFO 2019-11-29T12:12:05,247 (com.serotonin.m2m2.db.H2Proxy.terminateImpl:400) - Terminating databas e.
INFO 2019-11-29T12:12:05,512 (com.infiniteautomation.nosql.MangoNoSqlProxy.shutdown:116) - Terminati ng NoSQL Batch Write Manager.
INFO 2019-11-29T12:12:05,555 (com.serotonin.m2m2.Lifecycle.terminate:550) - Mango Lifecycle terminat ed.
ma-start: no restart flag found, not restarting MA
ma-start: MA doneHow do I get Mango running again?
-
@mseverin it looks like a failed upgrade of Mango to 3.7.1. The information about why the upgrade failed would be in the previous log file. If you have an SQL backup I suggest that you try restarting on the backup of your previous version of Mango and then retry the upgrade. If that fails again please send the log file to us for review.
-
I restored a backup from last week, and now it boots up but I have no data history. The only data that I can see is from the date of the database I restored to current.
How do I get my history back?
-
@mseverin are you using the Mango NoSQL database? Perhaps that module is not installed anymore and your point data is going into the SQL database now.
-
@mseverin Are you using MySQL? Did you happen to upgrade to 3.7.0 before you attempted the 3.7.1 upgrade? There was a bug in 3.7.0 which we fixed almost immediately which I believe causes the issue you are seeing.
If you rolled back your Mango to 3.6.x then a straight upgrade to 3.7.1 should work fine. As Terry said, check the NoSQL module is still installed.
-
I'm running with the default H2 database.
-
Have you checked if the NoSQL module is installed? Do you have any users with duplicate email addresses by any chance? Even if one is USER@example.com and another is user@example.com?
-
Yes, the NoSQL module is installed. As for users, right now Admin is the only user.
-
When I tried to restart Mango through the upgrades module I get the following error and the system won't restart.
ERROR 2019-12-04T12:58:57,204 (com.serotonin.m2m2.util.timeout.TimeoutTask.run:61) - Uncaught Task Exception
java.lang.ClassCastException: com.infiniteautomation.asciifile.rt.AsciiFilePointLocatorRT cannot be cast to com.serotonin.m2m2.internal.InternalPointLocatorRT
at com.serotonin.m2m2.internal.InternalDataSourceRT.doPoll(InternalDataSourceRT.java:110) ~[?:?]
at com.serotonin.m2m2.rt.dataSource.PollingDataSource.doPollNoSync(PollingDataSource.java:228) ~[mango-3.7.1.jar:?]
at com.serotonin.m2m2.rt.dataSource.PollingDataSource.scheduleTimeoutImpl(PollingDataSource.java:183) ~[mango-3.7.1.jar:?]
at com.serotonin.m2m2.rt.dataSource.PollingDataSource$1.scheduleTimeout(PollingDataSource.java:85) ~[mango-3.7.1.jar:?]
at com.serotonin.m2m2.util.timeout.TimeoutTask.run(TimeoutTask.java:59) ~[mango-3.7.1.jar:?]
at com.serotonin.timer.Task.runTask(Task.java:179) ~[mango-3.7.1.jar:?]
at com.serotonin.timer.TaskWrapper.run(TaskWrapper.java:23) ~[mango-3.7.1.jar:?]
at com.serotonin.timer.OrderedThreadPoolExecutor$OrderedTaskCollection.run(OrderedThreadPoolExecutor.java:314) ~[mango-3.7.1.jar:?]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) ~[?:1.8.0_172]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) ~[?:1.8.0_172]
at java.lang.Thread.run(Thread.java:748) [?:1.8.0_172] -
@mseverin did you get any further? That last log message looks like somehow you assigned the points from an Ascii File data source to an Internal Data Source. I am not aware how that could happen unless you are using the REST api and your own code, and even then this should not be possible or have executed some SQL commands on the database to move data points around?