traccar / traccar

Traccar GPS Tracking System
https://www.traccar.org
Apache License 2.0
5.17k stars 2.57k forks source link

error - NullPointerException (... #2221

Closed mm108 closed 2 years ago

mm108 commented 8 years ago

I keep seeing the below error messages in my log file. My version is 3.6 running on Ubuntu 14 LTS. ANy pointers? Thanks a lot

2016-08-16 12:43:43 DEBUG: [7976E230: 5023 > 192.168.255.37] HEX: 78780512000281b60d0a
2016-08-16 12:43:43  WARN: NullPointerException (... < DefaultDataHandler:29 < BaseDataHandler:29 < ... < ExtendedObjectDecoder:60 < ...)
2016-08-16 12:43:43  INFO: [7976E230] id: 358511020964577, time: 2016-08-16 20:43:28, lat: 1.25635, lon: 103.61443, speed: 42.1, course: 178.0
2016-08-16 12:43:43  WARN: [7976E230] error - NullPointerException (... < MainEventHandler:59 < ... < ExtendedObjectDecoder:60 < ... < *:73 < ...)
2016-08-16 12:43:43  INFO: [7976E230] disconnected

I can notice that one of the devices keep showing as offline / online continously in the web login. The above error could be the reason? It keeps going offline and coming back every 20-30 seconds.

tananaev commented 8 years ago

Are you sure you are using original version 3.6?

tananaev commented 8 years ago

Try this build:

https://www.dropbox.com/s/cgmlansv32j3ii0/tracker-server.jar?dl=0

mm108 commented 8 years ago

Yes I had downloaded 3.6 from the official traccar download page. I updated the jar file with the one you just gave. There is an error that i see in the log file

2016-08-16 13:53:10  WARN: You need to set exactly 4 parameters on the prepared statement
Query is : UPDATE devices SET status = 'online', lastUpdate = '2016-08-16 13:53:10.59', motion = null WHERE id = 6; - SQLException (... < QueryBuilder:443 < DataManager:220 < DeviceManager:177 < ...)

Thanks, M.M

tananaev commented 8 years ago

Try to remove motion from SQL queries in the config.

mm108 commented 8 years ago

done...updated with the jar file you just gave. Still see the below error in the log file...and one of the devices keep going offline and online

2016-08-16 14:04:05  WARN: [BDCD7B8D] error - NullPointerException (WebDataHandler:103 < *:140 < BaseDataHandler:29 < ... < ExtendedObjectDecoder:61 < ...)
2016-08-16 14:04:05  INFO: [BDCD7B8D] disconnected

Thanks, M.M

Abyss777 commented 8 years ago

@m-menon please check if that problem device have valid fixTime at last position

mm108 commented 8 years ago

hmmm.. I have 6 devices all set up the same way - It's GT06 protocol and I keep seeing the below in my log file

2016-08-17 00:00:11 DEBUG: [F9D6EA9B: 5023 > 192.168.255.37] HEX: 78780513000c32140d0a
2016-08-17 00:00:11  WARN: [F9D6EA9B] error - NullPointerException (WebDataHandler:103 < *:140 < BaseDataHandler:29 < ... < ExtendedObjectDecoder:61 < ...)
2016-08-17 00:00:11  INFO: [F9D6EA9B] disconnected

2016-08-17 17:54:07 DEBUG: [1CDA8E15: 5023 > 192.168.255.37] HEX: 78780513002a76200d0a
2016-08-17 17:54:07  WARN: [1CDA8E15] error - NullPointerException

I probably have to run some port sniffer / monitor to check what data is causing this link I guess?

tananaev commented 8 years ago

I think what happened is that for some reason you've got last position with no timestamp, so now every time you get this error. Try to find it in the database and remove link to that position record.

mm108 commented 8 years ago

As mine happened to be a testing system, I went ahead to delete all the records in the positions table. But I can still see the below in the log file

2016-08-18 17:45:35 DEBUG: [431644E0: 5023 > 192.168.255.37] HEX: 7878051300069d4e0d0a
2016-08-18 17:45:35  WARN: [431644E0] error - NullPointerException (WebDataHandler:103 < *:140 < BaseDataHandler:29 < ... < ExtendedObjectDecoder:61 < ...)
2016-08-18 17:45:35  INFO: [431644E0] disconnected

Thanks, M.M

tananaev commented 8 years ago

You have to set positionId to NULL in devices table. Also, don't forget to restart the service.

mm108 commented 8 years ago

hmmm done that and I no longer see that error message in the log file! Thanks @tananaev and @Abyss777 :+1:

mm108 commented 8 years ago

hmmm...now a similar error started appearing in the log files. I had absolutely not changed any devices settings after I earlier cleared the positions table and set th positionId to NULL in devices table. Today I suddenly saw the below error appear again

2016-08-21 08:55:23 DEBUG: [D186EA22: 5023 > 192.168.255.37] HEX: 78780512000a0dfe0d0a
2016-08-21 08:55:23  WARN: [D186EA22] error - NullPointerException
2016-08-21 08:55:23  INFO: [D186EA22] disconnected
tananaev commented 8 years ago

Are you sure there are no error before that? I think what's happening is that you have some message without GPS info, so you get old time and date and it's not saved properly. Are you using MySQL database by any chance?

mm108 commented 8 years ago

Yes I am pretty sure that it wasn't happening before. I totally wiped out the data in positions table, then set the positionId to NULLin the devices table. But it keeps coming back. Yes I am using MySQL

tananaev commented 8 years ago

I remember there was a problem with MySQL because it doesn't support 0 timestamp (which is actually a valid time). Not sure what can be done about it other than just ignoring those messages.

mm108 commented 8 years ago

I just installed / switched to MariaDB, and removed zeroDateTimeBehavior=convertToNull&amp; from the database.url

So far seems to be ok. Let me monitor, thanks a lot

mm108 commented 8 years ago

There's this line i noticed in the config params documentation: gt06.timezone Timezone offset value (in seconds) for GT06 protocol.

What does that do? Say I am in Hong Kong and its GMT +8 so I would multiply 8 x 60 x 60 and put the number there? Like this? <entry key='gt06.timezone'>28800</entry>

Thanks

tananaev commented 8 years ago

Some GT06 messages don't include GPS and time info, so Traccar appends previous data for those types of messages. If previous doesn't exist, then it appends zeroes.

hackerunet commented 6 years ago

hello it's been awhile, I'm trying to fix this in my receptor but I don't use devices table or traccar default tables, so I'm trying to forward the packets to a restfull api, but my error is like this, is almos the same:

2018-08-23 04:24:34 DEBUG: [84DE6829: 6002 < 190.96.167.235] HEX: 696d65693a3135313731373132302c3030312c303830393233313932392c31333535343930303630312c462c3035353430332e3030302c412c323233332e313837302c4e2c31313335342e333036372c452c302e30302c33302e312c36352e34332c312c302c31302e35252c302e30252c32383b0a
2018-08-23 04:24:34  INFO: [84DE6829] disconnected
2018-08-23 04:24:34  WARN: [84DE6829] error - NullPointerException (... < WebDataHandler:81 < *:124 < BaseDataHandler:29 < ... < ExtendedObjectDecoder:61 < ...)