upgraded to 4.4: no MySQL connection anymore

lemon7 months ago

Hi!

I've upgraded from 4.3 to 4.4 on my Debian system (latest release), before upgrading everything worked fine. I made a copy of the config file (traccar.xml), removed the old version as described in documentation, installed the new one, copied the config file and started traccar.service.
But now I get the following in traccar-server.log:

2019-04-29 22:20:10  INFO: HikariPool-1 - Starting...
2019-04-29 22:20:10  WARN: Registered driver with driverClassName=com.mysql.jdbc.Driver was not found, trying direct instantiation.
2019-04-29 22:20:15 ERROR: HikariPool-1 - Exception during pool initialization. - Could not create connection to database server. Attempted reconnect 3 times. Giving up. - SQLNonTransientConnectionException (... < DataManager:139 < *:89 < Context:292 < Main:110 < ...)
2019-04-29 22:20:15 ERROR: Main method error - Failed to initialize pool: Could not create connection to database server. Attempted reconnect 3 times. Giving up. - PoolInitializationException (... < DataManager:139 < *:89 < Context:292 < Main:110 < ...)

How could that be? Config file didn't change, also database didn't, how can the com.mysql.jdbc.Driver not be found now?

Thanks for your help!

Andreas

Anton Tananaev7 months ago

Try to set logger.fullStackTraces to true in the config.

lemon7 months ago

Ok, did it, this is the log:

2019-04-29 22:42:16  INFO: HikariPool-1 - Starting...
2019-04-29 22:42:16  WARN: Registered driver with driverClassName=com.mysql.jdbc.Driver was not found, trying direct instantiation.
2019-04-29 22:42:20 ERROR: HikariPool-1 - Exception during pool initialization. -
java.sql.SQLNonTransientConnectionException: Could not create connection to database server. Attempted reconnect 3 times. Giving up.
        at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:110)
        at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:97)
        at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:89)
        at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:63)
        at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:73)
        at com.mysql.cj.jdbc.ConnectionImpl.connectWithRetries(ConnectionImpl.java:905)
        at com.mysql.cj.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:830)
        at com.mysql.cj.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:455)
        at com.mysql.cj.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:240)
        at com.mysql.cj.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:199)
        at com.zaxxer.hikari.util.DriverDataSource.getConnection(DriverDataSource.java:138)
        at com.zaxxer.hikari.pool.PoolBase.newConnection(PoolBase.java:353)
        at com.zaxxer.hikari.pool.PoolBase.newPoolEntry(PoolBase.java:201)
        at com.zaxxer.hikari.pool.HikariPool.createPoolEntry(HikariPool.java:473)
        at com.zaxxer.hikari.pool.HikariPool.checkFailFast(HikariPool.java:562)
        at com.zaxxer.hikari.pool.HikariPool.<init>(HikariPool.java:115)
        at com.zaxxer.hikari.HikariDataSource.<init>(HikariDataSource.java:81)
        at org.traccar.database.DataManager.initDatabase(DataManager.java:139)
        at org.traccar.database.DataManager.<init>(DataManager.java:89)
        at org.traccar.Context.init(Context.java:292)
        at org.traccar.Main.run(Main.java:110)
        at org.traccar.Main.main(Main.java:104)
Caused by: com.mysql.cj.exceptions.InvalidConnectionAttributeException: The server time zone value 'CEST' is unrecognized or represents more than one time zone. You must configure either the server or JDBC driver (via the serverTimezone configuration property) to use a more specifc time zone value if you want to utilize time zone support.
        at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
        at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
        at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:490)
        at com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:61)
        at com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:85)
        at com.mysql.cj.util.TimeUtil.getCanonicalTimezone(TimeUtil.java:132)
        at com.mysql.cj.protocol.a.NativeProtocol.configureTimezone(NativeProtocol.java:2241)
        at com.mysql.cj.protocol.a.NativeProtocol.initServerSession(NativeProtocol.java:2265)
        at com.mysql.cj.jdbc.ConnectionImpl.initializePropsFromServer(ConnectionImpl.java:1319)
        at com.mysql.cj.jdbc.ConnectionImpl.connectWithRetries(ConnectionImpl.java:868)
        ... 16 more

