Traccar MariaDB

Jérôme3 years ago

Hello I can not get it to work via MySQL database, here is my conf :

<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE properties SYSTEM 'http://java.sun.com/dtd/properties.dtd'>
<properties>
    <entry key='config.default'>./conf/default.xml</entry>
    <!--
    This is the main configuration file. All your configuration parameters should be placed in this file.
    Default configuration parameters are located in the "default.xml" file. You should not modify it to avoid issues
    with upgrading to a new version. Parameters in the main config file override values in the default file. Do not
    remove "config.default" parameter from this file unless you know what you are doing.

    For list of available parameters see following page: https://www.traccar.org/configuration-file/
    -->
    <entry key='database.driver'>com.mysql.cj.jdbc.Driver</entry>
    <entry key='database.url'>jdbc:mysql://localhost:3306/traccar?serverTimezone=UTC&amp;useSSL=false&amp;allowMultiQueries=true&amp;autoReconnect=true&amp;useUnicode=yes&amp;characterEncoding=UTF-8&amp;sessionVariables=sql_mode=''</entry>
    <entry key='database.user'>traccar</entry>
    <entry key='database.password'>PASSWORD</entry>

</properties>

Here is the error I got :

root@Onehebergeur:/volume1/@docker/aufs/diff/76992d1d612671a7263e79cf05c1ac6ae2006e033ff1616541c5517998f5555b/opt/traccar/logs# vi tracker-server.log

2022-04-12 12:01:01  INFO: Marking ChangeSet: changelog-4.0::changelog-4.0-common::author ran despite precondition failure due to onFail='MARK_RAN':
          ./schema/changelog-master.xml : Not precondition failed

2022-04-12 12:01:01  INFO: Marking ChangeSet: changelog-4.0::changelog-4.0-pg::author ran despite precondition failure due to onFail='MARK_RAN':
          ./schema/changelog-master.xml : Not precondition failed

2022-04-12 12:01:01  INFO: Marking ChangeSet: changelog-4.0::changelog-4.0::author ran despite precondition failure due to onFail='MARK_RAN':
          ./schema/changelog-master.xml : Not precondition failed

2022-04-12 12:01:01  INFO: Marking ChangeSet: changelog-4.0::changelog-4.0-renaming::author ran despite precondition failure due to onFail='MARK_RAN':
          ./schema/changelog-master.xml : Not precondition failed

2022-04-12 12:01:01  INFO: Marking ChangeSet: changelog-4.1::changelog-4.1-mssql::author ran despite precondition failure due to onFail='MARK_RAN':
          ./schema/changelog-master.xml : DBMS Precondition failed: expected mssql, got h2

