Traccar does not start / problem with mySQL database?

Daniel Hölder2 years ago

Hi,
I already used Traccar on a Raspberry Pi4 with UBUNTU desktop for some weeks. Unfortunately, I used it with H2 database.
So, I decided to install it newly. I that context I decided to set up my RPi4 as UBUNTI server.

Installation of the UBUNTU server worked.

Then, I tried to install the Traccar server following the Digital Ocean guide: https://www.traccar.org/install-digitalocean/

There,

sudo apt update && apt -y install unzip mysql-server

failed. Error was: /var/lib/dpkg/lock-frontend cannot be opened (access denied).

Therefore, I installed mysql-server and unzip manualle (sudo apt install ...) and proceeded to follow the guide.

Everything seemed to work.

The config file shows the correct database entry for mysql:

    <entry key='database.driver'>com.mysql.jdbc.Driver</entry>
    <entry key='database.url'>jdbc:mysql://localhost/traccar?zeroDateTimeBehavior=round&serverTimezone=UTC&allo>
    <entry key='database.user'>root</entry>
    <entry key='database.password'>root</entry>

But: When I try to start Traccar (sudo systemctl start traccar or sudo service traccar start), nothing happens. No error message. No log-file is created. Nothing seems to happen.

The tracker-server.jar is available under /opt/traccar

What can I do?

Daniel Hölder2 years ago

PS: MySQL server is running:

abc@xyz:/opt/traccar$ sudo service mysql status
● mysql.service - MySQL Community Server
     Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: enabled)
     Active: active (running) since Sun 2023-09-03 20:26:47 CEST; 51min ago
    Process: 789 ExecStartPre=/usr/share/mysql/mysql-systemd-start pre (code=exited, status=0/SUCCESS)
   Main PID: 966 (mysqld)
     Status: "Server is operational"
      Tasks: 37 (limit: 9236)
     Memory: 443.4M
        CPU: 38.463s
     CGroup: /system.slice/mysql.service
             └─966 /usr/sbin/mysqld

Sep 03 20:26:44 xyz systemd[1]: Starting MySQL Community Server...
Sep 03 20:26:47 xyz systemd[1]: Started MySQL Community Server.
Anton Tananaev2 years ago

Try running Traccar manually.

Daniel Hölder2 years ago

How can I run it manually?

Track-trace2 years ago
java -jar tracker-server.jar conf/traccar.xml
Daniel Hölder2 years ago

Thanks, @Track-trace.

I did. Error message:

abc@xyz:/opt/traccar$ java -jar tracker-server.jar conf/traccar.xml
Error: Unable to initialize main class org.traccar.Main
Caused by: java.lang.NoClassDefFoundError: com/google/inject/Injector
Track-trace2 years ago

Normally you first google the error message

Daniel Hölder2 years ago
Anton Tananaev2 years ago

The error probably indicates that you're missing some dependencies. Are you sure you installed the official release without any modifications?

Daniel Hölder2 years ago

I followed the guide…

Shall I deinstall and install it newly?

Anton Tananaev2 years ago

Which guide? What architecture is your system?

Daniel Hölder2 years ago

This guide: https://www.traccar.org/install-digitalocean/

I run a Raspberry Pi 4 8 GB with Ubuntu Server latest LTS version 22.04.3

Daniel Hölder2 years ago

I reinstalled the Traccar server. Now it runs.

Thank you for your support.

Anton Tananaev2 years ago

Raspberry Pi uses ARM CPU, as far as I know. If you just follow the guide as is, it obviously won't work because it tells you to install x64 version.

Daniel Hölder2 years ago

Ah, ok. That might have been the reason.

Thanks again!