Forward URL null pointer exception, using custom queries

hackerunet6 years ago

Hello, I have a problem with forward url enable, I receive this:

2018-08-25 06:24:18 DEBUG: [3EC6709D: 6002 < 197.210.54.4] HEX: 696d65693a3836343138303033353330333836312c747261636b65722c3138303832353132313935352c2c462c3034313935312e3030302c412c303930382e383338342c4e2c30303731382e333931302c452c312e34322c3334372e39343b
2018-08-25 06:24:18  WARN: [3EC6709D] error - NullPointerException (... < WebDataHandler:81 < *:124 < BaseDataHandler:29 < ... < ExtendedObjectDecoder:61 < ...)

So i think I might be missing a query or something stored in the database, so I'm wondering which are the default conditions for forward url to work, does it need some sort of default data in the database in order to work?
This is my default.xml, I'm not using a lot of features from traccar, so this are the queries I'm not filling:

2018-08-25 06:32:35  INFO: Version: 3.12-SNAPSHOT
2018-08-25 06:32:39  INFO: Query not provided: database.selectUserPermissions
2018-08-25 06:32:39  INFO: Query not provided: database.selectGeofencesAll
2018-08-25 06:32:39  INFO: Query not provided: database.selectGeofencePermissions
2018-08-25 06:32:39  INFO: Query not provided: database.selectGroupGeofences
2018-08-25 06:32:39  INFO: Query not provided: database.selectDeviceGeofences
2018-08-25 06:32:39  INFO: Query not provided: database.selectCalendarsAll
2018-08-25 06:32:39  INFO: Query not provided: database.selectCalendarPermissions
2018-08-25 06:32:39  INFO: Query not provided: database.selectNotifications
2018-08-25 06:32:39  INFO: Query not provided: database.selectAttributePermissions
2018-08-25 06:32:39  INFO: Query not provided: database.selectGroupAttributes
<?xml version='1.0' encoding='UTF-8'?>

<!DOCTYPE properties SYSTEM 'http://java.sun.com/dtd/properties.dtd'>

