Trouble with mysql connection

carinavb8 years ago

Hello everybody, I have installed traccar-linux-3.11.zip on one Ubuntu 16.04 server, it runs perfectly using the default database, but when i want to use mysql the server does not start, I use the instructions on this link https://www.traccar.org/mysql/

The MySQL database is running fine and the database is created, i’m using the root user and password in the config file just to make sure that there are no permissions issues.

uname -a
Linux trackers 4.4.0-31-generic #50-Ubuntu SMP Wed Jul 13 00:06:14 UTC 2016 i686 i686 i686 GNU/Linux

java -version
openjdk version "1.8.0_131"
OpenJDK Runtime Environment (build 1.8.0_131-8u131-b11-0ubuntu1.16.04.2-b11)
OpenJDK Server VM (build 25.131-b11, mixed mode)

my traccar.xml file

<entry key="config.default">./conf/default.xml</entry>

<entry key='database.driver'>com.mysql.jdbc.Driver</entry>
<entry key='database.url'>jdbc:mysql://127.0.0.1:3306/traccar?allowMultiQueries=true&autoReconnect=true&useUnicode=yes&characterEncoding=UTF-8&sessionVariables=sql_mode=''</entry>

<entry key='database.user'>root</entry>
<entry key='database.password'>mypassword</entry>

I test the connection with Squirell Sql and I can connect without any problem.
I my wrapper.log I get this

WARNING|wrapper|Service traccar|17-06-09 14:46:44|YAJSW: yajsw-stable-12.08
WARNING|wrapper|Service traccar|17-06-09 14:46:44|OS   : Linux/4.4.0-31-generic/i386
WARNING|wrapper|Service traccar|17-06-09 14:46:44|JVM  : Oracle Corporation/1.8.0_131//usr/lib/jvm/java-$
INFO|wrapper|Service traccar|17-06-09 14:46:44|exec:"java" "-classpath" "/opt/traccar/wrapperApp.jar:/op$
INFO|wrapper|Service traccar|17-06-09 14:46:44|posix_spawn pid 4266
INFO|wrapper|Service traccar|17-06-09 14:46:44|started process 4266
INFO|wrapper|Service traccar|17-06-09 14:46:44|started process with pid 4266
INFO|4266/0|Service traccar|17-06-09 14:46:45|[INFO] StandardFileSystemManager - Using "/tmp/vfs_cache" $
INFO|4266/0|Service traccar|17-06-09 14:46:46|[main] INFO com.zaxxer.hikari.HikariDataSource - HikariPoo$
INFO|4266/0|Service traccar|17-06-09 14:46:46|[main] INFO com.zaxxer.hikari.pool.PoolBase - HikariPool-1Pool-1 - Driver does not support get/set network timeout for connections. (com.mysql.jdbc.Connection.geion.getNetworkTimeout()I)
INFO|4266/0|Service traccar|17-06-09 14:46:46|[main] ERROR com.zaxxer.hikari.pool.PoolBase - HikariPool-Failed to execute isValid() for connection, configure connection test query. (com.mysql.jdbc.Connection.isValid(I)Z)

