Skip to content
Sevket Gökay edited this page Aug 15, 2021 · 16 revisions

How to fix the exception "MySQL and Java are not using the same time zone"

SteVe uses UTC as the time zone. This is the OCPP recommendation. We also want MySQL to use UTC in order to prevent various translation issues. The time zone of the running MySQL instance can be changed by running the following statement:

SET GLOBAL time_zone = '+00:00';

However, if MySQL restarts, the config will revert to the default. For the permanent effect, you should add the following line to the config file of MySQL:

default-time-zone='+00:00'

Keep in mind that the config change will affect all databases!

How can I upgrade from 1.x.x to 2.x.x?

The major release 2.0.0 is backwards incompatible with existing installations, since the migration scripts are manually altered (See commit) and the checksums in the metadata table of Flyway (our DB migration tool) need to be corrected. This can be done executing the following command:

mvn initialize flyway:repair

How can i run SteVe behind a reverse proxy?

You can easily run SteVe behind a reverse proxy by forwarding /steve/ to the respective host. The following configuration would work for NGINX:

location /steve/ {
    proxy_pass http://192.168.1.100:8080/steve/;
}

Keep in mind that OCPP-J using WebSockets might require additional configuration or depending on your proxy software, wont work at all. For NGINX the configuration could look like this:

location /steve/websocket/CentralSystemService {
    proxy_pass http://192.168.1.100:8080/steve/websocket/CentralSystemService;
    proxy_http_version 1.1;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection "upgrade";
    proxy_connect_timeout 1d;
    proxy_send_timeout 1d;
    proxy_read_timeout 1d;
}

How can i backup / transfer the SteVe Database

To backup the SteVe database you can use the standard MySQL tools, like e.g. mysqldump. Just keep in mind that SteVe uses stored procedures which are, by default, not dumped by mysqldump. For that you can use the following command:

# mysqldump --opt --routines -usteve -p stevedb >steve-dump.sql

This will dump the complete SteVe database into the file steve-dump.sql. To restore it on a different machine, create the steve user and database as covered in the installation manual and restore the dump using:

# mysql -usteve -p stevedb <steve-dump.sql

Missing stored procedures will result in Jooq not generating the jooq.steve.db.routines package which results in a maven build error.

Database Migration fails on MariaDB due to missing SUPER privilege

If you encounter the following error:

[INFO] --- flyway-maven-plugin:5.2.4:migrate (default) @ steve ---
[INFO] Flyway Community Edition 5.2.4 by Boxfuse
[INFO] Database: jdbc:mysql://localhost:3306/stevedb (MySQL 5.5)
[INFO] Successfully validated 31 migrations (execution time 00:00.219s)
[INFO] Creating Schema History table: `stevedb`.`schema_version`
[INFO] Current version of schema `stevedb`: << Empty Schema >>
[WARNING] outOfOrder mode is active. Migration of schema `stevedb` may not be reproducible.
[INFO] Migrating schema `stevedb` to version 0.6.6 - inital
[WARNING] DB: You do not have the SUPER privilege and binary logging is enabled (you *might* want to use the less safe log_bin_trust_function_creators variable) (SQL State: HY000 - Error Code: 1419)
[ERROR] Migration of schema `stevedb` to version 0.6.6 - inital failed! Please restore backups and roll back database and code!
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 5.053 s
[INFO] Finished at: 2019-07-11T16:44:22+02:00
[INFO] Final Memory: 22M/58M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.flywaydb:flyway-maven-plugin:5.2.4:migrate (default) on project steve: org.flywaydb.core.internal.command.DbMigrate$FlywayMigrateException: 
[ERROR] Migration V0_6_6__inital.sql failed
[ERROR] -----------------------------------
[ERROR] SQL State  : HY000
[ERROR] Error Code : 1419
[ERROR] Message    : You do not have the SUPER privilege and binary logging is enabled (you *might* want to use the less safe log_bin_trust_function_creators variable)
[ERROR] Location   : /usr/local/src/steve-steve-3.3.0/src/main/resources/db/migration/V0_6_6__inital.sql (/usr/local/src/steve-steve-3.3.0/src/main/resources/db/migration/V0_6_6__inital.sql)
[ERROR] Line       : 111
[ERROR] Statement  : CREATE TRIGGER `transaction_AINS` AFTER INSERT ON transaction FOR EACH ROW
[ERROR]   UPDATE user SET user.inTransaction=1 WHERE user.idTag=NEW.idTag

You can either

  • disable the binary log by removing log-bin from my.cnf (suggested if you don't need replication) OR
  • grant the super privilege to the steve user by: GRANT SUPER ON *.* TO 'steve'@'localhost' IDENTIFIED BY 'changeme';

To fix the broken database state after the failed migration it's easiest to drop the database and create it again.