2022-04-12 12:01:01  INFO: Index user_device_user_id created
2022-04-12 12:01:01  INFO: Index position_deviceid_fixtime created
2022-04-12 12:01:01  INFO: ChangeSet changelog-4.7::changelog-4.7::author ran successfully in 160ms
2022-04-12 12:01:01  INFO: Index event_deviceid_servertime created
2022-04-12 12:01:01  INFO: ChangeSet changelog-4.9::changelog-4.9::author ran successfully in 8ms
2022-04-12 12:01:01  INFO: Columns protocols(VARCHAR(4096)) added to tc_statistics
2022-04-12 12:01:01  INFO: ChangeSet changelog-4.10::changelog-4.10::author ran successfully in 74ms
2022-04-12 12:01:01  INFO: Columns announcement(VARCHAR(4000)) added to tc_servers
2022-04-12 12:01:01  INFO: ChangeSet changelog-4.11::changelog-4.11::author ran successfully in 42ms
2022-04-12 12:01:01  INFO: Column tc_events.servertime renamed to eventtime
2022-04-12 12:01:01  INFO: ChangeSet changelog-4.13::changelog-4.13::author ran successfully in 18ms
2022-04-12 12:01:01  INFO: Table tc_orders created
2022-04-12 12:01:01  INFO: Table tc_user_order created
2022-04-12 12:01:01  INFO: Foreign key constraint added to tc_user_order (userid)
2022-04-12 12:01:01  INFO: Foreign key constraint added to tc_user_order (orderid)
2022-04-12 12:01:01  INFO: Table tc_group_order created
2022-04-12 12:01:01  INFO: Foreign key constraint added to tc_group_order (groupid)
2022-04-12 12:01:01  INFO: Foreign key constraint added to tc_group_order (orderid)
2022-04-12 12:01:01  INFO: Table tc_device_order created
2022-04-12 12:01:01  INFO: Foreign key constraint added to tc_device_order (deviceid)
2022-04-12 12:01:01  INFO: Foreign key constraint added to tc_device_order (orderid)
2022-04-12 12:01:01  INFO: ChangeSet changelog-4.15::changelog-4.15::author ran successfully in 170ms
2022-04-12 12:01:01  INFO: Successfully released change log lock
2022-04-12 12:01:04  INFO: Operating system name: Linux version: 4.4.180+ architecture: amd64
2022-04-12 12:01:04  INFO: Java runtime name: OpenJDK 64-Bit Server VM vendor: Alpine version: 11.0.13+8-alpine-r0
2022-04-12 12:01:04  INFO: Memory limit heap: 494mb non-heap: 0mb
2022-04-12 12:01:04  INFO: Character encoding: UTF-8 charset: UTF-8
2022-04-12 12:01:04  INFO: Version: 4.15
2022-04-12 12:01:04  INFO: Starting server...
2022-04-12 12:01:05  INFO: jetty-10.0.7; built: 2021-10-06T19:34:02.766Z; git: da8a4553af9dd84080931fa0f8c678cd2d60f3d9; jvm 11.0.13+8-alpine-r0
2022-04-12 12:01:06  INFO: Started o.t.w.@156324b{/,null,AVAILABLE}
2022-04-12 12:01:06  INFO: Session workerName=node0
2022-04-12 12:01:07  WARN: JAXBContext implementation could not be found. WADL feature is disabled.
2022-04-12 12:01:09  INFO: Started o.e.j.s.ServletContextHandler@57ed02e6{/,null,AVAILABLE}
2022-04-12 12:01:09  INFO: Started ServerConnector@6af91cc8{HTTP/1.1, (http/1.1)}{0.0.0.0:8082}
2022-04-12 12:01:09  INFO: Started Server@374b6e33{STARTING}[10.0.7,sto=0] @22180ms
2022-04-12 12:01:09  WARN: No systemd support - Unable to load library 'systemd':
Error loading shared library libsystemd.so: No such file or directory
Error loading shared library libsystemd.so: No such file or directory
Native library (linux-x86-64/libsystemd.so) not found in resource path (tracker-server.jar) - UnsatisfiedLinkError (... < HealthCheckService:40 < Main:111 < *:132 < *:106)
2022-04-12 12:04:10  INFO: HikariPool-1 - Starting...
2022-04-12 12:04:16 ERROR: HikariPool-1 - Exception during pool initialization. - Connection refused (Connection refused) - ConnectException (... < DataManager:131 < *:90 < Context:298 < Main:120 < ...)
2022-04-12 12:04:16 ERROR: Main method error - Connection refused (Connection refused) - ConnectException (... < DataManager:131 < *:90 < Context:298 < Main:120 < ...)
2022-04-12 12:11:13  INFO: HikariPool-1 - Starting...
2022-04-12 12:11:19 ERROR: HikariPool-1 - Exception during pool initialization. - Connection refused (Connection refused) - ConnectException (... < DataManager:131 < *:90 < Context:298 < Main:120 < ...)
2022-04-12 12:11:19 ERROR: Main method error - Connection refused (Connection refused) - ConnectException (... < DataManager:131 < *:90 < Context:298 < Main:120 < ...)

Possible to have your help?

Anton Tananaev3 years ago

Looks like database connection issue.

Jérôme3 years ago

Yet everything is OK via PHPmyAdmin :(

Jérôme3 years ago

I'm on a synology NAS via docker, everything is OK in h2 but I would like to switch to SQL...

Anton Tananaev3 years ago

H2 is also an SQL database.

Jérôme3 years ago

Yes, but it seems to me that you do not recommend it for a server in production?

Anton Tananaev3 years ago

Correct, I'm just pointing out that your previous statement doesn't make much sense.

Jérôme3 years ago

Ok so you have no idea for my connection problem on MariaDB?

Anton Tananaev3 years ago

No, you need to check your database for more information.

Jérôme3 years ago

Ok I was looking all day today, my database works with the codes and I did not find :( In any case thank you for the magnificent work of this base. So I will stay in Docker and in H2 base for the production.

Andrew Cumming3 years ago

I suspect your error is using localhost. I'm guessing you have 2 containers. 1 with mysql and the other with traccar (I have this arrangement working).

Each container has it's own localhost so you cant connect to the other using localhost. I exposed the mysql port 3306 to the host machine then in the traccar.xml used the host IP and not localhost. All worked after that.

Jérôme3 years ago

I only have one container.

The MariaDB database is on the synology server and this same server hosts the Traccar docker

Anton Tananaev3 years ago

What network mode are you running docker container in? Because localhost in docker container doesn't necessarily point to your hosting machine.

Jérôme3 years ago

Bridge 172.16.0.0/16
My serveur : 192.168.1.100

Anton Tananaev3 years ago

Which means you can't connect to the host using localhost. So the configuration is incorrect.