Event forwarding throws error

Johannes Stein4 years ago

Hello,

i've setup traccar version 4.6 and enabled event.forwarding
my traccar.xml looks like this

    <entry key='config.default'>./conf/default.xml</entry>
    <entry key='notificator.types'>web,mail,sms</entry>
        <entry key='database.driver'>com.mysql.jdbc.Driver</entry>
        <entry key='database.url'>jdbc:mysql://127.0.0.1:3306/traccar?serverTimezone=UTC&amp;useSSL=false&amp;allowMultiQueries=true&amp;autoReconnect=true&amp;useUnicode=yes&amp;charac$
        <entry key='database.user'>traccar</entry>
        <entry key='database.password'>**Filler**</entry>

        <!-- event forwarding -->
        <entry key='event.forward.enable'>true</entry>
        <entry key='event.forward.url'>http://**Filler**/traccar/events</entry>
        <entry key='event.forward.header'>
            content-type: application/json,
        </entry>

</properties>

this is the warning/error message in my log file:

2020-05-18 13:57:51  INFO: [cdc49358] connected
2020-05-18 13:57:51  INFO: [cdc49358: osmand < **Filler**] HEX: 504f5354202f3f69643d30333535393531303933303738393637266c6f6e3d362e393133363930303930313739343433266c61743d35302e393535303535323336383136343036266d7367547269676765723d64756d6d7931323431323431323431323431323420485454502f312e310d0a557365722d4167656e743a20506f73746d616e52756e74696d652f372e32342e310d0a4163636570743a202a2f2a0d0a43616368652d436f6e74726f6c3a206e6f2d63616368650d0a506f73746d616e2d546f6b656e3a2063613234313931352d373862352d346664622d386437392d3134373834333066336365350d0a486f73743a20696f742e76656c6f636974792d61616368656e2e64653a353035350d0a4163636570742d456e636f64696e673a20677a69702c206465666c6174652c2062720d0a436f6e6e656374696f6e3a206b6565702d616c6976650d0a436f6e74656e742d4c656e6774683a20300d0a0d0a
2020-05-18 13:57:51  INFO: [cdc49358: osmand > **Filler**] HEX: 485454502f312e3120323030204f4b0d0a636f6e74656e742d6c656e6774683a20300d0a0d0a
2020-05-18 13:57:51  WARN: [cdc49358] error - Index 1 out of bounds for length 1 - ArrayIndexOutOfBoundsException (EventForwarder:55 < NotificationManager:111 < *:117 < BaseEventHandler:31 < ...)
2020-05-18 13:57:51  INFO: [cdc49358] disconnected

can you please help me where the error lies?

thanks in advance

Johannes

Anton Tananaev4 years ago

Remove comma from the header.

Johannes Stein4 years ago

thanks for the quick reply, i changed it:

        <entry key='event.forward.enable'>true</entry>
        <entry key='event.forward.url'>**Filler**/traccar/events</entry>
        <entry key='event.forward.header'>
            content-type: application/json

but unfortunately i have still the same error:

2020-05-18 15:59:18  INFO: [931171e0] connected
2020-05-18 15:59:18  INFO: [931171e0: osmand < **Filler**] HEX: 504f5354202f3f69643d30333535393531303933303738393637266c6f6e3d362e393133363930303930313739343433266c61743d35302e393535303535323336383136343036266d7367547269676765723d64756d6d7931323431323431323431323431323420485454502f312e310d0a557365722d4167656e743a20506f73746d616e52756e74696d652f372e32342e310d0a4163636570743a202a2f2a0d0a43616368652d436f6e74726f6c3a206e6f2d63616368650d0a506f73746d616e2d546f6b656e3a2033333130643931652d323365662d343761662d383539342d3430373265343932303535370d0a486f73743a20696f742e76656c6f636974792d61616368656e2e64653a353035350d0a4163636570742d456e636f64696e673a20677a69702c206465666c6174652c2062720d0a436f6e6e656374696f6e3a206b6565702d616c6976650d0a436f6e74656e742d4c656e6774683a20300d0a0d0a
2020-05-18 15:59:18  INFO: [931171e0: osmand > **Filler**] HEX: 485454502f312e3120323030204f4b0d0a636f6e74656e742d6c656e6774683a20300d0a0d0a
2020-05-18 15:59:18  WARN: [931171e0] error - Index 1 out of bounds for length 1 - ArrayIndexOutOfBoundsException (EventForwarder:55 < NotificationManager:111 < *:117 < BaseEventHandler:31 < ...)
2020-05-18 15:59:18  INFO: [931171e0] disconnected

any other ideas? could the message be to long?

Anton Tananaev4 years ago

It still indicates that there's an error with the header.

Johannes Stein4 years ago

Ok i tried it completely without the header lines and now it works.
i added the content type because my application explicitly checks for the content type. but it seems that it is automatically added to the header even without my lines