<properties>

    <!-- SERVER CONFIG -->

    <entry key='web.enable'>false</entry>
    <entry key='web.port'>8082</entry>
    <entry key='web.path'>./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'>./logs/tracker-server.log</entry>

    <entry key='event.enable'>true</entry>
    <entry key='event.overspeedHandler'>true</entry>
    <entry key='event.overspeed.notRepeat'>true</entry>
    <entry key='event.motionHandler'>true</entry>
    <entry key='event.geofenceHandler'>false</entry>
    <entry key='event.alertHandler'>false</entry>
    <entry key='event.ignitionHandler'>true</entry>

    <entry key='filter.enable'>false</entry>
    <entry key='filter.zero'>false</entry>
    <entry key='forward.enable'>true</entry>
    <entry key='forward.url'>http://{thisis the url}/?id={uniqueId}&amp;deviceId={deviceId}&amp;valid={valid}&amp;fixTime={fixTime}&amp;deviceTime={deviceTime}&amp;protocol={protocol}&amp;name={name}&amp;latitude={latitude}&amp;longitude={longitude}&amp;altitude={altitude}&amp;speed={speed}&amp;course={course}&amp;statusCode={statusCode}&amp;address={address}&amp;gprmc={gprmc}&amp;attributes={attributes}</entry>
    <entry key='forward.json'>true</entry>

    <!-- DATABASE CONFIG -->

    <entry key='database.ignoreUnknown'>false</entry>

    <entry key='database.selectServers'>
        SELECT * FROM server
    </entry>

    <entry key='database.updateServer'>
        UPDATE server SET
        registration = :registration,
        readonly = :readonly,
        map = :map,
        bingKey = :bingKey,
        mapUrl = :mapUrl,
        distanceUnit = :distanceUnit,
        speedUnit = :speedUnit,
        latitude = :latitude,
        longitude = :longitude,
        zoom = :zoom,
        twelveHourFormat = :twelveHourFormat,
        attributes = :attributes
        WHERE id = :id
    </entry>

    <entry key='database.loginUser'>
        SELECT * FROM users
        WHERE email = :email
    </entry>

    <entry key='database.selectUsersAll'>
        SELECT * FROM users
    </entry>

    <entry key='database.insertUser'>
        INSERT INTO users (name, email, hashedPassword, salt, readonly, admin, map, distanceUnit, speedUnit, latitude, longitude, zoom, twelveHourFormat, coordinateFormat, disabled, expirationTime, deviceLimit, userLimit, deviceReadonly, token, attributes)
        VALUES (:name, :email, :hashedPassword, :salt, :readonly, :admin, :map, :distanceUnit, :speedUnit, :latitude, :longitude, :zoom, :twelveHourFormat, :coordinateFormat, :disabled, :expirationTime, :deviceLimit, :userLimit, :deviceReadonly, :token, :attributes)
    </entry>

    <entry key='database.updateUser'>
        UPDATE users SET
        name = :name,
        email = :email,
        readonly = :readonly,
        admin = :admin,
        map = :map,
        distanceUnit = :distanceUnit,
        speedUnit = :speedUnit,
        latitude = :latitude,
        longitude = :longitude,
        zoom = :zoom,
        twelveHourFormat = :twelveHourFormat,
        coordinateFormat = :coordinateFormat,
        disabled = :disabled,
        expirationTime = :expirationTime,
        deviceLimit = :deviceLimit,
        userLimit = :userLimit,
        deviceReadonly = :deviceReadonly,
        token = :token,
        attributes = :attributes
        WHERE id = :id
    </entry>

    <entry key='database.updateUserPassword'>
        UPDATE users SET hashedPassword = :hashedPassword, salt = :salt WHERE id = :id
    </entry>

    <entry key='database.deleteUser'>
        DELETE FROM users WHERE id = :id
    </entry>

    <entry key='database.selectDevicePermissions'>
        SELECT userId, deviceId FROM user_device
    </entry>

    <entry key='database.selectGroupPermissions'>
        SELECT userId, groupId FROM user_group
    </entry>

    <entry key='database.selectDevicesAll'>
        SELECT imei as id, imei as deviceId, imei as uniqueId, ultima_comunicacion as lastUpdate FROM vehiculos
    </entry>

    <entry key='database.updateDeviceStatus'>
    UPDATE vehiculos SET ultima_comunicacion = :lastUpdate where imei = :id
    </entry>

    <entry key='database.insertPosition'>
    set @sql = concat('insert into tracking_',:deviceId,'(deviceId, protocol, serverTime, deviceTime, fixTime, valid, latitude, longitude, altitude, speed, course, address, attributes, accuracy, network) 
        values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)');
        prepare stmt from @sql;
        set @dId = :deviceId; 
        set @proto = :protocol; 
        set @servTime = :serverTime; 
        set @devTime = :deviceTime;
        set @fTime = :fixTime;
        set @val = :valid;
        set @lat = :latitude; 
        set @lon = :longitude; 
        set @alt = :altitude; 
        set @spee = :speed;
        set @course = :course; 
        set @addr = :address;
        set @attr = :attributes;
        set @accu = :accuracy;
        set @net = :network;
        execute stmt using @dId, @proto, @servTime, @devTime, @fTime, @val, @lat, @lon, @alt, @spee, @course, @addr, @attr, @accu, @net;
        deallocate prepare stmt;
        INSERT INTO tracking (deviceId, protocol, serverTime, deviceTime, fixTime, valid, latitude, longitude, altitude, speed, course, address, attributes, accuracy, network)
        VALUES (:deviceId, :protocol, :now, :deviceTime, :fixTime, :valid, :latitude, :longitude, :altitude, :speed, :course, :address, :attributes, :accuracy, :network)
    </entry>

    <entry key='database.updateLatestPosition'>
        UPDATE vehiculos SET googlelat=:latitude , googlelong=:longitude WHERE imei=:deviceId
    </entry>

    <entry key='database.selectStatistics'>
        SELECT * FROM statistics WHERE captureTime BETWEEN :from AND :to ORDER BY captureTime
    </entry>

    <entry key='database.insertStatistics'>
        INSERT INTO statistics (captureTime, activeUsers, activeDevices, requests, messagesReceived, messagesStored, attributes)
        VALUES (:captureTime, :activeUsers, :activeDevices, :requests, :messagesReceived, :messagesStored, :attributes)
    </entry>

    <entry key='database.selectGroupsAll'>
        SELECT * FROM groups
    </entry>

    <entry key='database.selectPositions'>
        SELECT * FROM tracking WHERE deviceId = :deviceId AND fixTime BETWEEN :from AND :to ORDER BY fixTime
    </entry>

    <entry key='database.selectPosition'>
        SELECT * FROM tracking WHERE id = :id
    </entry>

     <entry key='database.selectLatestPositions'>
         SELECT * from tracking INNER JOIN vehiculos ON tracking.deviceId = vehiculos.imei;
     </entry>

     <entry key='database.saveOriginal'>false</entry>
     <entry key='database.selectDeviceAttributes'>
         SELECT deviceId, attributeId FROM device_attribute
     </entry>
     <entry key='database.selectAttributeAliases'>SELECT * FROM attribute_aliases</entry>
     <entry key='database.selectAttributes'>
         SELECT * FROM attributes
     </entry>


    <entry key='gps103.port'>6002</entry>
    <entry key='tk103.port'>6007</entry>
    <entry key='gt06.port'>6005</entry>
    <entry key='spetrotek.port'>6000</entry>
    <entry key='osmand.port'>6001</entry>
    <entry key='cellocator.port'>6003</entry>
    <entry key='wondex.port'>6032</entry>
    <!--<entry key='enfora.port'>6021</entry>-->
    <entry key='calamp.port'>6004</entry>
    <entry key='taip.port'>6010</entry>
    <entry key='tramigo.port'>6050</entry>

