After Upgrade ERROR: Main method error - Table 'tc_orders' already exists

El Flecko2 years ago

After Upgrade from Version 4.14 the traccar Server wont start. I got an Error in the log:

2022-05-28 16:36:41 ERROR: Main method error - Table 'tc_orders' already exists - SQLSyntaxErrorException (... < DataManager:298 < *:91 < Context:298 < Main:120 < ...)
2022-05-28 16:36:53  INFO: HikariPool-1 - Starting...
2022-05-28 16:36:53  WARN: Registered driver with driverClassName=com.mysql.jdbc.Driver was not found, trying direct instantiation.
2022-05-28 16:36:54  INFO: HikariPool-1 - Added connection com.mysql.cj.jdbc.ConnectionImpl@403f0a22
2022-05-28 16:36:54  INFO: HikariPool-1 - Start completed.
2022-05-28 16:36:55  INFO: Clearing database change log checksums
2022-05-28 16:36:56  INFO: Successfully acquired change log lock
2022-05-28 16:36:56  INFO: Successfully released change log lock
2022-05-28 16:36:56  INFO: Successfully acquired change log lock
2022-05-28 16:36:56  INFO: Cannot load service: liquibase.parser.ChangeLogParser: liquibase.parser.core.json.JsonChangeLogParser Unable to get public no-arg constructor
2022-05-28 16:36:56  INFO: Cannot load service: liquibase.parser.ChangeLogParser: liquibase.parser.core.yaml.YamlChangeLogParser Unable to get public no-arg constructor
2022-05-28 16:36:59  INFO: Reading from tcdb.DATABASECHANGELOG
2022-05-28 16:36:59  INFO: Reading from tcdb.DATABASECHANGELOG
2022-05-28 16:37:00  INFO: Cannot load service: liquibase.hub.HubService: Provider liquibase.hub.core.StandardHubService could not be instantiated
2022-05-28 16:37:00  INFO: Successfully released change log lock

Initial I try to upgrade from 4.14 to 5.0
I've report the issue on GitHub, https://github.com/traccar/traccar/issues/4856, but the ticket is marked as solved.
But I got the same error on upgrade form 4.14 to 4.15

After Rollback to Traccar Version 4.14, the Server starts without any Problems
OS: Oracle Linux 8
DB: MariaDB 10.3.32

Anton Tananaev2 years ago

The problem is that you have a table that shouldn't be there. You can try removing it manually from the database.

Christoph Krey2 years ago

I ran into the same Problem upgrading from 4.8 to 5.0

It helps to manually delete the tables:

mysql traccar
drop table tc_user_order;
drop table tc_group_order;
drop table tc_device_order;
drop table tc_orders;
quit

And then try to start traccar5.0 again

Anton Tananaev2 years ago

You should only run into this problem if you don't use official releases.

El Flecko2 years ago

Thanks Christoph for your help.
after dropping the tables I'm able to upgrade my traccar server.
Best Regards

El Flecko2 years ago

@Anton: I only use Versions, I downloaded from https://www.traccar.org/download.
No Beta, no unofficial Releases.

Anton Tananaev2 years ago

Then the only other explanation is first migration failed or interrupted, in which case we're not looking at the right error in the log. You need to check first start after upgrade.