integrated traccar 64-4.5 and mysql error com.mysql.cj.jdbc.Driver - ClassNotFoundException

rozali6 years ago

please help, I have downloaded it

  1. traccar-linux-64-4.5.zip and extract then run with ./traccar.run
  2. install mysql 8.0.16
  3. create database traccar, user traccardb @ localhost and password traccar
  4. download mysql-connector-java-8.0.16.jar and place it in the / opt / traccar / libs directory
  5. edit the /opt/traccar/conf/traccar.xml file as below
         <entry key = 'database.driver'> com.mysql.cj.jdbc.Driver </ entry>
     <entry key = 'database.url'> jdbc: mysql: // localhos: 80 / traccar? allowMultiQueries = true & amp; autoReconnect = true & amp; useUnicode = yes & amp; characterEncoding = UTF-8 & amp; sessionVariables = sql_mode = '' </ entry>
     <entry key = 'database.user'> traccardb </ entry>
     <entry key = 'database.password'> traccar </ entry>

The question is why after I run the service
systemctl start traccar.service results in an error in tracker-server.log where the error is ERROR: Main method error - com.mysql.cj.jdbc.Driver - ClassNotFoundException

I hope for the answer and help

Anton Tananaev6 years ago

I would recommend to read documentation:

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

rozali6 years ago

I have changed the conf / traccar.xml parameter as below:

  1. <entry key = 'database.driver'> com.mysql.jdbc.Driver </ entry>
  2. <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>

the result is an error, I also use the database.driver entry key parameter so com.mysql.cj.jdbc.Driver and I change localhost so the IP address is the same as the error below:

2019-05-21 09:32:52 ERROR: Main method error - com.mysql.jdbc.Driver - ClassNotFoundException (... <DataManager: 120 <*: 89 <Context: 292 <Main: 110 <...)
2019-05-21 09:34:25 ERROR: Main method error - com.mysql.cj.jdbc.Driver - ClassNotFoundException (... <DataManager: 120 <*: 89 <Context: 292 <Main: 110 <... .)

please help

Anton Tananaev6 years ago

Can't really tell what's wrong without looking at your server, but one thing I noticed is that for some reason you downloaded JDBC driver. You don't need to do it. Traccar already includes all required drivers.

rozali6 years ago

Hai Anton,
You are right, I don't need to download the latest mysql j connector. after I change with the default connector from the traccar log results as below

2019-05-21 14:59:01 INFO: Started ServerConnector @ 9596ce8 {HTTP / 1.1, [http / 1.1]} {0.0.0.0:80}
2019-05-21 14:59:01 INFO: Started @ 115094ms
2019-05-21 15:02:53 INFO: user: 1, action: login

but after I gave the order

systemctl status is traccar.service

the result is a warning, is there still a bug or what?

May 21 14:57:06 CommGt06 traccar [2049]: SLF4J: Path class contains multiple SLF4J bindings.
May 21 14:57:06 CommGt06 traccar [2049]: SLF4J: Found binding in [jar: file: /opt/traccar/lib/slf4j-jdk14-1.7.26.jar! /Org/slf4j/impl/StaticLoggerBinder.class ]
May 21 14:57:06 CommGt06 traccar [2049]: SLF4J: Found binding in [jar: file: /opt/traccar/lib/logback-classic-1.2.3.jar! /Org/slf4j/impl/StaticLoggerBinder.class ]
May 21 14:57:06 CommGt06 traccar [2049]: SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
May 21 14:57:07 CommGt06 traccar [2049]: SLF4J: Actual binding is of type [org.slf4j.impl.JDK14LoggerFactory]
May 21 14:58:57 CommGt06 traccar [2049]: WARNING: An illegal reflective access operation has occurred
May 21 14:58:57 CommGt06 traccar [2049]: WARNING: Illegal reflective access by com.google.inject.internal.cglib.core. $ ReflectUtils $ 1 (file: /opt/traccar/lib/guice-4.2.2. j
May 21 14:58:57 CommGt06 traccar [2049]: WARNING: Please consider reporting this to the maintainers of com.google.inject.internal.cglib.core. $ ReflectUtils $ 1
May 21 14:58:57 CommGt06 traccar [2049]: WARNING: Use --illegal-access = warn to enable warnings of further illegal reflective access operations
May 21 14:58:57 CommGt06 traccar [2049]: WARNING: All illegal access operations will be denied in a future release

Please explain and thank you very much

Anton Tananaev6 years ago

You can safely ignore those.

rozali6 years ago

Ok, thank you