MYSQL not initializing DB on startup

gozze7 years ago

Hi
Was trying to get it working with mysql, followed the instructions for changing config for mysql.
In the logs i first got this errors:

421943509500" "-Dwrapper.teeName=6589134421943509500$1488670560338" "-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-03-05 00:36:00|posix_spawn pid 31259
INFO|wrapper|Service traccar|17-03-05 00:36:00|started process 31259
INFO|wrapper|Service traccar|17-03-05 00:36:00|started process with pid 31259
INFO|31259/0|Service traccar|17-03-05 00:36:02|[INFO] StandardFileSystemManager - Using "/tmp/vfs_cache" as temporary files store.
INFO|31259/0|Service traccar|17-03-05 00:36:02|[main] INFO com.zaxxer.hikari.HikariDataSource - HikariPool-1 - Starting...
INFO|31259/0|Service traccar|17-03-05 00:36:03|Sun Mar 05 00:36:03 CET 2017 WARN: Establishing SSL connection without server's identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification.
INFO|31259/0|Service traccar|17-03-05 00:36:03|[main] INFO com.zaxxer.hikari.HikariDataSource - HikariPool-1 - Start completed.
INFO|31259/0|Service traccar|17-03-05 00:36:03|Sun Mar 05 00:36:03 CET 2017 WARN: Establishing SSL connection without server's identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification.

Later i changed in params for db connection to not use SSL, but from there it only gives me bad gateway when trying to do a connect to traccar application.

INFO|wrapper|Service traccar|17-03-05 00:42:24|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.7.jar:/opt/traccar/lib/h2-1.4.193.jar:/opt/traccar/lib/mysql-connector-java-5.1.40.jar:/opt/traccar/lib/postgresql-9.4.1212.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.22.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.3.0.jar:/opt/traccar/lib/commons-jexl-2.1.1.jar:/opt/traccar/lib/commons-logging-1.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.11.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/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" "-Dfile.encoding=UTF-8" "-Xrs" "-Dwrapper.service=true" "-Dwrapper.console.visible=false" "-Dwrapper.port=15003" "-Dwrapper.key=-1651380392533146042" "-Dwrapper.teeName=-1651380392533146042$1488670944083" "-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-03-05 00:42:24|posix_spawn pid 32198
INFO|wrapper|Service traccar|17-03-05 00:42:24|started process 32198
INFO|wrapper|Service traccar|17-03-05 00:42:24|started process with pid 32198
INFO|32198/0|Service traccar|17-03-05 00:42:26|[INFO] StandardFileSystemManager - Using "/tmp/vfs_cache" as temporary files store.
INFO|32198/0|Service traccar|17-03-05 00:42:26|[main] INFO com.zaxxer.hikari.HikariDataSource - HikariPool-1 - Starting...
INFO|32198/0|Service traccar|17-03-05 00:42:27|[main] INFO com.zaxxer.hikari.HikariDataSource - HikariPool-1 - Start completed.

I reverted to use of H2 database and all works fine, maybe its an issue with latest version of mysql 5.7 that im using on ubuntu 16.04? Maybe downgrade to a older mysql version.

Step 1 - Stop Traccar Service
Step 2 - Create mysql db with user assigned
Step 3 - Open traccar.xml file or default.xml file in latest version
Step 4 - Remove the below

<entry key='database.driver'>org.h2.Driver</entry>
<entry key='database.url'>jdbc:h2:/home/user/Documents/traccar/target/database</entry>
<entry key='database.user'>sa</entry>
<entry key='database.password'></entry>

Step 5 - Add the below s

<entry key='database.driver'>com.mysql.jdbc.Driver</entry> 
<entry key='database.url'>jdbc:mysql://[HOST]:3306/[DATABASE]?allowMultiQueries=true&autoReconnect=true&useUnicode=yes&characterEncoding=UTF-8&sessionVariables=sql_mode=''</entry>
<entry key='database.user'>[USER]</entry> 
<entry key='database.password'>[PASSWORD]</entry>

Step 6 - Save config file
Step 7 - Restart traccar service
Step 8 - Check mysql db if the tables are populated
Steo 9 - thats it

make sure your db is empty as per traccar service it will create the db tables automatically for the first time if it cannot find the H2 database and if there is mysql or postgresql or mssql details present.

gozze7 years ago

I did that, setuped a specific user for the db that i created with correct permissions. But nothing happens in the db, no tables are created.

  1. what is the OS you are using ?
  2. is it localhost or server ?
  3. what version of java you are using ?
  4. did you checked the log files ?
gabrielcz7 years ago

I have same problem here.

  1. Ubuntu 16.04.3 LTS \n \l

  2. localhost

  3. openjdk version "1.8.0_131"
    OpenJDK Runtime Environment (build 1.8.0_131-8u131-b11-2ubuntu1.16.04.3-b11)
    OpenJDK 64-Bit Server VM (build 25.131-b11, mixed mode)

  4. on log file I get a warning:
    WARN: Establishing SSL connection without server's identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification.

help please! :)

Anton Tananaev7 years ago

You can safely ignore the warning. The problem is not the same. If you see this warning, it means that Traccar has successfully connected to the database.