traccar do not start in server migration

Jose B3 years ago

Hello Anton,
I had to migrate my platform traccar (and mysql database) to another server.
I couldn't start traccar 4.13, due to a "set changelog-4.13" error. could you help me please?

JB

21-06-28 10:30:07  INFO: HikariPool-1 - Starting...
2021-06-28 10:30:10  INFO: HikariPool-1 - Start completed.
2021-06-28 10:30:11  INFO: Clearing database change log checksums
2021-06-28 10:30:13  INFO: Successfully acquired change log lock
2021-06-28 10:30:13  INFO: Successfully released change log lock
2021-06-28 10:30:13  INFO: Successfully acquired change log lock
2021-06-28 10:30:13  INFO: Cannot load service: liquibase.parser.ChangeLogParser: liquibase.parser.core.json.JsonChangeLogParser Unable to get public no-arg constructor
2021-06-28 10:30:13  INFO: Cannot load service: liquibase.parser.ChangeLogParser: liquibase.parser.core.yaml.YamlChangeLogParser Unable to get public no-arg constructor
2021-06-28 10:30:17  INFO: Reading from traccaroficial.DATABASECHANGELOG
2021-06-28 10:30:19  INFO: Reading from traccaroficial.DATABASECHANGELOG
2021-06-28 10:30:19  INFO: Cannot load service: liquibase.hub.HubService: Provider liquibase.hub.core.StandardHubService could not be instantiated
2021-06-28 10:30:19  INFO: Columns announcement(VARCHAR(4000)) added to tc_servers
2021-06-28 10:30:19  INFO: ChangeSet changelog-4.11::changelog-4.11::author ran successfully in 86ms
2021-06-28 10:30:19  INFO: Successfully released change log lock
2021-06-28 10:30:19 ERROR: Main method error - 
liquibase.exception.LiquibaseException: liquibase.exception.MigrationFailedException: Migration failed for change set changelog-4.13::changelog-4.13::author:
     Reason: liquibase.exception.DatabaseException: Unknown column 'servertime' in 'tc_events' [Failed SQL: (1054) ALTER TABLE traccaroficial.tc_events CHANGE servertime eventtime timestamp]
    at liquibase.changelog.ChangeLogIterator.run(ChangeLogIterator.java:124)
    at liquibase.Liquibase.lambda$null$0(Liquibase.java:272)
    at liquibase.Scope.lambda$child$0(Scope.java:160)
    at liquibase.Scope.child(Scope.java:169)
    at liquibase.Scope.child(Scope.java:159)
    at liquibase.Scope.child(Scope.java:138)
    at liquibase.Scope.child(Scope.java:222)
    at liquibase.Liquibase.lambda$update$1(Liquibase.java:271)
    at liquibase.Scope.lambda$child$0(Scope.java:160)
    at liquibase.Scope.child(Scope.java:169)
    at liquibase.Scope.child(Scope.java:159)
    at liquibase.Scope.child(Scope.java:138)
    at liquibase.Liquibase.runInScope(Liquibase.java:2369)
    at liquibase.Liquibase.update(Liquibase.java:217)
    at liquibase.Liquibase.update(Liquibase.java:203)
    at liquibase.Liquibase.update(Liquibase.java:199)
    at org.traccar.database.DataManager.initDatabaseSchema(DataManager.java:293)
    at org.traccar.database.DataManager.<init>(DataManager.java:86)
    at org.traccar.Context.init(Context.java:290)
    at org.traccar.Main.run(Main.java:120)
    at org.traccar.Main$1.run(Main.java:90)
    at org.traccar.WindowsService$ServiceMain.callback(WindowsService.java:184)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:566)
    at com.sun.jna.CallbackReference$DefaultCallbackProxy.invokeCallback(CallbackReference.java:579)
    at com.sun.jna.CallbackReference$DefaultCallbackProxy.callback(CallbackReference.java:610)