INFO|4266/0|Service traccar|17-06-09 14:46:46|java.lang.reflect.InvocationTargetException
INFO|4266/0|Service traccar|17-06-09 14:46:46|  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native M$
INFO|4266/0|Service traccar|17-06-09 14:46:46|  at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMet$
INFO|4266/0|Service traccar|17-06-09 14:46:46|  at sun.reflect.DelegatingMethodAccessorImpl.invoke(Deleg$
INFO|4266/0|Service traccar|17-06-09 14:46:46|  at java.lang.reflect.Method.invoke(Method.java:498)
INFO|4266/0|Service traccar|17-06-09 14:46:46|  at org.rzo.yajsw.app.WrapperJVMMain.executeMain(WrapperJ$
INFO|4266/0|Service traccar|17-06-09 14:46:46|  at org.rzo.yajsw.app.WrapperJVMMain.main(WrapperJVMMain.$
INFO|4266/0|Service traccar|17-06-09 14:46:46|Caused by: java.lang.AbstractMethodError: com.mysql.jdbc.C$
INFO|4266/0|Service traccar|17-06-09 14:46:46|  at com.zaxxer.hikari.pool.PoolBase.checkDriverSupport(Po$
INFO|4266/0|Service traccar|17-06-09 14:46:46|  at com.zaxxer.hikari.pool.PoolBase.setupConnection(PoolB$
INFO|4266/0|Service traccar|17-06-09 14:46:46|  at com.zaxxer.hikari.pool.PoolBase.newConnection(PoolBas$
INFO|4266/0|Service traccar|17-06-09 14:46:46|  at com.zaxxer.hikari.pool.PoolBase.newPoolEntry(PoolBase$
INFO|4266/0|Service traccar|17-06-09 14:46:46|  at com.zaxxer.hikari.pool.HikariPool.createPoolEntry(Hik$
INFO|4266/0|Service traccar|17-06-09 14:46:46|  at com.zaxxer.hikari.pool.HikariPool.checkFailFast(Hikar$
INFO|4266/0|Service traccar|17-06-09 14:46:46|  at com.zaxxer.hikari.pool.HikariPool.<init>(HikariPool.j$
INFO|4266/0|Service traccar|17-06-09 14:46:46|  at com.zaxxer.hikari.HikariDataSource.<init>(HikariDataS$
INFO|4266/0|Service traccar|17-06-09 14:46:46|  at org.traccar.database.DataManager.initDatabase(DataMan$
INFO|4266/0|Service traccar|17-06-09 14:46:46|  at org.traccar.database.DataManager.<init>(DataManager.j$
INFO|4266/0|Service traccar|17-06-09 14:46:46|  at org.traccar.Context.init(Context.java:207)
INFO|4266/0|Service traccar|17-06-09 14:46:46|  at org.traccar.Main.main(Main.java:35)
INFO|4266/0|Service traccar|17-06-09 14:46:46|  ... 6 more
INFO|wrapper|Service traccar|17-06-09 14:46:46|waitpid 4266 59136
INFO|wrapper|Service traccar|17-06-09 14:46:46|exit code posix process: 59136 application: 0

My traccar-server.log

2017-06-09 14:46:45  INFO: Operating system name: Linux version: 4.4.0-31-generic architecture: i386
2017-06-09 14:46:45  INFO: Java runtime name: OpenJDK Server VM vendor: Oracle Corporation version: 25.1$
2017-06-09 14:46:45  INFO: Memory limit heap: 910mb non-heap: 0mb
2017-06-09 14:46:45  INFO: Character encoding: UTF-8 charset: UTF-8
2017-06-09 14:46:45  INFO: Version: 3.11-SNAPSHOT

Can anyone help me out with this...
I'been reading the forums but I can't resolve this yet.
Best Regards
Carina

Anton Tananaev8 years ago

I don't know if you realize it, but your text editor has cut endings of all the relevant log lines.

carinavb8 years ago

Thanks Anton for the answer...
I'm sorry that's true... I paste again the logs file and taccar.xml

wrapper.log

WARNING|wrapper|Service traccar|17-06-09 14:46:44|YAJSW: yajsw-stable-12.08
WARNING|wrapper|Service traccar|17-06-09 14:46:44|OS   : Linux/4.4.0-31-generic/i386
WARNING|wrapper|Service traccar|17-06-09 14:46:44|JVM  : Oracle Corporation/1.8.0_131//usr/lib/jvm/java-8-openjdk-i386/jre/32
INFO|wrapper|Service traccar|17-06-09 14:46:44|exec:"java" "-classpath" "/opt/traccar/wrapperApp.jar:/opt/traccar/tracker-server.jar:/opt/traccar/lib/log4j-1.2.17.jar:/opt/traccar/lib/joda-time-2.9.9.jar:/opt/traccar/lib/h2-1.4.194.jar:/opt/traccar/lib/mysql-connector-java-5.1.41.jar:/opt/traccar/lib/postgresql-42.0.0.jre7.jar:/opt/traccar/lib/mssql-jdbc-6.1.0.jre7.jar:/opt/traccar/lib/HikariCP-java7-2.4.11.jar:/opt/traccar/lib/slf4j-api-1.7.21.jar:/opt/traccar/lib/netty-3.10.6.Final.jar:/opt/traccar/lib/async-http-client-1.9.40.jar:/opt/traccar/lib/slf4j-simple-1.7.25.jar:/opt/traccar/lib/javax.json-1.0.4.jar:/opt/traccar/lib/jetty-server-9.2.21.v20170120.jar:/opt/traccar/lib/javax.servlet-api-3.1.0.jar:/opt/traccar/lib/jetty-http-9.2.21.v20170120.jar:/opt/traccar/lib/jetty-io-9.2.21.v20170120.jar:/opt/traccar/lib/jetty-servlet-9.2.21.v20170120.jar:/opt/traccar/lib/jetty-security-9.2.21.v20170120.jar:/opt/traccar/lib/jetty-webapp-9.2.21.v20170120.jar:/opt/traccar/lib/jetty-xml-9.2.21.v20170120.jar:/opt/traccar/lib/jetty-jndi-9.2.21.v20170120.jar:/opt/traccar/lib/jetty-util-9.2.21.v20170120.jar:/opt/traccar/lib/websocket-server-9.2.21.v20170120.jar:/opt/traccar/lib/websocket-common-9.2.21.v20170120.jar:/opt/traccar/lib/websocket-api-9.2.21.v20170120.jar:/opt/traccar/lib/websocket-client-9.2.21.v20170120.jar:/opt/traccar/lib/websocket-servlet-9.2.21.v20170120.jar:/opt/traccar/lib/jersey-container-servlet-2.25.1.jar:/opt/traccar/lib/jersey-container-servlet-core-2.25.1.jar:/opt/traccar/lib/javax.inject-2.5.0-b32.jar:/opt/traccar/lib/jersey-common-2.25.1.jar:/opt/traccar/lib/javax.annotation-api-1.2.jar:/opt/traccar/lib/jersey-guava-2.25.1.jar:/opt/traccar/lib/hk2-api-2.5.0-b32.jar:/opt/traccar/lib/hk2-utils-2.5.0-b32.jar:/opt/traccar/lib/aopalliance-repackaged-2.5.0-b32.jar:/opt/traccar/lib/hk2-locator-2.5.0-b32.jar:/opt/traccar/lib/javassist-3.20.0-GA.jar:/opt/traccar/lib/osgi-resource-locator-1.0.1.jar:/opt/traccar/lib/jersey-server-2.25.1.jar:/opt/traccar/lib/jersey-client-2.25.1.jar:/opt/traccar/lib/jersey-media-jaxb-2.25.1.jar:/opt/traccar/lib/validation-api-1.1.0.Final.jar:/opt/traccar/lib/javax.ws.rs-api-2.0.1.jar:/opt/traccar/lib/jersey-media-json-jackson-2.25.1.jar:/opt/traccar/lib/jersey-entity-filtering-2.25.1.jar:/opt/traccar/lib/jackson-jaxrs-base-2.8.4.jar:/opt/traccar/lib/jackson-core-2.8.4.jar:/opt/traccar/lib/jackson-databind-2.8.4.jar:/opt/traccar/lib/jackson-jaxrs-json-provider-2.8.4.jar:/opt/traccar/lib/jackson-module-jaxb-annotations-2.8.4.jar:/opt/traccar/lib/jackson-annotations-2.8.4.jar:/opt/traccar/lib/liquibase-core-3.5.3.jar:/opt/traccar/lib/snakeyaml-1.17.jar:/opt/traccar/lib/mail-1.4.7.jar:/opt/traccar/lib/activation-1.1.jar:/opt/traccar/lib/jxls-2.4.0.jar:/opt/traccar/lib/commons-jexl-2.1.1.jar:/opt/traccar/lib/commons-beanutils-1.9.2.jar:/opt/traccar/lib/jcl-over-slf4j-1.7.12.jar:/opt/traccar/lib/logback-core-1.1.3.jar:/opt/traccar/lib/jxls-poi-1.0.12.jar:/opt/traccar/lib/poi-3.14.jar:/opt/traccar/lib/poi-ooxml-3.14.jar:/opt/traccar/lib/poi-ooxml-schemas-3.14.jar:/opt/traccar/lib/xmlbeans-2.6.0.jar:/opt/traccar/lib/stax-api-1.0.1.jar:/opt/traccar/lib/curvesapi-1.03.jar:/opt/traccar/lib/velocity-1.7.jar:/opt/traccar/lib/commons-collections-3.2.1.jar:/opt/traccar/lib/commons-lang-2.4.jar:/opt/traccar/lib/velocity-tools-2.0.jar:/opt/traccar/lib/commons-digester-1.8.jar:/opt/traccar/lib/commons-chain-1.1.jar:/opt/traccar/lib/commons-logging-1.1.jar:/opt/traccar/lib/servlet-api-2.3.jar:/opt/traccar/lib/commons-validator-1.3.1.jar:/opt/traccar/lib/dom4j-1.1.jar:/opt/traccar/lib/oro-2.0.8.jar:/opt/traccar/lib/sslext-1.2-0.jar:/opt/traccar/lib/struts-core-1.3.8.jar:/opt/traccar/lib/antlr-2.7.2.jar:/opt/traccar/lib/struts-taglib-1.3.8.jar:/opt/traccar/lib/struts-tiles-1.3.8.jar:/opt/traccar/lib/ical4j-2.0.0.jar:/opt/traccar/lib/commons-collections4-4.0.jar:/opt/traccar/lib/groovy-all-2.3.2.jar:/opt/traccar/lib/bndlib-2.3.0.jar:/opt/traccar/lib/org.osgi.core-4.3.1.jar:/opt/traccar/lib/commons-lang3-3.3.2.jar:/opt/traccar/lib/commons-codec-1.9.jar:/opt/traccar/lib/ch-smpp-5.0.9.jar:/opt/traccar/lib/ch-commons-util-6.0.2.jar:/opt/traccar/lib/ch-commons-charset-3.0.2.jar" "-Dfile.encoding=UTF-8" "-Xrs" "-Dwrapper.service=true" "-Dwrapper.console.visible=false" "-Dwrapper.port=15003" "-Dwrapper.key=1433525045024170045" "-Dwrapper.teeName=1433525045024170045$1497030404604" "-Dwrapper.tmp.path=/opt/traccar/tmp" "-Djna_tmpdir=/opt/traccar/tmp" "-Dwrapper.config=/opt/traccar/conf/wrapper.conf" "-Dwrapper.visible=false" "-Dwrapper.pidfile=/run/wrapper.traccar.pid" "org.rzo.yajsw.app.WrapperJVMMain" 
INFO|wrapper|Service traccar|17-06-09 14:46:44|posix_spawn pid 4266
INFO|wrapper|Service traccar|17-06-09 14:46:44|started process 4266
INFO|wrapper|Service traccar|17-06-09 14:46:44|started process with pid 4266
INFO|4266/0|Service traccar|17-06-09 14:46:45|[INFO] StandardFileSystemManager - Using "/tmp/vfs_cache" as temporary files store.
INFO|4266/0|Service traccar|17-06-09 14:46:46|[main] INFO com.zaxxer.hikari.HikariDataSource - HikariPool-1 - Starting...
INFO|4266/0|Service traccar|17-06-09 14:46:46|[main] INFO com.zaxxer.hikari.pool.PoolBase - HikariPool-1 - Driver does not support get/set network timeout for connections. (com.mysql.jdbc.Connection.getNetworkTimeout()I)
INFO|4266/0|Service traccar|17-06-09 14:46:46|[main] ERROR com.zaxxer.hikari.pool.PoolBase - HikariPool-1 - Failed to execute isValid() for connection, configure connection test query. (com.mysql.jdbc.Connection.isValid(I)Z)
INFO|4266/0|Service traccar|17-06-09 14:46:46|java.lang.reflect.InvocationTargetException
INFO|4266/0|Service traccar|17-06-09 14:46:46|	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
INFO|4266/0|Service traccar|17-06-09 14:46:46|	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
INFO|4266/0|Service traccar|17-06-09 14:46:46|	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
INFO|4266/0|Service traccar|17-06-09 14:46:46|	at java.lang.reflect.Method.invoke(Method.java:498)
INFO|4266/0|Service traccar|17-06-09 14:46:46|	at org.rzo.yajsw.app.WrapperJVMMain.executeMain(WrapperJVMMain.java:60)
INFO|4266/0|Service traccar|17-06-09 14:46:46|	at org.rzo.yajsw.app.WrapperJVMMain.main(WrapperJVMMain.java:43)
INFO|4266/0|Service traccar|17-06-09 14:46:46|Caused by: java.lang.AbstractMethodError: com.mysql.jdbc.Connection.isValid(I)Z
INFO|4266/0|Service traccar|17-06-09 14:46:46|	at com.zaxxer.hikari.pool.PoolBase.checkDriverSupport(PoolBase.java:411)
INFO|4266/0|Service traccar|17-06-09 14:46:46|	at com.zaxxer.hikari.pool.PoolBase.setupConnection(PoolBase.java:382)
INFO|4266/0|Service traccar|17-06-09 14:46:46|	at com.zaxxer.hikari.pool.PoolBase.newConnection(PoolBase.java:346)
INFO|4266/0|Service traccar|17-06-09 14:46:46|	at com.zaxxer.hikari.pool.PoolBase.newPoolEntry(PoolBase.java:193)
INFO|4266/0|Service traccar|17-06-09 14:46:46|	at com.zaxxer.hikari.pool.HikariPool.createPoolEntry(HikariPool.java:428)
INFO|4266/0|Service traccar|17-06-09 14:46:46|	at com.zaxxer.hikari.pool.HikariPool.checkFailFast(HikariPool.java:499)
INFO|4266/0|Service traccar|17-06-09 14:46:46|	at com.zaxxer.hikari.pool.HikariPool.<init>(HikariPool.java:112)
INFO|4266/0|Service traccar|17-06-09 14:46:46|	at com.zaxxer.hikari.HikariDataSource.<init>(HikariDataSource.java:72)
INFO|4266/0|Service traccar|17-06-09 14:46:46|	at org.traccar.database.DataManager.initDatabase(DataManager.java:115)
INFO|4266/0|Service traccar|17-06-09 14:46:46|	at org.traccar.database.DataManager.<init>(DataManager.java:70)
INFO|4266/0|Service traccar|17-06-09 14:46:46|	at org.traccar.Context.init(Context.java:207)
INFO|4266/0|Service traccar|17-06-09 14:46:46|	at org.traccar.Main.main(Main.java:35)
INFO|4266/0|Service traccar|17-06-09 14:46:46|	... 6 more
INFO|wrapper|Service traccar|17-06-09 14:46:46|waitpid 4266 59136
INFO|wrapper|Service traccar|17-06-09 14:46:46|exit code posix process: 59136 application: 0

traccar-server.log

2017-06-09 14:46:45  INFO: Operating system name: Linux version: 4.4.0-31-generic architecture: i386
2017-06-09 14:46:45  INFO: Java runtime name: OpenJDK Server VM vendor: Oracle Corporation version: 25.131-b11
2017-06-09 14:46:45  INFO: Memory limit heap: 910mb non-heap: 0mb
2017-06-09 14:46:45  INFO: Character encoding: UTF-8 charset: UTF-8
2017-06-09 14:46:45  INFO: Version: 3.11-SNAPSHOT

traccar.xml

<entry key="config.default">./conf/default.xml</entry>
<entry key="database.driver">com.mysql.jdbc.Driver</entry>
<entry key="database.url">jdbc:mysql://127.0.0.1:3306/traccar?allowMultiQueries=true&autoReconnect=true&useUnicode=yes&characterEncoding=UTF-8&sessionVariables=sql_mode=''</entry>
<entry key="database.user">root</entry>
<entry key="database.password">mypassword</entry>
Anton Tananaev8 years ago

I suspect that Java on your machine is picking up some very outdated MySQL driver instead of using version from Traccar. Try removing outdated driver.

carinavb8 years ago

HI Anton I try to do what you said without success.
I have this mysql 5.7.18-0ubuntu0.16.04.1, can you guide me with this I've been searching but I don't know how to do this.

Best regards
Carina

Anton Tananaev8 years ago

I am not talking about MySQL version. I am talking about MySQL JDBC driver. Find and remove old version.