Cant connect to MYSQL after update to 4.2

Dr Panos 7 years ago

I am using MYSQL database in a Centos 7 server. I made the upgrade to 4.2 and I can't start traccar service anymore. I think I did everything correct. I made backup of MYSQL, traccar.xml removed the old version (4.1) and after installation I restored traccar.xml and MYSQL but nothing. I tried almost everything. New MYSQL user, new password, re-installation e.t.c Also the log files stoped recording at the time I changed the database from H2 to MYSQL. Any ideas?

Spookje 7 years ago

What does tracker-server.log tell you?
What have you configured in traccar.xml (the "<entry key='database." parts)?

Dr Panos 7 years ago

the configuration is like this

<entry key='database.driver'>com.mysql.jdbc.Driver</entry>
<entry key='database.url'>jdbc:mysql://localhost:3306/mytraccardb?useSSL=false&amp;allowMultiQueries=true&amp;autoReconnect=true&amp;useUnicode=yes&amp;characterEncoding=UTF-8&amp;sessionVariables=sql_mode=''</entry>
<entry key='database.user'>admin2</entry>
<entry key='database.password'>****************</entry>

and this is the log file stoped when I switched to MYSQL

2018-12-21 18:00:45  INFO: [da99e34e] disconnected
2018-12-21 18:00:50  INFO: [de9e0c2d] connected
2018-12-21 18:00:50  INFO: [de9e0c2d: 5027 < 62.74.27.206] HEX: 000f333532303933303831323637313437
2018-12-21 18:00:50  WARN: Unknown device - 352093081267147 (62.74.27.206)
2018-12-21 18:00:50  INFO: [de9e0c2d: 5027 > 62.74.27.206] HEX: 00
2018-12-21 18:00:50  INFO: [de9e0c2d] disconnected
2018-12-21 18:00:56  INFO: [7b85d1e3] connected
2018-12-21 18:00:56  INFO: [7b85d1e3: 5027 < 62.74.27.206] HEX: 000f333532303933303831323637313437
2018-12-21 18:00:56  WARN: Unknown device - 352093081267147 (62.74.27.206)
2018-12-21 18:00:56  INFO: [7b85d1e3: 5027 > 62.74.27.206] HEX: 00
2018-12-21 18:00:58  INFO: [7b85d1e3] disconnected
2018-12-21 18:01:03  INFO: [19a68eb0] connected
2018-12-21 18:01:04  INFO: [08596264] connected
2018-12-21 18:01:04  INFO: [08596264: 5027 < 62.74.24.93] HEX: 000f333532303933303833343230353034
2018-12-21 18:01:04  WARN: Unknown device - 352093083420504 (62.74.24.93)
2018-12-21 18:01:04  INFO: [08596264: 5027 > 62.74.24.93] HEX: 00
2018-12-21 18:01:04  INFO: [19a68eb0: 5027 < 62.74.27.206] HEX: 000f333532303933303831323637313437
2018-12-21 18:01:04  WARN: Unknown device - 352093081267147 (62.74.27.206)
2018-12-21 18:01:04  INFO: [19a68eb0: 5027 > 62.74.27.206] HEX: 00
Anton Tananaev 7 years ago

You haven't registered devices:

Unknown device - 352093083420504
Dr Panos 7 years ago

This is happening because of the update. there are devices sending data. This log is just after the update before changing to MYSQL.

Dr Panos 7 years ago

This is the traccar.service status.

 traccar.service - traccar
   Loaded: loaded (/etc/systemd/system/traccar.service; enabled; vendor preset: disabled)
   Active: failed (Result: exit-code) since Sun 2018-12-23 15:36:46 UTC; 59min ago
  Process: 9810 ExecStart=/opt/traccar/jre/bin/java -jar tracker-server.jar conf/traccar.xml (code=exited, status=1/FAILURE)
 Main PID: 9810 (code=exited, status=1/FAILURE)