Caused by: liquibase.exception.MigrationFailedException: Migration failed for change set changelog-4.13::changelog-4.13::author:
     Reason: liquibase.exception.DatabaseException: Unknown column 'servertime' in 'tc_events' [Failed SQL: (1054) ALTER TABLE traccaroficial.tc_events CHANGE servertime eventtime timestamp]
    at liquibase.changelog.ChangeSet.execute(ChangeSet.java:672)
    at liquibase.changelog.visitor.UpdateVisitor.visit(UpdateVisitor.java:49)
    at liquibase.changelog.ChangeLogIterator$2.lambda$null$0(ChangeLogIterator.java:111)
    at liquibase.Scope.lambda$child$0(Scope.java:160)
    at liquibase.Scope.child(Scope.java:169)
    at liquibase.Scope.child(Scope.java:159)
    at liquibase.Scope.child(Scope.java:138)
    at liquibase.changelog.ChangeLogIterator$2.lambda$run$1(ChangeLogIterator.java:110)
    at liquibase.Scope.lambda$child$0(Scope.java:160)
    at liquibase.Scope.child(Scope.java:169)
    at liquibase.Scope.child(Scope.java:159)
    at liquibase.Scope.child(Scope.java:138)
    at liquibase.Scope.child(Scope.java:222)
    at liquibase.changelog.ChangeLogIterator$2.run(ChangeLogIterator.java:94)
    at liquibase.Scope.lambda$child$0(Scope.java:160)
    at liquibase.Scope.child(Scope.java:169)
    at liquibase.Scope.child(Scope.java:159)
    at liquibase.Scope.child(Scope.java:138)
    at liquibase.Scope.child(Scope.java:222)
    at liquibase.Scope.child(Scope.java:226)
    at liquibase.changelog.ChangeLogIterator.run(ChangeLogIterator.java:66)
    ... 27 more
Caused by: liquibase.exception.DatabaseException: Unknown column 'servertime' in 'tc_events' [Failed SQL: (1054) ALTER TABLE traccaroficial.tc_events CHANGE servertime eventtime timestamp]
    at liquibase.executor.jvm.JdbcExecutor$ExecuteStatementCallback.doInStatement(JdbcExecutor.java:393)
    at liquibase.executor.jvm.JdbcExecutor.execute(JdbcExecutor.java:82)
    at liquibase.executor.jvm.JdbcExecutor.execute(JdbcExecutor.java:150)
    at liquibase.database.AbstractJdbcDatabase.execute(AbstractJdbcDatabase.java:1278)
    at liquibase.database.AbstractJdbcDatabase.executeStatements(AbstractJdbcDatabase.java:1260)
    at liquibase.changelog.ChangeSet.execute(ChangeSet.java:637)
    ... 47 more
Caused by: java.sql.SQLSyntaxErrorException: Unknown column 'servertime' in 'tc_events'
    at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:120)
    at com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:122)
    at com.mysql.cj.jdbc.StatementImpl.executeInternal(StatementImpl.java:762)
    at com.mysql.cj.jdbc.StatementImpl.execute(StatementImpl.java:646)
    at liquibase.executor.jvm.JdbcExecutor$ExecuteStatementCallback.doInStatement(JdbcExecutor.java:389)
    ... 52 more

2021-06-28 10:30:19  WARN: JNA: Callback org.traccar.WindowsService$ServiceMain@1e13529a threw the following exception - 
java.lang.RuntimeException: liquibase.exception.LiquibaseException: liquibase.exception.MigrationFailedException: Migration failed for change set changelog-4.13::changelog-4.13::author:
     Reason: liquibase.exception.DatabaseException: Unknown column 'servertime' in 'tc_events' [Failed SQL: (1054) ALTER TABLE traccaroficial.tc_events CHANGE servertime eventtime timestamp]
    at org.traccar.Main.run(Main.java:147)
    at org.traccar.Main$1.run(Main.java:90)
    at org.traccar.WindowsService$ServiceMain.callback(WindowsService.java:184)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:566)
    at com.sun.jna.CallbackReference$DefaultCallbackProxy.invokeCallback(CallbackReference.java:579)
    at com.sun.jna.CallbackReference$DefaultCallbackProxy.callback(CallbackReference.java:610)
Caused by: liquibase.exception.LiquibaseException: liquibase.exception.MigrationFailedException: Migration failed for change set changelog-4.13::changelog-4.13::author:
     Reason: liquibase.exception.DatabaseException: Unknown column 'servertime' in 'tc_events' [Failed SQL: (1054) ALTER TABLE traccaroficial.tc_events CHANGE servertime eventtime timestamp]
    at liquibase.changelog.ChangeLogIterator.run(ChangeLogIterator.java:124)
    at liquibase.Liquibase.lambda$null$0(Liquibase.java:272)
    at liquibase.Scope.lambda$child$0(Scope.java:160)
    at liquibase.Scope.child(Scope.java:169)
    at liquibase.Scope.child(Scope.java:159)
    at liquibase.Scope.child(Scope.java:138)
    at liquibase.Scope.child(Scope.java:222)
    at liquibase.Liquibase.lambda$update$1(Liquibase.java:271)
    at liquibase.Scope.lambda$child$0(Scope.java:160)
    at liquibase.Scope.child(Scope.java:169)
    at liquibase.Scope.child(Scope.java:159)
    at liquibase.Scope.child(Scope.java:138)
    at liquibase.Liquibase.runInScope(Liquibase.java:2369)
    at liquibase.Liquibase.update(Liquibase.java:217)
    at liquibase.Liquibase.update(Liquibase.java:203)
    at liquibase.Liquibase.update(Liquibase.java:199)
    at org.traccar.database.DataManager.initDatabaseSchema(DataManager.java:293)
    at org.traccar.database.DataManager.<init>(DataManager.java:86)
    at org.traccar.Context.init(Context.java:290)
    at org.traccar.Main.run(Main.java:120)
    ... 8 more