</properties>

This is the final error message when I attempt to forward the data:

2018-08-25 06:31:06 DEBUG: [26A88F69: 6001 < 170.80.8.166] HEX: 504f5354202f3f69643d3838313530302674696d657374616d703d31353335313731343635266c61743d372e30363131333339266c6f6e3d2d37332e3130373035362673706565643d302e302662656172696e673d302e3026616c7469747564653d302e302661636375726163793d32332e313432393939363439303437383526626174743d37392e3020485454502f312e310d0a436f6e74656e742d547970653a206170706c69636174696f6e2f782d7777772d666f726d2d75726c656e636f6465640d0a557365722d4167656e743a2044616c76696b2f322e312e3020284c696e75783b20553b20416e64726f696420372e303b204d6f746f204720283529204275696c642f4e50505332352e3133372d31352d37290d0a486f73743a203137332e3231322e3232342e3130303a363030310d0a436f6e6e656374696f6e3a204b6565702d416c6976650d0a4163636570742d456e636f64696e673a20677a69700d0a436f6e74656e742d4c656e6774683a20300d0a0d0a
2018-08-25 06:31:06 DEBUG: [26A88F69: 6001 > 170.80.8.166] HEX: 485454502f312e3120323030204f4b0d0a436f6e74656e742d4c656e6774683a20300d0a0d0a
2018-08-25 06:31:06  WARN: [26A88F69] error - NullPointerException (... < WebDataHandler:81 < *:124 < BaseDataHandler:29 < ... < ExtendedObjectDecoder:61 < ...)
2018-08-25 06:31:06  INFO: [26A88F69] disconnected
hackerunet6 years ago

This was solved, the integration had to include field as name in selectDevices query, that fixed the entire issue.