Looks like localhost is not resolved for some reason. Try 127.0.0.1
instead.
Hello Anton, I tried changing the host to the local IP adress and i'm getting this error now:
Jan 29 08:13:59 ip-172-31-0-242 systemd[1]: Started traccar.
Jan 29 08:14:05 ip-172-31-0-242 traccar[1973]: Exception in thread "main" java.lang.RuntimeException: com.zaxxer.hikari.pool.HikariPool$PoolInitializationException: Failed to initialize pool: Could not create connection to database server. Attempted reconnect 3 times. Giving up.
Jan 29 08:14:05 ip-172-31-0-242 traccar[1973]: #011at org.traccar.Main.run(Main.java:165)
Jan 29 08:14:05 ip-172-31-0-242 traccar[1973]: #011at org.traccar.Main.main(Main.java:110)
Jan 29 08:14:05 ip-172-31-0-242 traccar[1973]: 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.
Jan 29 08:14:05 ip-172-31-0-242 traccar[1973]: #011at com.zaxxer.hikari.pool.HikariPool.throwPoolInitializationException(HikariPool.java:595)
Jan 29 08:14:05 ip-172-31-0-242 traccar[1973]: #011at com.zaxxer.hikari.pool.HikariPool.checkFailFast(HikariPool.java:581)
Jan 29 08:14:05 ip-172-31-0-242 traccar[1973]: #011at com.zaxxer.hikari.pool.HikariPool.<init>(HikariPool.java:115)
Jan 29 08:14:05 ip-172-31-0-242 traccar[1973]: #011at com.zaxxer.hikari.HikariDataSource.<init>(HikariDataSource.java:81)
Jan 29 08:14:05 ip-172-31-0-242 traccar[1973]: #011at org.traccar.database.DataManager.initDatabase(DataManager.java:139)
Jan 29 08:14:05 ip-172-31-0-242 traccar[1973]: #011at org.traccar.database.DataManager.<init>(DataManager.java:89)
Jan 29 08:14:05 ip-172-31-0-242 traccar[1973]: #011at org.traccar.Context.init(Context.java:299)
Jan 29 08:14:05 ip-172-31-0-242 traccar[1973]: #011at org.traccar.Main.run(Main.java:137)
Jan 29 08:14:05 ip-172-31-0-242 traccar[1973]: #011... 1 more
Jan 29 08:14:05 ip-172-31-0-242 traccar[1973]: Caused by: java.sql.SQLNonTransientConnectionException: Could not create connection to database server. Attempted reconnect 3 times. Giving up.
Jan 29 08:14:05 ip-172-31-0-242 traccar[1973]: #011at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:110)
Jan 29 08:14:05 ip-172-31-0-242 traccar[1973]: #011at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:97)
Jan 29 08:14:05 ip-172-31-0-242 traccar[1973]: #011at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:89)
Jan 29 08:14:05 ip-172-31-0-242 traccar[1973]: #011at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:63)
Jan 29 08:14:05 ip-172-31-0-242 traccar[1973]: #011at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:73)
Jan 29 08:14:05 ip-172-31-0-242 traccar[1973]: #011at com.mysql.cj.jdbc.ConnectionImpl.connectWithRetries(ConnectionImpl.java:906)
Jan 29 08:14:05 ip-172-31-0-242 traccar[1973]: #011at com.mysql.cj.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:831)
Jan 29 08:14:05 ip-172-31-0-242 traccar[1973]: #011at com.mysql.cj.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:456)
Jan 29 08:14:05 ip-172-31-0-242 traccar[1973]: #011at com.mysql.cj.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:246)
Jan 29 08:14:05 ip-172-31-0-242 traccar[1973]: #011at com.mysql.cj.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:198)
Jan 29 08:14:05 ip-172-31-0-242 traccar[1973]: #011at com.zaxxer.hikari.util.DriverDataSource.getConnection(DriverDataSource.java:138)
Jan 29 08:14:05 ip-172-31-0-242 traccar[1973]: #011at com.zaxxer.hikari.pool.PoolBase.newConnection(PoolBase.java:358)
Jan 29 08:14:05 ip-172-31-0-242 traccar[1973]: #011at com.zaxxer.hikari.pool.PoolBase.newPoolEntry(PoolBase.java:206)
Jan 29 08:14:05 ip-172-31-0-242 traccar[1973]: #011at com.zaxxer.hikari.pool.HikariPool.createPoolEntry(HikariPool.java:477)
Jan 29 08:14:05 ip-172-31-0-242 traccar[1973]: #011at com.zaxxer.hikari.pool.HikariPool.checkFailFast(HikariPool.java:560)
Jan 29 08:14:05 ip-172-31-0-242 traccar[1973]: #011... 7 more
Jan 29 08:14:05 ip-172-31-0-242 traccar[1973]: Caused by: com.mysql.cj.exceptions.CJCommunicationsException: Communications link failure
Jan 29 08:14:05 ip-172-31-0-242 traccar[1973]: The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
Jan 29 08:14:05 ip-172-31-0-242 traccar[1973]: #011at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
Jan 29 08:14:05 ip-172-31-0-242 traccar[1973]: #011at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
Jan 29 08:14:05 ip-172-31-0-242 traccar[1973]: #011at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
Jan 29 08:14:05 ip-172-31-0-242 traccar[1973]: #011at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:490)
Jan 29 08:14:05 ip-172-31-0-242 traccar[1973]: #011at com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:61)
Jan 29 08:14:05 ip-172-31-0-242 traccar[1973]: #011at com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:105)
Jan 29 08:14:05 ip-172-31-0-242 traccar[1973]: #011at com.mysql.cj.exceptions.ExceptionFactory.createException(ExceptionFactory.java:151)
Jan 29 08:14:05 ip-172-31-0-242 traccar[1973]: #011at com.mysql.cj.exceptions.ExceptionFactory.createCommunicationsException(ExceptionFactory.java:167)
Jan 29 08:14:05 ip-172-31-0-242 traccar[1973]: #011at com.mysql.cj.protocol.a.NativeSocketConnection.connect(NativeSocketConnection.java:89)
Jan 29 08:14:05 ip-172-31-0-242 traccar[1973]: #011at com.mysql.cj.NativeSession.connect(NativeSession.java:144)
Jan 29 08:14:05 ip-172-31-0-242 traccar[1973]: #011at com.mysql.cj.jdbc.ConnectionImpl.connectWithRetries(ConnectionImpl.java:850)
Jan 29 08:14:05 ip-172-31-0-242 traccar[1973]: #011... 16 more
Jan 29 08:14:05 ip-172-31-0-242 traccar[1973]: Caused by: java.net.UnknownHostException: 127.0.0.1:3306: invalid IPv6 address
Jan 29 08:14:05 ip-172-31-0-242 traccar[1973]: #011at java.base/java.net.InetAddress.getAllByName(InetAddress.java:1341)
Jan 29 08:14:05 ip-172-31-0-242 traccar[1973]: #011at java.base/java.net.InetAddress.getAllByName(InetAddress.java:1298)
Jan 29 08:14:05 ip-172-31-0-242 traccar[1973]: #011at com.mysql.cj.protocol.StandardSocketFactory.connect(StandardSocketFactory.java:132)
Jan 29 08:14:05 ip-172-31-0-242 traccar[1973]: #011at com.mysql.cj.protocol.a.NativeSocketConnection.connect(NativeSocketConnection.java:63)
Jan 29 08:14:05 ip-172-31-0-242 traccar[1973]: #011... 18 more
Jan 29 08:14:05 ip-172-31-0-242 systemd[1]: traccar.service: Main process exited, code=exited, status=1/FAILURE
Jan 29 08:14:05 ip-172-31-0-242 systemd[1]: traccar.service: Failed with result 'exit-code'.
^C
It appears to have some issue with connection to a db? I created a db with mysql on the same server instance:
mysql> SHOW DATABASES;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| sys |
| traccar |
+--------------------+
5 rows in set (0.01 sec)
when i enter the Traccar db i get the following:
mysql> use traccar
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
mysql> show tables;
+------------------------+
| Tables_in_traccar |
+------------------------+
| DATABASECHANGELOG |
| DATABASECHANGELOGLOCK |
| tc_attributes |
| tc_calendars |
| tc_commands |
| tc_device_attribute |
| tc_device_command |
| tc_device_driver |
| tc_device_geofence |
| tc_device_maintenance |
| tc_device_notification |
| tc_devices |
| tc_drivers |
| tc_events |
| tc_geofences |
| tc_group_attribute |
| tc_group_command |
| tc_group_driver |
| tc_group_geofence |
| tc_group_maintenance |
| tc_group_notification |
| tc_groups |
| tc_maintenances |
| tc_notifications |
| tc_positions |
| tc_servers |
| tc_statistics |
| tc_user_attribute |
| tc_user_calendar |
| tc_user_command |
| tc_user_device |
| tc_user_driver |
| tc_user_geofence |
| tc_user_group |
| tc_user_maintenance |
| tc_user_notification |
| tc_user_user |
| tc_users |
+------------------------+
38 rows in set (0.00 sec)
show your
traccar.xml
<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE properties SYSTEM 'http://java.sun.com/dtd/properties.dtd'>
<properties>
<entry key='config.default'>./conf/default.xml</entry>
<!--
This is the main configuration file. All your configuration parameters should be placed in this file.
Default configuration parameters are located in the "default.xml" file. You should not modify it to avoid issues
with upgrading to a new version. Parameters in the main config file override values in the default file. Do not
remove "config.default" parameter from this file unless you know what you are doing.
For list of available parameters see following page: https://www.traccar.org/configuration-file/
-->
<entry key='database.driver'>com.mysql.cj.jdbc.Driver</entry>
<entry key='database.url'>jdbc:mysql://127.0.0.1:36:/traccar?serverTimezone=UTC&useSSL=false&allowMultiQueries=true&autoReconnect=true&useUnicode=yes&characterEncoding=UTF-8&sessionVariables=sql_mode=''</>
<entry key='database.user'>root</entry>
<entry key='database.password'>root</entry>
</properties>
jdbc:mysql://127.0.0.1:36:/
?
try this
<entry key='database.url'>jdbc:mysql://127.0.0.1:3306/traccar?serverTimezone=UTC&useSSL=false&allowMultiQueries=true&autoReconnect=true&useUnicode=yes&characterEncoding=UTF-8&sessionVariables=sql_mode=''</entry>
I changed the port from 3306 to 36 because my SQL dev preconfigured this port. I changed it after i posted about this error in my previous post, so issue remainded with port 3306
if now is 3306 ?
use this
<entry key='database.url'>jdbc:mysql://127.0.0.1:3306/traccar?serverTimezone=UTC&useSSL=false&allowMultiQueries=true&autoReconnect=true&useUnicode=yes&characterEncoding=UTF-8&sessionVariables=sql_mode=''</entry>
@Slawek, I changed port back to 3306 in the .xml just in case this could be the issue but the result in log is still the same. Appreciate your eye for detail :)
copy my line and put in your config file then restart service
then show log
When i put in your line @Slawek i get the following:
Jan 29 09:17:31 ip-172-31-0-242 systemd[1]: Started traccar.
Jan 29 09:17:31 ip-172-31-0-242 traccar[12657]: 2021-01-29 09:17:31 ERROR: Main method error - - SAXParseException (... < Config:37 < Context:276 < Main:137 < ...)
Jan 29 09:17:31 ip-172-31-0-242 traccar[12657]: Exception in thread "main" java.lang.RuntimeException: java.lang.RuntimeException: Configuration file is not a valid XML document
Jan 29 09:17:31 ip-172-31-0-242 traccar[12657]: #011at org.traccar.Main.run(Main.java:165)
Jan 29 09:17:31 ip-172-31-0-242 traccar[12657]: #011at org.traccar.Main.main(Main.java:110)
Jan 29 09:17:31 ip-172-31-0-242 traccar[12657]: Caused by: java.lang.RuntimeException: Configuration file is not a valid XML document
Jan 29 09:17:31 ip-172-31-0-242 traccar[12657]: #011at org.traccar.config.Config.<init>(Config.java:52)
Jan 29 09:17:31 ip-172-31-0-242 traccar[12657]: #011at org.traccar.Context.init(Context.java:276)
Jan 29 09:17:31 ip-172-31-0-242 traccar[12657]: #011at org.traccar.Main.run(Main.java:137)
Jan 29 09:17:31 ip-172-31-0-242 traccar[12657]: #011... 1 more
Jan 29 09:17:31 ip-172-31-0-242 traccar[12657]: Caused by: java.util.InvalidPropertiesFormatException: jdk.internal.org.xml.sax.SAXParseException;
Jan 29 09:17:31 ip-172-31-0-242 traccar[12657]: #011at java.base/jdk.internal.util.xml.PropertiesDefaultHandler.load(PropertiesDefaultHandler.java:85)
Jan 29 09:17:31 ip-172-31-0-242 traccar[12657]: #011at java.base/java.util.Properties.loadFromXML(Properties.java:983)
Jan 29 09:17:31 ip-172-31-0-242 traccar[12657]: #011at org.traccar.config.Config.<init>(Config.java:37)
Jan 29 09:17:31 ip-172-31-0-242 traccar[12657]: #011... 3 more
Jan 29 09:17:31 ip-172-31-0-242 traccar[12657]: Caused by: jdk.internal.org.xml.sax.SAXParseException;
Jan 29 09:17:31 ip-172-31-0-242 traccar[12657]: #011at java.base/jdk.internal.util.xml.impl.ParserSAX.panic(ParserSAX.java:652)
Jan 29 09:17:31 ip-172-31-0-242 traccar[12657]: #011at java.base/jdk.internal.util.xml.impl.Parser.ent(Parser.java:1981)
Jan 29 09:17:31 ip-172-31-0-242 traccar[12657]: #011at java.base/jdk.internal.util.xml.impl.Parser.step(Parser.java:466)
Jan 29 09:17:31 ip-172-31-0-242 traccar[12657]: #011at java.base/jdk.internal.util.xml.impl.ParserSAX.parse(ParserSAX.java:477)
Jan 29 09:17:31 ip-172-31-0-242 traccar[12657]: #011at java.base/jdk.internal.util.xml.impl.ParserSAX.parse(ParserSAX.java:411)
Jan 29 09:17:31 ip-172-31-0-242 traccar[12657]: #011at java.base/jdk.internal.util.xml.impl.ParserSAX.parse(ParserSAX.java:374)
Jan 29 09:17:31 ip-172-31-0-242 traccar[12657]: #011at java.base/jdk.internal.util.xml.impl.SAXParserImpl.parse(SAXParserImpl.java:97)
Jan 29 09:17:31 ip-172-31-0-242 traccar[12657]: #011at java.base/jdk.internal.util.xml.PropertiesDefaultHandler.load(PropertiesDefaultHandler.java:83)
Jan 29 09:17:31 ip-172-31-0-242 traccar[12657]: #011... 5 more
Jan 29 09:17:31 ip-172-31-0-242 systemd[1]: traccar.service: Main process exited, code=exited, status=1/FAILURE
Jan 29 09:17:31 ip-172-31-0-242 systemd[1]: traccar.service: Failed with result 'exit-code'.
download this config change only user and pass if need, swich with your config file then testart service and show log
https://mega.nz/file/X5tXxYpY#InzAMy_6Q1E9GyXhSBYBljFNuEVSqSLn-x090LxHiM4
Jan 29 09:26:37 ip-172-31-0-242 systemd[1]: Started traccar.
Jan 29 09:26:43 ip-172-31-0-242 traccar[14367]: WARNING: An illegal reflective access operation has occurred
Jan 29 09:26:43 ip-172-31-0-242 traccar[14367]: WARNING: Illegal reflective access by com.google.inject.internal.cglib.core.$ReflectUtils$1 (file:/opt/traccar/lib/guice-4.2.3.jar) to method java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int,java.security.ProtectionDomain)
Jan 29 09:26:43 ip-172-31-0-242 traccar[14367]: WARNING: Please consider reporting this to the maintainers of com.google.inject.internal.cglib.core.$ReflectUtils$1
Jan 29 09:26:43 ip-172-31-0-242 traccar[14367]: WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
Jan 29 09:26:43 ip-172-31-0-242 traccar[14367]: WARNING: All illegal access operations will be denied in a future release
Jan 29 09:27:28 ip-172-31-0-242 systemd[1]: Stopping traccar...
Jan 29 09:27:29 ip-172-31-0-242 systemd[1]: traccar.service: Succeeded.
Jan 29 09:27:29 ip-172-31-0-242 systemd[1]: Stopped traccar.
Jan 29 09:27:29 ip-172-31-0-242 systemd[1]: Started traccar.
Jan 29 09:27:34 ip-172-31-0-242 traccar[14455]: WARNING: An illegal reflective access operation has occurred
Jan 29 09:27:34 ip-172-31-0-242 traccar[14455]: WARNING: Illegal reflective access by com.google.inject.internal.cglib.core.$ReflectUtils$1 (file:/opt/traccar/lib/guice-4.2.3.jar) to method java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int,java.security.ProtectionDomain)
Jan 29 09:27:34 ip-172-31-0-242 traccar[14455]: WARNING: Please consider reporting this to the maintainers of com.google.inject.internal.cglib.core.$ReflectUtils$1
Jan 29 09:27:34 ip-172-31-0-242 traccar[14455]: WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
Jan 29 09:27:34 ip-172-31-0-242 traccar[14455]: WARNING: All illegal access operations will be denied in a future release
sudo systemctl status traccar.service
Hello,
I'm trying to run Traccar on EC2 instance with Ubuntu. When i try to start the instance i get this error: