MYSQL Connection Issue

bharat sai kumar6 years ago

Iam getting this below error
1)i did traccar installation in cenots 8 by using sudo ./traccar.run..installed traccar
2) later i have done changes in traccar.xml regarding the database connection..below is the traccar.xml file

<properties>

    <!-- SERVER CONFIG version -3.8 -->

    <entry key='web.enable'>true</entry>
    <entry key='web.port'>8082</entry>
    <entry key='web.path'>/opt/traccar/web</entry>

    <entry key='geocoder.enable'>false</entry>
    <entry key='geocoder.type'>google</entry>

    <entry key='logger.enable'>true</entry> 
    <entry key='logger.level'>all</entry>
    <entry key='logger.file'>/opt/traccar/logs/tracker-server.log</entry>

    <!-- DATABASE CONFIG -->

    <entry key='database.driver'>com.mysql.jdbc.Driver</entry>
    <entry key='database.url'>jdbc:mysql://XXXXXXXXXXXXXXXXXXXXXXXXXXXXX?allowMultiQueries=true&amp;autoReconnect=true&amp;useUnicode=yes&amp;characterEncoding=UTF-8&amp;sessionVariables=sql_mode=ANSI_QUOTES</entry>
    <entry key='database.user'>XXXXXXXX</entry>
    <entry key='database.password'>XXXXXXXXXXXX</entry>

    <entry key='forward.enable'>true</entry>
    <entry key='forward.url'>XXXXXXXXXXXXXXXXXXXXXXXXXX</entry>	

    <entry key='database.selectDevicesAll'>
         select id, '' as name, device_id as uniqueid from assests_master where status=1;
    </entry>

    <!-- PROTOCOL CONFIG -->	
    <entry key='gt06.port'>5023</entry>
    <entry key='gl200.port'>5004</entry>
    

</properties>

3)whenever iam running yum search mysql* in centos .,iam getting this error

sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
FINEST|14206/0|Service traccar|18-07-28 07:26:37| at java.lang.reflect.Constructor.newInstance(Unknown Source)
FINEST|14206/0|Service traccar|18-07-28 07:26:37| at com.mysql.jdbc.Util.handleNewInstance(Util.java:425)
FINEST|14206/0|Service traccar|18-07-28 07:26:37| at com.mysql.jdbc.SQLError.createCommunicationsException(SQLError.java:990)
FINEST|14206/0|Service traccar|18-07-28 07:26:37| at com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:342)

Please tell me what is the issue

Anton Tananaev6 years ago

Please provide full error stack.

