Devices table include a link (positionId) to the latest position for the device.
In mysql shell where I call SELECT * FROM devices; I see NULL value for positionid. This is kinda strange because I see correct position in web-app ...
It probably means that something is broken. Have you checked logs for errors and warnings?
FINEST|23898/0|Service traccar|17-05-11 13:40:54|[qtp916842649-98] WARN org.eclipse.jetty.servlet.ServletHandler - /api/socket
FINEST|23898/0|Service traccar|17-05-11 13:40:54|java.lang.NullPointerException
FINEST|23898/0|Service traccar|17-05-11 13:40:54| at org.traccar.api.AsyncSocketServlet$1.createWebSocket(AsyncSocketServlet.java:37)
FINEST|23898/0|Service traccar|17-05-11 13:40:54| at org.eclipse.jetty.websocket.server.WebSocketServerFactory.acceptWebSocket(WebSocketServerFactory.java:166)
FINEST|23898/0|Service traccar|17-05-11 13:40:54| at org.eclipse.jetty.websocket.server.WebSocketServerFactory.acceptWebSocket(WebSocketServerFactory.java:153)
FINEST|23898/0|Service traccar|17-05-11 13:40:54| at org.eclipse.jetty.websocket.servlet.WebSocketServlet.service(WebSocketServlet.java:151)
FINEST|23898/0|Service traccar|17-05-11 13:40:54| at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
FINEST|23898/0|Service traccar|17-05-11 13:40:54| at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:812)
FINEST|23898/0|Service traccar|17-05-11 13:40:54| at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:587)
FINEST|23898/0|Service traccar|17-05-11 13:40:54| at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:221)
FINEST|23898/0|Service traccar|17-05-11 13:40:54| at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1127)
FINEST|23898/0|Service traccar|17-05-11 13:40:54| at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:515)
FINEST|23898/0|Service traccar|17-05-11 13:40:54| at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:185)
FINEST|23898/0|Service traccar|17-05-11 13:40:54| at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1061)
FINEST|23898/0|Service traccar|17-05-11 13:40:54| at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
FINEST|23898/0|Service traccar|17-05-11 13:40:54| at org.eclipse.jetty.server.handler.HandlerList.handle(HandlerList.java:52)
FINEST|23898/0|Service traccar|17-05-11 13:40:54| at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:97)
FINEST|23898/0|Service traccar|17-05-11 13:40:54| at org.eclipse.jetty.server.Server.handle(Server.java:499)
FINEST|23898/0|Service traccar|17-05-11 13:40:54| at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:311)
FINEST|23898/0|Service traccar|17-05-11 13:40:54| at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:258)
FINEST|23898/0|Service traccar|17-05-11 13:40:54| at org.eclipse.jetty.io.AbstractConnection$2.run(AbstractConnection.java:544)
FINEST|23898/0|Service traccar|17-05-11 13:40:54| at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:635)
In wrapper.log i see this kind of warnings .
This might be important. Today I switched from H2 db to mysql.
Schema build log:
FINEST|23898/0|Service traccar|17-05-11 12:38:10|INFO 5/11/17 12:38 PM: liquibase: ./schema/changelog-master.xml: changelog-3.10::changelog-3.10::author: Foreign key constraint added to user_user (userid)
FINEST|23898/0|Service traccar|17-05-11 12:38:10|INFO 5/11/17 12:38 PM: liquibase: ./schema/changelog-master.xml: changelog-3.10::changelog-3.10::author: Data updated in users
FINEST|23898/0|Service traccar|17-05-11 12:38:10|INFO 5/11/17 12:38 PM: liquibase: ./schema/changelog-master.xml: changelog-3.10::changelog-3.10::author: Default value dropped from users.devicelimit
FINEST|23898/0|Service traccar|17-05-11 12:38:10|INFO 5/11/17 12:38 PM: liquibase: ./schema/changelog-master.xml: changelog-3.10::changelog-3.10::author: Default value added to users.devicelimit
FINEST|23898/0|Service traccar|17-05-11 12:38:10|INFO 5/11/17 12:38 PM: liquibase: ./schema/changelog-master.xml: changelog-3.10::changelog-3.10::author: Columns devicereadonly(BOOLEAN) added to users
FINEST|23898/0|Service traccar|17-05-11 12:38:10|INFO 5/11/17 12:38 PM: liquibase: ./schema/changelog-master.xml: changelog-3.10::changelog-3.10::author: ChangeSet changelog-3.10::changelog-3.10::author $
FINEST|23898/0|Service traccar|17-05-11 12:38:10|INFO 5/11/17 12:38 PM: liquibase: ./schema/changelog-master.xml: changelog-3.10::changelog-3.10-notmssql::author: Foreign key constraint added to user_use$
FINEST|23898/0|Service traccar|17-05-11 12:38:10|INFO 5/11/17 12:38 PM: liquibase: ./schema/changelog-master.xml: changelog-3.10::changelog-3.10-notmssql::author: ChangeSet changelog-3.10::changelog-3.10$
FINEST|23898/0|Service traccar|17-05-11 12:38:10|INFO 5/11/17 12:38 PM: liquibase: ./schema/changelog-master.xml: changelog-3.10::changelog-3.10-mssql::author: Marking ChangeSet: changelog-3.10::changelo$
FINEST|23898/0|Service traccar|17-05-11 12:38:10| ./schema/changelog-master.xml : DBMS Precondition failed: expected mssql, got mysql
FINEST|23898/0|Service traccar|17-05-11 12:38:10|
FINEST|23898/0|Service traccar|17-05-11 12:38:10|INFO 5/11/17 12:38 PM: liquibase: ./schema/changelog-master.xml: changelog-3.10::changelog-3.7-mssql::author: Marking ChangeSet: changelog-3.10::changelog$
FINEST|23898/0|Service traccar|17-05-11 12:38:10| ./schema/changelog-master.xml : DBMS Precondition failed: expected mssql, got mysql
FINEST|23898/0|Service traccar|17-05-11 12:38:10|
FINEST|23898/0|Service traccar|17-05-11 12:38:10|INFO 5/11/17 12:38 PM: liquibase: Successfully released change log lock
FINEST|23898/0|Service traccar|17-05-11 12:38:10|[main] INFO org.eclipse.jetty.util.log - Logging initialized @2462ms
FINEST|23898/0|Service traccar|17-05-11 12:38:11|[main] INFO org.eclipse.jetty.server.Server - jetty-9.2.21.v20170120
FINEST|23898/0|Service traccar|17-05-11 12:38:11|[main] INFO org.eclipse.jetty.server.handler.ContextHandler - Started o.e.j.s.ServletContextHandler@626e8fd6{/api,null,AVAILABLE}
FINEST|23898/0|Service traccar|17-05-11 12:38:11|[main] INFO org.eclipse.jetty.server.ServerConnector - Started ServerConnector@1742114b{HTTP/1.1}{0.0.0.0:8082}
FINEST|23898/0|Service traccar|17-05-11 12:38:11|[main] INFO org.eclipse.jetty.server.Server - Started @3397ms
FINEST|23898/0|Service traccar|17-05-11 12:39:54|[qtp916842649-87] WARN org.eclipse.jetty.servlet.ServletHandler - /api/socket
FINEST|23898/0|Service traccar|17-05-11 12:39:54|java.lang.NullPointerException
FINEST|23898/0|Service traccar|17-05-11 12:39:54| at org.traccar.api.AsyncSocketServlet$1.createWebSocket(AsyncSocketServlet.java:37)
FINEST|23898/0|Service traccar|17-05-11 12:39:54| at org.eclipse.jetty.websocket.server.WebSocketServerFactory.acceptWebSocket(WebSocketServerFactory.java:166)
FINEST|23898/0|Service traccar|17-05-11 12:39:54| at org.eclipse.jetty.websocket.server.WebSocketServerFactory.acceptWebSocket(WebSocketServerFactory.java:153)
FINEST|23898/0|Service traccar|17-05-11 12:39:54| at org.eclipse.jetty.websocket.servlet.WebSocketServlet.service(WebSocketServlet.java:151)
FINEST|23898/0|Service traccar|17-05-11 12:39:54| at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
FINEST|23898/0|Service traccar|17-05-11 12:39:54| at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:812)
FINEST|23898/0|Service traccar|17-05-11 12:39:54| at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:587)
FINEST|23898/0|Service traccar|17-05-11 12:39:54| at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:221)
FINEST|23898/0|Service traccar|17-05-11 12:39:54| at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1127)
FINEST|23898/0|Service traccar|17-05-11 12:39:54| at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:515)
FINEST|23898/0|Service traccar|17-05-11 12:39:54| at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:185)
FINEST|23898/0|Service traccar|17-05-11 12:39:54| at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1061)
FINEST|23898/0|Service traccar|17-05-11 12:39:54| at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
FINEST|23898/0|Service traccar|17-05-11 12:39:54| at org.eclipse.jetty.server.handler.HandlerList.handle(HandlerList.java:52)
FINEST|23898/0|Service traccar|17-05-11 12:39:54| at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:97)
FINEST|23898/0|Service traccar|17-05-11 12:39:54| at org.eclipse.jetty.server.Server.handle(Server.java:499)
FINEST|23898/0|Service traccar|17-05-11 12:39:54| at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:311)
FINEST|23898/0|Service traccar|17-05-11 12:39:54| at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:258)
FINEST|23898/0|Service traccar|17-05-11 12:39:54| at org.eclipse.jetty.io.AbstractConnection$2.run(AbstractConnection.java:544)
FINEST|23898/0|Service traccar|17-05-11 12:39:54| at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:635)
FINEST|23898/0|Service traccar|17-05-11 12:39:54| at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:555)
FINEST|23898/0|Service traccar|17-05-11 12:39:54| at java.lang.Thread.run(Thread.java:745)
That's a wrong log file. You should be checking tracker-server.log.
2017-05-11 12:52:13 WARN: Incorrect string value: '\xC5\x82aw, ...' for column 'address' at row 1 - SQLException (... < QueryBuilder:473 < DataManager:296 < DefaultDataHandler:27 < ...)
2017-05-11 12:52:13 INFO: [42C591EC] id: 33534, time: 2017-05-11 12:50:33, lat: 51.06434, lon: 17.03171, speed: 0.0, course: 0.0
2017-05-11 12:57:17 DEBUG: [42C591EC: 5084 < 37.47.128.137] HEX: b50086e0000082fe7f591443254637600b8c1c8798005a04414d4a9902030000000405000a021c00070200000a08ffffffffffffffff1401ff1501ff1601ff1701ff6304ff$
2017-05-11 12:57:17 DEBUG: [42C591EC: 5084 > 37.47.128.137] HEX: 5e3238
2017-05-11 12:57:17 WARN: Incorrect string value: '\xC5\x82aw, ...' for column 'address' at row 1 - SQLException (... < QueryBuilder:473 < DataManager:296 < DefaultDataHandler:27 < ...)
2017-05-11 12:57:17 INFO: [42C591EC] id: 33534, time: 2017-05-11 12:55:33, lat: 51.06434, lon: 17.03171, speed: 0.0, course: 0.0
2017-05-11 13:02:20 DEBUG: [42C591EC: 5084 < 37.47.128.137] HEX: b50086e8000082fe7f591444510237600b8c1c8898005a04414d4a9902030000000405000a021c00070200000a08ffffffffffffffff1401ff1501ff1601ff1701ff6304ff$
2017-05-11 13:02:20 DEBUG: [42C591EC: 5084 > 37.47.128.137] HEX: 5e3239
2017-05-11 13:02:20 WARN: Incorrect string value: '\xC5\x82aw, ...' for column 'address' at row 1 - SQLException (... < QueryBuilder:473 < DataManager:296 < DefaultDataHandler:27 < ...)
2017-05-11 13:02:20 INFO: [42C591EC] id: 33534, time: 2017-05-11 13:00:33, lat: 51.06434, lon: 17.03173, speed: 0.0, course: 0.0
2017-05-11 13:07:24 DEBUG: [42C591EC: 5084 < 37.47.128.137] HEX: b50086f0000082fe7f5914457e0237600c8c1c8798005a04414d4a9902030000000405000a021c00070200000a08ffffffffffffffff1401ff1501ff1601ff1701ff6304ff$
2017-05-11 13:07:24 DEBUG: [42C591EC: 5084 > 37.47.128.137] HEX: 5e3330
2017-05-11 13:07:25 WARN: Incorrect string value: '\xC5\x82aw, ...' for column 'address' at row 1 - SQLException (... < QueryBuilder:473 < DataManager:296 < DefaultDataHandler:27 < ...)
2017-05-11 13:07:25 INFO: [42C591EC] id: 33534, time: 2017-05-11 13:05:34, lat: 51.06432, lon: 17.03171, speed: 0.0, course: 0.0
2017-05-11 13:12:29 DEBUG: [42C591EC: 5084 < 37.47.128.137] HEX: b50086f8000082fe7f591446aa023760088c1c8698005a04414d4a9902030000000405000a021c00070200000a08ffffffffffffffff1401ff1501ff1601ff1701ff6304ff$
2017-05-11 13:12:29 DEBUG: [42C591EC: 5084 > 37.47.128.137] HEX: 5e3331
2017-05-11 13:12:29 WARN: Incorrect string value: '\xC5\x82aw, ...' for column 'address' at row 1 - SQLException (... < QueryBuilder:473 < DataManager:296 < DefaultDataHandler:27 < ...)
2017-05-11 13:12:29 INFO: [42C591EC] id: 33534, time: 2017-05-11 13:10:34, lat: 51.06437, lon: 17.03168, speed: 0.0, course: 0.0
2017-05-11 13:17:33 DEBUG: [42C591EC: 5084 < 37.47.128.137] HEX: b5008600000082fe7f591447d6463760088c1c8698005a04414d4a9902030000000405000a021c00070200000a08ffffffffffffffff1401ff1501ff1601ff1701ff6304ff$
2017-05-11 13:17:33 DEBUG: [42C591EC: 5084 > 37.47.128.137] HEX: 5e30
2017-05-11 13:17:33 WARN: Incorrect string value: '\xC5\x82aw, ...' for column 'address' at row 1 - SQLException (... < QueryBuilder:473 < DataManager:296 < DefaultDataHandler:27 < ...)
2017-05-11 13:17:33 INFO: [42C591EC] id: 33534, time: 2017-05-11 13:15:34, lat: 51.06437, lon: 17.03168, speed: 0.0, course: 0.0
2017-05-11 13:22:36 DEBUG: [42C591EC: 5084 < 37.47.128.137] HEX: b5008608000082fe7f591449034237600e8c1c8998005a04414cd49502030000000405000a021c00070200000a08ffffffffffffffff1401ff1501ff1601ff1701ff6304ff$
2017-05-11 13:22:36 DEBUG: [42C591EC: 5084 > 37.47.128.137] HEX: 5e31
2017-05-11 13:22:37 WARN: Incorrect string value: '\xC5\x82aw, ...' for column 'address' at row 1 - SQLException (... < QueryBuilder:473 < DataManager:296 < DefaultDataHandler:27 < ...)
2017-05-11 13:22:37 INFO: [42C591EC] id: 33534, time: 2017-05-11 13:20:35, lat: 51.06430, lon: 17.03175, speed: 0.0, course: 0.0
2017-05-11 13:27:40 DEBUG: [42C591EC: 5084 < 37.47.128.137] HEX: b5008610000082fe7f59144a2f0237600b8c1c8798005a04414d4a9902030000000405000a021c00070200000a08ffffffffffffffff1401ff1501ff1601ff1701ff6304ff$
2017-05-11 13:27:40 DEBUG: [42C591EC: 5084 > 37.47.128.137] HEX: 5e32
2017-05-11 13:27:41 WARN: Incorrect string value: '\xC5\x82aw, ...' for column 'address' at row 1 - SQLException (... < QueryBuilder:473 < DataManager:296 < DefaultDataHandler:27 < ...)
2017-05-11 13:27:41 INFO: [42C591EC] id: 33534, time: 2017-05-11 13:25:35, lat: 51.06434, lon: 17.03171, speed: 0.0, course: 0.0
There was no warnings like this on H2 db . Im using tytan protocole device.
The problem seems to be with address field encoding. You should check your database settings.
Is something wrong with my positions table settings ?
mysql> DESCRIBE positions;
+------------+---------------+------+-----+---------------------+-----------------------------+
| Field | Type | Null | Key | Default | Extra |
+------------+---------------+------+-----+---------------------+-----------------------------+
| id | int(11) | NO | PRI | NULL | auto_increment |
| protocol | varchar(128) | YES | | NULL | |
| deviceid | int(11) | NO | MUL | NULL | |
| servertime | timestamp | NO | | CURRENT_TIMESTAMP | on update CURRENT_TIMESTAMP |
| devicetime | timestamp | NO | | 0000-00-00 00:00:00 | |
| fixtime | timestamp | NO | | 0000-00-00 00:00:00 | |
| valid | bit(1) | NO | | NULL | |
| latitude | double | NO | | NULL | |
| longitude | double | NO | | NULL | |
| altitude | float | NO | | NULL | |
| speed | float | NO | | NULL | |
| course | float | NO | | NULL | |
| address | varchar(512) | YES | | NULL | |
| attributes | varchar(4000) | YES | | NULL | |
| accuracy | double | NO | | 0 | |
| network | varchar(4000) | YES | | NULL | |
+------------+---------------+------+-----+---------------------+-----------------------------+
Ok guys, found solution in this topic:
https://www.traccar.org/forums/topic/mysql-error-change/page/2/
You need to change character encoding for address field.
ALTER TABLE positions
CHANGE address address VARCHAR(512) CHARSET utf8mb4 COLLATE utf8mb4_general_ci NULL;
Problem was caused by polish letters in address field like: ó, ł, ś, ż, ź. Probably gonna help all polish users :).
Thx a lot.
Hi
Could you help me where I can find current location of my device in SQL Database ? I'm talking about last longitude and latitude data ?