2019-04-29 22:42:20 ERROR: Main method error -
com.zaxxer.hikari.pool.HikariPool$PoolInitializationException: Failed to initialize pool: Could not create connection to database server. Attempted reconnect 3 times. Giving up.
        at com.zaxxer.hikari.pool.HikariPool.throwPoolInitializationException(HikariPool.java:597)
        at com.zaxxer.hikari.pool.HikariPool.checkFailFast(HikariPool.java:576)
        at com.zaxxer.hikari.pool.HikariPool.<init>(HikariPool.java:115)
        at com.zaxxer.hikari.HikariDataSource.<init>(HikariDataSource.java:81)
        at org.traccar.database.DataManager.initDatabase(DataManager.java:139)
        at org.traccar.database.DataManager.<init>(DataManager.java:89)
        at org.traccar.Context.init(Context.java:292)
        at org.traccar.Main.run(Main.java:110)
        at org.traccar.Main.main(Main.java:104)
Caused by: java.sql.SQLNonTransientConnectionException: Could not create connection to database server. Attempted reconnect 3 times. Giving up.
        at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:110)
        at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:97)
        at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:89)
        at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:63)
        at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:73)
        at com.mysql.cj.jdbc.ConnectionImpl.connectWithRetries(ConnectionImpl.java:905)
        at com.mysql.cj.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:830)
        at com.mysql.cj.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:455)
        at com.mysql.cj.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:240)
        at com.mysql.cj.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:199)
        at com.zaxxer.hikari.util.DriverDataSource.getConnection(DriverDataSource.java:138)
        at com.zaxxer.hikari.pool.PoolBase.newConnection(PoolBase.java:353)
        at com.zaxxer.hikari.pool.PoolBase.newPoolEntry(PoolBase.java:201)
        at com.zaxxer.hikari.pool.HikariPool.createPoolEntry(HikariPool.java:473)
        at com.zaxxer.hikari.pool.HikariPool.checkFailFast(HikariPool.java:562)
        ... 7 more
Caused by: com.mysql.cj.exceptions.InvalidConnectionAttributeException: The server time zone value 'CEST' is unrecognized or represents more than one time zone. You must configure either the server or JDBC driver (via the serverTimezone configuration property) to use a more specifc time zone value if you want to utilize time zone support.
        at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
        at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
        at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:490)
        at com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:61)
        at com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:85)
        at com.mysql.cj.util.TimeUtil.getCanonicalTimezone(TimeUtil.java:132)
        at com.mysql.cj.protocol.a.NativeProtocol.configureTimezone(NativeProtocol.java:2241)
        at com.mysql.cj.protocol.a.NativeProtocol.initServerSession(NativeProtocol.java:2265)
        at com.mysql.cj.jdbc.ConnectionImpl.initializePropsFromServer(ConnectionImpl.java:1319)
        at com.mysql.cj.jdbc.ConnectionImpl.connectWithRetries(ConnectionImpl.java:868)
        ... 16 more
lemon7 months ago

Ok, I added

&serverTimezone=UTC

to the config file, now it's working.

Thank you very much, Anton!!!

Anton Tananaev7 months ago

Updated documentation:

https://www.traccar.org/mysql/

Jose A Perez7 months ago

Hi:

In adition to that, I also have upgraded

<entry key='database.driver'>com.mysql.jdbc.Driver</entry>

to

<entry key='database.driver'>com.mysql.cj.jdbc.Driver</entry>

to avoid driver deprecation message.

Castillo6 months ago

Thanks you very much every one!

I solved the problem while upgraded v4.2 to 4.5 adding the "timezone" tag and modifing the name of database driver to avoid driver deprecation message.