Caused by: liquibase.exception.MigrationFailedException: Migration failed for change set changelog-4.13::changelog-4.13::author:
     Reason: liquibase.exception.DatabaseException: Unknown column 'servertime' in 'tc_events' [Failed SQL: (1054) ALTER TABLE traccaroficial.tc_events CHANGE servertime eventtime timestamp]
    at liquibase.changelog.ChangeSet.execute(ChangeSet.java:672)
    at liquibase.changelog.visitor.UpdateVisitor.visit(UpdateVisitor.java:49)
    at liquibase.changelog.ChangeLogIterator$2.lambda$null$0(ChangeLogIterator.java:111)
    at liquibase.Scope.lambda$child$0(Scope.java:160)
    at liquibase.Scope.child(Scope.java:169)
    at liquibase.Scope.child(Scope.java:159)
    at liquibase.Scope.child(Scope.java:138)
    at liquibase.changelog.ChangeLogIterator$2.lambda$run$1(ChangeLogIterator.java:110)
    at liquibase.Scope.lambda$child$0(Scope.java:160)
    at liquibase.Scope.child(Scope.java:169)
    at liquibase.Scope.child(Scope.java:159)
    at liquibase.Scope.child(Scope.java:138)
    at liquibase.Scope.child(Scope.java:222)
    at liquibase.changelog.ChangeLogIterator$2.run(ChangeLogIterator.java:94)
    at liquibase.Scope.lambda$child$0(Scope.java:160)
    at liquibase.Scope.child(Scope.java:169)
    at liquibase.Scope.child(Scope.java:159)
    at liquibase.Scope.child(Scope.java:138)
    at liquibase.Scope.child(Scope.java:222)
    at liquibase.Scope.child(Scope.java:226)
    at liquibase.changelog.ChangeLogIterator.run(ChangeLogIterator.java:66)
    ... 27 more
Caused by: liquibase.exception.DatabaseException: Unknown column 'servertime' in 'tc_events' [Failed SQL: (1054) ALTER TABLE traccaroficial.tc_events CHANGE servertime eventtime timestamp]
    at liquibase.executor.jvm.JdbcExecutor$ExecuteStatementCallback.doInStatement(JdbcExecutor.java:393)
    at liquibase.executor.jvm.JdbcExecutor.execute(JdbcExecutor.java:82)
    at liquibase.executor.jvm.JdbcExecutor.execute(JdbcExecutor.java:150)
    at liquibase.database.AbstractJdbcDatabase.execute(AbstractJdbcDatabase.java:1278)
    at liquibase.database.AbstractJdbcDatabase.executeStatements(AbstractJdbcDatabase.java:1260)
    at liquibase.changelog.ChangeSet.execute(ChangeSet.java:637)
    ... 47 more
Caused by: java.sql.SQLSyntaxErrorException: Unknown column 'servertime' in 'tc_events'
    at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:120)
    at com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:122)
    at com.mysql.cj.jdbc.StatementImpl.executeInternal(StatementImpl.java:762)
    at com.mysql.cj.jdbc.StatementImpl.execute(StatementImpl.java:646)
    at liquibase.executor.jvm.JdbcExecutor$ExecuteStatementCallback.doInStatement(JdbcExecutor.java:389)
    ... 52 more
Jose B3 years ago

if I edit the changelog-4.13.xml schema to remove the command, works.

  <changeSet author="author" id="changelog-4.13">

    < ! ---<renameColumn tableName="tc_events" columnDataType="TIMESTAMP" oldColumnName="servertime" newColumnName="eventtime" /> -->

  </changeSet>
Anton Tananaev3 years ago

The error indicates that you have some issues with your database schema.

Jose B3 years ago

thank you for return.
I noticed that these database schema create/change automaticly some tables and collumns in my mysql database.
I notice too that was create duplicate tables:
"databasechangelog" : last register => changelog-4.10
" DATABASECHANGELOG": last register => changelog-4.13
"databasechangeloglock": last register =>0
and "DATABASECHANGELOGLOCK": last register => 0

I think in your traccar code there are difference in linux X windows, because I migrated from windows to linux ubuntu.

Anton Tananaev3 years ago

Could be a difference in MySQL. It shouldn't really recognize those as different tables.

Jose B3 years ago

After traccar works, I uncommented the code and restarted the traccar service.
traccar works without any problems, and it register a changelog-4.13 with description value = "empty" on DATABASECHANGELOG.