Dec 23 15:36:46 instance-3 traccar[9810]: at org.traccar.Main.run(Main.java:152)
Dec 23 15:36:46 instance-3 traccar[9810]: at org.traccar.Main.main(Main.java:104)
Dec 23 15:36:46 instance-3 traccar[9810]: Caused by: java.lang.NullPointerException
Dec 23 15:36:46 instance-3 traccar[9810]: at org.traccar.helper.Log.setupDefaultLogger(Log.java:160)
Dec 23 15:36:46 instance-3 traccar[9810]: at org.traccar.Context.init(Context.java:361)
Dec 23 15:36:46 instance-3 traccar[9810]: at org.traccar.Main.run(Main.java:110)
Dec 23 15:36:46 instance-3 traccar[9810]: ... 1 more
Dec 23 15:36:46 instance-3 systemd[1]: traccar.service: main process exited, code=exited, status=1/FAILURE
Dec 23 15:36:46 instance-3 systemd[1]: Unit traccar.service entered failed state.
Dec 23 15:36:46 instance-3 systemd[1]: traccar.service failed.
Anton Tananaev 7 years ago

You need to fix your config. If you are not sure what you are doing, please use default config.

Dr Panos 7 years ago

Hi Anton. The server was working perfectly before the update. The config file is just restored, no changes after. I think It is something related with MYSQL connection

Anton Tananaev 7 years ago

You can't use same config.

Dr Panos 7 years ago

Can you explain this I dont understand.
Before the update from 4.1 to 4.2 I was using the server with no problem with this database configuration

<entry key='database.driver'>com.mysql.jdbc.Driver</entry> <entry key='database.url'>jdbc:mysql://localhost:3306/mytraccardb?useSSL=false&amp;allowMultiQueries=true&amp;autoReconnect=true&amp;useUnicode=yes&amp;characterEncoding=UTF-8&amp;sessionVariables=sql_mode=''</entry> <entry key='database.user'>admin2</entry> <entry key='database.password'>****************</entry>

So I copy the conf , I backed up my database made the update and restored this conf. but it is not starting the service anymore
What am I doing wrong??

Anton Tananaev 7 years ago

Well, from your log it's clear that devices are not registered on the server. You need to find out why. I don't know what you are doing wrong.

Dr Panos 7 years ago

This is happening because the devices are sending data to the H2 database just after the update. All the devices are registered to MYSQL from the pre - update setup. When I change the database config. from H2 to MYSQL no more data are recording to the log.

Dr Panos 7 years ago

Well this is clear
when entering H2 configuration server is working fine
This is the status:

● traccar.service - traccar
   Loaded: loaded (/etc/systemd/system/traccar.service; enabled; vendor preset: disabled)
   Active: active (running) since Fri 2018-12-28 14:46:19 UTC; 6s ago
 Main PID: 5496 (java)
   CGroup: /system.slice/traccar.service
           └─5496 /opt/traccar/jre/bin/java -jar tracker-server.jar conf/traccar.xml

When changing to MySql this is the service status:

 ● traccar.service - traccar
   Loaded: loaded (/etc/systemd/system/traccar.service; enabled; vendor preset: disabled)
   Active: failed (Result: exit-code) since Fri 2018-12-28 14:37:15 UTC; 1s ago
  Process: 5402 ExecStart=/opt/traccar/jre/bin/java -jar tracker-server.jar conf/traccar.xml (code=exited, status=1/FAILURE)
 Main PID: 5402 (code=exited, status=1/FAILURE)

Database is working normaly No connectivity issues (checked)
Some kind of Java conectivity issue?
I made another installation of traccar in different server. The same issue again.

Please I need help on this

Anton Tananaev 7 years ago

You showed logs from a working server before. Now you are saying it doesn't even start. How is that possible?

Dr Panos 7 years ago

after changing traccar.xml to point from H2 to Mysql the server don't start