Where did you get this information from?
I have reviewed several old threads.
What I am trying to do is to use the following option.
but without success
You have to set a URL in the configuration file, if I remember correctly.
I believe currently per device forward is only supported for JSON type.
<entry key='forward.type'>json</entry>
<entry key='forward.retry.enable'>true</entry>
<entry key='forward.url'>https://webhook.example.com/position</entry>
In the
traccar.xml
setforward.url
blank if you don't want all device data to be forwarded.
All good now?
the tests I performed showed these errors.
using the example, here I had to add port 5055 otherwise it did nothing.
<entry key='forward.url'>https://webhook.example.com/position</entry>
logs:
2025-03-24 11:04:00 WARN: Position forwarding failed: 1 pending - No route to host - NoRouteToHostException (...)
2025-03-24 11:04:01 WARN: Position forwarding failed: 1 pending - No route to host - NoRouteToHostException (...)
2025-03-24 11:04:02 WARN: Position forwarding failed: 1 pending - No route to host - NoRouteToHostException (...)
2025-03-24 11:04:03 WARN: Position forwarding failed: 1 pending - No route to host - NoRouteToHostException (...)
2025-03-24 11:04:07 WARN: Position forwarding failed: 1 pending - No route to host - NoRouteToHostException (...)
2025-03-24 11:04:09 WARN: Position forwarding failed: 1 pending - No route to host - NoRouteToHostException (...)
2025-03-24 11:04:14 WARN: Position forwarding failed: 1 pending - No route to host - NoRouteToHostException (...)
2025-03-24 11:04:21 WARN: Position forwarding failed: 1 pending - No route to host - NoRouteToHostException (...)
2025-03-24 11:04:30 INFO: [T5187cbc8] disconnected
2025-03-24 11:04:33 WARN: An exception was thrown by TimerTask. - Cannot invoke "org.traccar.model.Device.getAttributes()" because "device" is null - NullPointerException (AttributeUtil:52 < *:46 < PositionForwarderJson:49 < PositionForwardingHandler:81 < *:115 < ...)
What version of Traccar are you using?
The URL you have configured are they valid and working?
No route to host
This means your URL is unreachable.
I am working with Traccar 6.6
if I do the following, the Traccar demo server receives the information
http://demo.traccar.org:5055/?id=201643&lat=-33.01951&lon=27.90384&altitude=57&speed=36.198704103671705&blocked=false
configuration in the XML file
<entry key='forward.type'>json</entry>
<entry key='forward.retry.enable'>true</entry>
<entry key='forward.url'></entry>
configuration on the device
error in log
2025-03-24 12:35:51 INFO: [T98582122] id: 201643, time: 2025-03-24 12:35:50, lat: -38.98056, lon: -72.63824, course: 0.0, accuracy: 50.9
2025-03-24 12:35:51 INFO: [T98582122: osmand > 127.0.0.1] HTTP/1.1 200 OK\r\ncontent-length: 0\r\n\r\n
2025-03-24 12:35:51 WARN: Position forwarding failed: 1 pending - HTTP code 400 - RuntimeException (PositionForwarderJson:75 < *:68 < ...)
2025-03-24 12:35:51 WARN: Position forwarding failed: 1 pending - HTTP code 400 - RuntimeException (PositionForwarderJson:75 < *:68 < ...)
2025-03-24 12:35:51 WARN: Position forwarding failed: 1 pending - HTTP code 400 - RuntimeException (PositionForwarderJson:75 < *:68 < ...)
2025-03-24 12:35:52 WARN: Position forwarding failed: 1 pending - HTTP code 400 - RuntimeException (PositionForwarderJson:75 < *:68 < ...)
2025-03-24 12:35:53 WARN: Position forwarding failed: 1 pending - HTTP code 400 - RuntimeException (PositionForwarderJson:75 < *:68 < ...)
2025-03-24 12:35:54 WARN: Position forwarding failed: 1 pending - HTTP code 400 - RuntimeException (PositionForwarderJson:75 < *:68 < ...)
2025-03-24 12:35:58 WARN: Position forwarding failed: 1 pending - HTTP code 400 - RuntimeException (PositionForwarderJson:75 < *:68 < ...)
I'm kind of confused. Are you expecting this to work? Port 5055 doesn't accept JSON.
Understood Anton, I did not handle that information.
I made the following change
But nothing happens
2025-03-24 12:50:29 INFO: [T4e9f7811] id: 201643, time: 2025-03-24 12:50:28, lat: -38.98003, lon: -72.63799, course: 0.0, accuracy: 100.0
2025-03-24 12:50:29 INFO: [T4e9f7811: osmand > 127.0.0.1] HTTP/1.1 200 OK\r\ncontent-length: 0\r\n\r\n2025-03-24 12:50:59 INFO: [T4e9f7811] disconnected
That makes even less sense because this URL doesn't exist.
Ah ok, then I give up, keep trying, it's like playing guessing games to find the solution, thanks to all of you.
One query, to use the forwarding URL per device the following key must be present in the XML file:
<entry key='forward.enable'>true</entry>