NullPointerException

Muhammad Arsil Khan 6 years ago

Hi!
I installed traccar on my machine and gave configurations for my database in the traccar.xml file but when i execute the jar file it showed me this NullPointerException. Any help.

Exception in thread "main" java.lang.RuntimeException: java.lang.NullPointerException
	at org.traccar.Main.run(Main.java:152)
	at org.traccar.Main.main(Main.java:104)
Caused by: java.lang.NullPointerException
	at org.traccar.database.PermissionsManager.refreshServer(PermissionsManager.java:112)
	at org.traccar.database.PermissionsManager.<init>(PermissionsManager.java:59)
	at org.traccar.Context.init(Context.java:315)
	at org.traccar.Main.run(Main.java:110)
	... 1 more

Another question is that does traccar supports apache ignite (since both are open source).
A fast response will be appreciated.

Anton Tananaev 6 years ago

There's probably something missing in your database.

Muhammad Arsil Khan 6 years ago

Does traccar supports apache ignite (since both are open source).

Anders Yuran 6 years ago

Apache ignite is not sql so I would say no

MK 4 years ago

I've tried to upgrade my Traccar server on FreeBSD from 4.9 to 4.12. After making steps from https://www.traccar.org/upgrading-traccar/ (BTW: there is no "restore database step") and upgrading JDK (my version was too old) I saw in logs (like in the first post):

Exception in thread "main" java.lang.RuntimeException: java.lang.NullPointerException
        at org.traccar.Main.run(Main.java:147)
        at org.traccar.Main.main(Main.java:106)
Caused by: java.lang.NullPointerException
        at org.traccar.database.PermissionsManager.refreshServer(PermissionsManager.java:157)
        at org.traccar.database.PermissionsManager.<init>(PermissionsManager.java:63)
        at org.traccar.Context.init(Context.java:313)
        at org.traccar.Main.run(Main.java:120)
        ... 1 more

My config file:

    <entry key='geocoder.enable'>true</entry>
    <entry key='geocoder.type'>nominatim</entry>
    <entry key='geocoder.url'>https://nominatim.openstreetmap.org/reverse</entry>

    <entry key='geolocation.enable'>true</entry>
    <entry key='geolocation.type'>opencellid</entry>
    <entry key='geolocation.key'>pk.xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx</entry>

    <entry key='web.enable'>true</entry>

    <entry key='logger.enable'>true</entry>

    <entry key='event.enable'>true</entry>

I found some differences in default.xml between 4.9 and 4.12:

65c60
<         SELECT * FROM tc_events WHERE deviceId = :deviceId AND serverTime BETWEEN :from AND :to ORDER BY serverTime
---
>         SELECT * FROM tc_events WHERE deviceId = :deviceId AND eventTime BETWEEN :from AND :to ORDER BY eventTime
68,75d62
<     <entry key='database.deletePositions'>
<         DELETE FROM tc_positions WHERE serverTime &lt; :serverTime AND id NOT IN (SELECT positionId FROM tc_devices WHERE positionId IS NOT NULL)
<     </entry>
<
<     <entry key='database.deleteEvents'>
<         DELETE FROM tc_events WHERE serverTime &lt; :serverTime
<     </entry>
<

I have deleted ./data/database.mv.db and tried to start - no success, the same error.

I restored my old traccar files and started it successfully with newer JDK.

MK 4 years ago

Sorry for the mistake in previous post: I've tried to upgrade my Traccar server on FreeBSD from 4.9 to 4.14.

MK 4 years ago

An update:

I've tried 4.14, 4.13, 4.12 - all exited with the same error.

4.11 works.

MK 4 years ago

Ehhh... Sorry for confusion :/

I saw that the entries:

    <entry key='web.enable'>true</entry>

    <entry key='logger.enable'>true</entry>

    <entry key='event.enable'>true</entry>

was removed from default.xml, and while I modified traccar.xml I lost these lines:

    <entry key='database.driver'>org.h2.Driver</entry>
    <entry key='database.url'>jdbc:h2:./data/database</entry>
    <entry key='database.user'>sa</entry>
    <entry key='database.password'></entry>

4.14 works :)