bharat sai kumar6 years ago
...
INFO|21092/0|Service traccar|18-07-31 06:34:46|com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: Could not create connection to database server. Attempted reconnect 3 times. Giving up.
INFO|21092/0|Service traccar|18-07-31 06:34:46|	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
INFO|21092/0|Service traccar|18-07-31 06:34:46|	at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
INFO|21092/0|Service traccar|18-07-31 06:34:46|	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
INFO|21092/0|Service traccar|18-07-31 06:34:46|	at java.lang.reflect.Constructor.newInstance(Unknown Source)
INFO|21092/0|Service traccar|18-07-31 06:34:46|	at com.mysql.jdbc.Util.handleNewInstance(Util.java:425)
INFO|21092/0|Service traccar|18-07-31 06:34:46|	at com.mysql.jdbc.Util.getInstance(Util.java:408)
INFO|21092/0|Service traccar|18-07-31 06:34:46|	at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:919)
INFO|21092/0|Service traccar|18-07-31 06:34:46|	at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:898)
INFO|21092/0|Service traccar|18-07-31 06:34:46|	at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:887)
INFO|21092/0|Service traccar|18-07-31 06:34:46|	at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:861)
INFO|21092/0|Service traccar|18-07-31 06:34:46|	at com.mysql.jdbc.ConnectionImpl.connectWithRetries(ConnectionImpl.java:2096)
INFO|21092/0|Service traccar|18-07-31 06:34:46|	at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2021)
INFO|21092/0|Service traccar|18-07-31 06:34:46|	at com.mysql.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:776)
INFO|21092/0|Service traccar|18-07-31 06:34:46|	at com.mysql.jdbc.JDBC4Connection.<init>(JDBC4Connection.java:47)
INFO|21092/0|Service traccar|18-07-31 06:34:46|	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
INFO|21092/0|Service traccar|18-07-31 06:34:46|	at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
INFO|21092/0|Service traccar|18-07-31 06:34:46|	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
INFO|21092/0|Service traccar|18-07-31 06:34:46|	at java.lang.reflect.Constructor.newInstance(Unknown Source)
INFO|21092/0|Service traccar|18-07-31 06:34:46|	at com.mysql.jdbc.Util.handleNewInstance(Util.java:425)
INFO|21092/0|Service traccar|18-07-31 06:34:46|	at com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:386)
INFO|21092/0|Service traccar|18-07-31 06:34:46|	at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:330)
INFO|21092/0|Service traccar|18-07-31 06:34:46|	at com.zaxxer.hikari.util.DriverDataSource.getConnection(DriverDataSource.java:112)
INFO|21092/0|Service traccar|18-07-31 06:34:46|	at com.zaxxer.hikari.util.DriverDataSource.getConnection(DriverDataSource.java:118)
INFO|21092/0|Service traccar|18-07-31 06:34:46|	at com.zaxxer.hikari.pool.PoolBase.newConnection(PoolBase.java:341)
INFO|21092/0|Service traccar|18-07-31 06:34:46|	at com.zaxxer.hikari.pool.PoolBase.newPoolEntry(PoolBase.java:193)
INFO|21092/0|Service traccar|18-07-31 06:34:46|	at com.zaxxer.hikari.pool.HikariPool.createPoolEntry(HikariPool.java:428)
INFO|21092/0|Service traccar|18-07-31 06:34:46|	at com.zaxxer.hikari.pool.HikariPool.checkFailFast(HikariPool.java:499)
INFO|21092/0|Service traccar|18-07-31 06:34:46|	at com.zaxxer.hikari.pool.HikariPool.<init>(HikariPool.java:112)
INFO|21092/0|Service traccar|18-07-31 06:34:46|	at com.zaxxer.hikari.HikariDataSource.<init>(HikariDataSource.java:72)
INFO|21092/0|Service traccar|18-07-31 06:34:46|	at org.traccar.database.DataManager.initDatabase(DataManager.java:134)
INFO|21092/0|Service traccar|18-07-31 06:34:46|	at org.traccar.database.DataManager.<init>(DataManager.java:87)
INFO|21092/0|Service traccar|18-07-31 06:34:46|	at org.traccar.Context.init(Context.java:353)
INFO|21092/0|Service traccar|18-07-31 06:34:46|	at org.traccar.Main.main(Main.java:35)
INFO|21092/0|Service traccar|18-07-31 06:34:46|	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
INFO|21092/0|Service traccar|18-07-31 06:34:46|	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
INFO|21092/0|Service traccar|18-07-31 06:34:46|	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
INFO|21092/0|Service traccar|18-07-31 06:34:46|	at java.lang.reflect.Method.invoke(Unknown Source)
INFO|21092/0|Service traccar|18-07-31 06:34:46|	at org.rzo.yajsw.app.WrapperJVMMain.executeMain(WrapperJVMMain.java:60)
INFO|21092/0|Service traccar|18-07-31 06:34:46|	at org.rzo.yajsw.app.WrapperJVMMain.main(WrapperJVMMain.java:43)
INFO|21092/0|Service traccar|18-07-31 06:34:46|Caused by: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure
INFO|21092/0|Service traccar|18-07-31 06:34:46|
INFO|21092/0|Service traccar|18-07-31 06:34:46|The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
INFO|21092/0|Service traccar|18-07-31 06:34:46|	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
INFO|21092/0|Service traccar|18-07-31 06:34:46|	at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
INFO|21092/0|Service traccar|18-07-31 06:34:46|	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
INFO|21092/0|Service traccar|18-07-31 06:34:46|	at java.lang.reflect.Constructor.newInstance(Unknown Source)
INFO|21092/0|Service traccar|18-07-31 06:34:46|	at com.mysql.jdbc.Util.handleNewInstance(Util.java:425)
INFO|21092/0|Service traccar|18-07-31 06:34:46|	at com.mysql.jdbc.SQLError.createCommunicationsException(SQLError.java:990)
INFO|21092/0|Service traccar|18-07-31 06:34:46|	at com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:342)
INFO|21092/0|Service traccar|18-07-31 06:34:46|	at com.mysql.jdbc.ConnectionImpl.coreConnect(ConnectionImpl.java:2188)
INFO|21092/0|Service traccar|18-07-31 06:34:46|	at com.mysql.jdbc.ConnectionImpl.connectWithRetries(ConnectionImpl.java:2037)
INFO|21092/0|Service traccar|18-07-31 06:34:46|	... 28 more
INFO|21092/0|Service traccar|18-07-31 06:34:46|Caused by: java.net.SocketTimeoutException: connect timed out
INFO|21092/0|Service traccar|18-07-31 06:34:46|	at java.net.PlainSocketImpl.socketConnect(Native Method)
INFO|21092/0|Service traccar|18-07-31 06:34:46|	at java.net.AbstractPlainSocketImpl.doConnect(Unknown Source)
INFO|21092/0|Service traccar|18-07-31 06:34:46|	at java.net.AbstractPlainSocketImpl.connectToAddress(Unknown Source)
INFO|21092/0|Service traccar|18-07-31 06:34:46|	at java.net.AbstractPlainSocketImpl.connect(Unknown Source)
INFO|21092/0|Service traccar|18-07-31 06:34:46|	at java.net.SocksSocketImpl.connect(Unknown Source)
INFO|21092/0|Service traccar|18-07-31 06:34:46|	at java.net.Socket.connect(Unknown Source)
INFO|21092/0|Service traccar|18-07-31 06:34:46|	at com.mysql.jdbc.StandardSocketFactory.connect(StandardSocketFactory.java:211)
INFO|21092/0|Service traccar|18-07-31 06:34:46|	at com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:301)
INFO|21092/0|Service traccar|18-07-31 06:34:46|	... 30 more
INFO|21092/0|Service traccar|18-07-31 06:34:46|java.lang.reflect.InvocationTargetException
INFO|21092/0|Service traccar|18-07-31 06:34:46|	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
INFO|21092/0|Service traccar|18-07-31 06:34:46|	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
INFO|21092/0|Service traccar|18-07-31 06:34:46|	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
INFO|21092/0|Service traccar|18-07-31 06:34:46|	at java.lang.reflect.Method.invoke(Unknown Source)
INFO|21092/0|Service traccar|18-07-31 06:34:46|	at org.rzo.yajsw.app.WrapperJVMMain.executeMain(WrapperJVMMain.java:60)
INFO|21092/0|Service traccar|18-07-31 06:34:46|	at org.rzo.yajsw.app.WrapperJVMMain.main(WrapperJVMMain.java:43)
INFO|21092/0|Service traccar|18-07-31 06:34:46|Caused by: com.zaxxer.hikari.pool.HikariPool$PoolInitializationException: Failed to initialize pool: Could not create connection to database server. Attempted reconnect 3 times. Giving up.
INFO|21092/0|Service traccar|18-07-31 06:34:46|	at com.zaxxer.hikari.pool.HikariPool.throwPoolInitializationException(HikariPool.java:528)
INFO|21092/0|Service traccar|18-07-31 06:34:46|	at com.zaxxer.hikari.pool.HikariPool.checkFailFast(HikariPool.java:520)
INFO|21092/0|Service traccar|18-07-31 06:34:46|	at com.zaxxer.hikari.pool.HikariPool.<init>(HikariPool.java:112)
INFO|21092/0|Service traccar|18-07-31 06:34:46|	at com.zaxxer.hikari.HikariDataSource.<init>(HikariDataSource.java:72)
INFO|21092/0|Service traccar|18-07-31 06:34:46|	at org.traccar.database.DataManager.initDatabase(DataManager.java:134)
INFO|21092/0|Service traccar|18-07-31 06:34:46|	at org.traccar.database.DataManager.<init>(DataManager.java:87)
INFO|21092/0|Service traccar|18-07-31 06:34:46|	at org.traccar.Context.init(Context.java:353)
INFO|21092/0|Service traccar|18-07-31 06:34:46|	at org.traccar.Main.main(Main.java:35)
INFO|21092/0|Service traccar|18-07-31 06:34:46|	... 6 more
INFO|21092/0|Service traccar|18-07-31 06:34:46|Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: Could not create connection to database server. Attempted reconnect 3 times. Giving up.
INFO|21092/0|Service traccar|18-07-31 06:34:46|	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
INFO|21092/0|Service traccar|18-07-31 06:34:46|	at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
INFO|21092/0|Service traccar|18-07-31 06:34:46|	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
INFO|21092/0|Service traccar|18-07-31 06:34:46|	at java.lang.reflect.Constructor.newInstance(Unknown Source)
INFO|21092/0|Service traccar|18-07-31 06:34:46|	at com.mysql.jdbc.Util.handleNewInstance(Util.java:425)
INFO|21092/0|Service traccar|18-07-31 06:34:46|	at com.mysql.jdbc.Util.getInstance(Util.java:408)
INFO|21092/0|Service traccar|18-07-31 06:34:46|	at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:919)
INFO|21092/0|Service traccar|18-07-31 06:34:46|	at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:898)
INFO|21092/0|Service traccar|18-07-31 06:34:46|	at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:887)
INFO|21092/0|Service traccar|18-07-31 06:34:46|	at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:861)
INFO|21092/0|Service traccar|18-07-31 06:34:46|	at com.mysql.jdbc.ConnectionImpl.connectWithRetries(ConnectionImpl.java:2096)
INFO|21092/0|Service traccar|18-07-31 06:34:46|	at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2021)
FINEST|21092/0|Service traccar|18-07-31 06:34:46|	at com.mysql.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:776)
FINEST|21092/0|Service traccar|18-07-31 06:34:46|	at com.mysql.jdbc.JDBC4Connection.<init>(JDBC4Connection.java:47)
FINEST|21092/0|Service traccar|18-07-31 06:34:46|	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
FINEST|21092/0|Service traccar|18-07-31 06:34:46|	at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
FINEST|21092/0|Service traccar|18-07-31 06:34:46|	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
FINEST|21092/0|Service traccar|18-07-31 06:34:46|	at java.lang.reflect.Constructor.newInstance(Unknown Source)
FINEST|21092/0|Service traccar|18-07-31 06:34:46|	at com.mysql.jdbc.Util.handleNewInstance(Util.java:425)
FINEST|21092/0|Service traccar|18-07-31 06:34:46|	at com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:386)
FINEST|21092/0|Service traccar|18-07-31 06:34:46|	at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:330)
FINEST|21092/0|Service traccar|18-07-31 06:34:46|	at com.zaxxer.hikari.util.DriverDataSource.getConnection(DriverDataSource.java:112)
FINEST|21092/0|Service traccar|18-07-31 06:34:46|	at com.zaxxer.hikari.util.DriverDataSource.getConnection(DriverDataSource.java:118)
FINEST|21092/0|Service traccar|18-07-31 06:34:46|	at com.zaxxer.hikari.pool.PoolBase.newConnection(PoolBase.java:341)
FINEST|21092/0|Service traccar|18-07-31 06:34:46|	at com.zaxxer.hikari.pool.PoolBase.newPoolEntry(PoolBase.java:193)
FINEST|21092/0|Service traccar|18-07-31 06:34:46|	at com.zaxxer.hikari.pool.HikariPool.createPoolEntry(HikariPool.java:428)
FINEST|21092/0|Service traccar|18-07-31 06:34:46|	at com.zaxxer.hikari.pool.HikariPool.checkFailFast(HikariPool.java:499)
FINEST|21092/0|Service traccar|18-07-31 06:34:46|	... 12 more
FINEST|21092/0|Service traccar|18-07-31 06:34:46|Caused by: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure
FINEST|21092/0|Service traccar|18-07-31 06:34:46|
FINEST|21092/0|Service traccar|18-07-31 06:34:46|The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
FINEST|21092/0|Service traccar|18-07-31 06:34:46|	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
FINEST|21092/0|Service traccar|18-07-31 06:34:46|	at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
FINEST|21092/0|Service traccar|18-07-31 06:34:46|	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
FINEST|21092/0|Service traccar|18-07-31 06:34:46|	at java.lang.reflect.Constructor.newInstance(Unknown Source)
FINEST|21092/0|Service traccar|18-07-31 06:34:46|	at com.mysql.jdbc.Util.handleNewInstance(Util.java:425)
FINEST|21092/0|Service traccar|18-07-31 06:34:46|	at com.mysql.jdbc.SQLError.createCommunicationsException(SQLError.java:990)
FINEST|21092/0|Service traccar|18-07-31 06:34:46|	at com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:342)
FINEST|21092/0|Service traccar|18-07-31 06:34:46|	at com.mysql.jdbc.ConnectionImpl.coreConnect(ConnectionImpl.java:2188)
FINEST|21092/0|Service traccar|18-07-31 06:34:46|	at com.mysql.jdbc.ConnectionImpl.connectWithRetries(ConnectionImpl.java:2037)
FINEST|21092/0|Service traccar|18-07-31 06:34:46|	... 28 more
FINEST|21092/0|Service traccar|18-07-31 06:34:46|Caused by: java.net.SocketTimeoutException: connect timed out
FINEST|21092/0|Service traccar|18-07-31 06:34:46|	at java.net.PlainSocketImpl.socketConnect(Native Method)
FINEST|21092/0|Service traccar|18-07-31 06:34:46|	at java.net.AbstractPlainSocketImpl.doConnect(Unknown Source)
FINEST|21092/0|Service traccar|18-07-31 06:34:46|	at java.net.AbstractPlainSocketImpl.connectToAddress(Unknown Source)
FINEST|21092/0|Service traccar|18-07-31 06:34:46|	at java.net.AbstractPlainSocketImpl.connect(Unknown Source)
FINEST|21092/0|Service traccar|18-07-31 06:34:46|	at java.net.SocksSocketImpl.connect(Unknown Source)
FINEST|21092/0|Service traccar|18-07-31 06:34:46|	at java.net.Socket.connect(Unknown Source)
FINEST|21092/0|Service traccar|18-07-31 06:34:46|	at com.mysql.jdbc.StandardSocketFactory.connect(StandardSocketFactory.java:211)
FINEST|21092/0|Service traccar|18-07-31 06:34:46|	at com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:301)
FINEST|21092/0|Service traccar|18-07-31 06:34:46|	... 30 more
INFO|wrapper|Service traccar|18-07-31 06:34:46|waitpid 21092 59136
INFO|wrapper|Service traccar|18-07-31 06:34:46|exit code posix process: 59136 application(status/signal): 231/0

Traccar was running but in logs we are finding this errors.I don't know why its coming

Anton Tananaev6 years ago

It means that there is some issue with database connection. Either network or database issue.

bharat sai kumar6 years ago

Can you please tell me how to resolve that Database connection issue ..iam working from the last 2 days ..but didnt find any solution regarding this
Thanks in advance

Anton Tananaev6 years ago

From the information you provided it's not possible to determine what exactly causing your problem.

bharat sai kumar6 years ago

1)i have centos 8 server and installed java 1.8.0_172
2)then downloaded traccar file and installed in server
3)After that i set traccar.xml with My Database Credentials
4)Started Traccar

is this the right procedure ..or do i need to do anything more other than this

Anton Tananaev6 years ago

Probably your database details are incorrect. Have you verified them with mysql client through network connection?

bharat sai kumar6 years ago

yes verified ..its correct ..i also checked by using database tools and it gives a message Connection was Successfull

bharat sai kumar6 years ago

solved..by reinstalling the traccar and rename the default.xml if you are using all the configuration settings in traccar.xml file

thank you Anton