Error starting server v4.5 after a new build

roneskinder5 years ago

I have a working setup installed for version 4.5, i am adding a field in table tc_positions, followed the instructions related to adding a new field, compiled and tested locally and works fine, build a new tracker-server.jar file using "mvn package" and copied that file to /opt/traccar/ kept a copy of old "tracker-server.jar.old"

When i try to start the server via "sudo service traccar start" i get this error using "sudo service traccar status":

    autosma4@server.auto-smart.net [traccar]# sudo service traccar status
    Redirecting to /bin/systemctl status traccar.service
    ● traccar.service - traccar
       Loaded: loaded (/etc/systemd/system/traccar.service; enabled; vendor preset: disabled)
       Active: failed (Result: exit-code) since Sat 2019-06-15 12:12:51 MDT; 51s ago
      Process: 32230 ExecStart=/opt/traccar/jre/bin/java -jar tracker-server.jar conf/traccar.xml (code=exited, status=1/FAILURE)
     Main PID: 32230 (code=exited, status=1/FAILURE)

    Jun 15 12:12:51 server.auto-smart.net traccar[32230]: Exception in thread "main" java.lang.NoClassDefFoundError: org/slf4j/LoggerFactory
    Jun 15 12:12:51 server.auto-smart.net traccar[32230]: at org.traccar.Main.<clinit>(Main.java:35)
    Jun 15 12:12:51 server.auto-smart.net traccar[32230]: Caused by: java.lang.ClassNotFoundException: org.slf4j.LoggerFactory
    Jun 15 12:12:51 server.auto-smart.net traccar[32230]: at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:583)
    Jun 15 12:12:51 server.auto-smart.net traccar[32230]: at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
    Jun 15 12:12:51 server.auto-smart.net traccar[32230]: at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
    Jun 15 12:12:51 server.auto-smart.net traccar[32230]: ... 1 more
    Jun 15 12:12:51 server.auto-smart.net systemd[1]: traccar.service: main process exited, code=exited, status=1/FAILURE
    Jun 15 12:12:51 server.auto-smart.net systemd[1]: Unit traccar.service entered failed state.
    Jun 15 12:12:51 server.auto-smart.net systemd[1]: traccar.service failed.

Any ideas what might be wrong or missing?

Anton Tananaev5 years ago

Try compiling with gradle.

roneskinder5 years ago

Thanks Anton, that worked like a charm!

Parth5 years ago

Hello @Anton @roneskinder,

I am having same issue with traccar-4.5. I have compiled with netbeans and getting same error as mentioned above.

Can you give me the instruction for how to compile with gradle?

Thanks in advance.

roneskinder5 years ago

Hi @Parth i did the following

  1. Check this guide to install gradle and compile via console
    Gradle

  2. Make a copy of your original .jar file
    mv /opt/traccar/tracker-server.jar /opt/traccar/tracker-server.jar.15.06.19

  3. Upload from your project folder to your VPS
    scp target/tracker-server.jar root@yourhostip:/opt/traccar/