I am getting a null pointer exception when I try to test notifications (I have twilio-SMS and smtp-mail enabled) and get no notifications from events even though events are registered in the database.
After debugging the code, I realized that CacheManager has no users or devices (CacheManager.deviceCache size is zero) and hence a null is being returned in org.traccar.notification.NotificationFormatter on both of these lines:
User user = cacheManager.getObject(User.class, userId);
Device device = cacheManager.getObject(Device.class, event.getDeviceId());
I temporarily modified the code as follows to test my SMTP and SMS configuration as follows:
User user = Context.getPermissionsManager().getUser(userId);
Device device = event.getDeviceId() == 0 ? null : cacheManager.getObject(Device.class, event.getDeviceId());
And was able to get test notifications via SMS and mail.
Any idea what could be wrong preventing the CacheManager from being populated?
Thanks in advance
Master from a few days ago.
As usual, spot on... A few days was prior to the fix. All is good. Thanks
I am getting a null pointer exception when I try to test notifications (I have twilio-SMS and smtp-mail enabled) and get no notifications from events even though events are registered in the database.
After debugging the code, I realized that CacheManager has no users or devices (CacheManager.deviceCache size is zero) and hence a null is being returned in org.traccar.notification.NotificationFormatter on both of these lines:
User user = cacheManager.getObject(User.class, userId); Device device = cacheManager.getObject(Device.class, event.getDeviceId());
I temporarily modified the code as follows to test my SMTP and SMS configuration as follows:
User user = Context.getPermissionsManager().getUser(userId); Device device = event.getDeviceId() == 0 ? null : cacheManager.getObject(Device.class, event.getDeviceId());
And was able to get test notifications via SMS and mail.
Any idea what could be wrong preventing the CacheManager from being populated?
Thanks in advance