Notification addon in Jmix 1.6 - Null pointer exception in getSession()

Hi Jmix team,

I’m experiencing null pointer exception when trying to send in-app notification or even when closing the popup with the in-app notifications. Null pointer comes from the VaadinSessionNotificationEventPublisher from the method publishEvent when trying to get SPRING_SECURITY_CONTEXT from the VaadinSession:

SecurityContext context = (SecurityContext)session.getSession().getAttribute(“SPRING_SECURITY_CONTEXT”);

The result of session.getSession() is null.

This is the part of the exception trace:

io.jmix.notificationsui.event.VaadinSessionNotificationEventPublisher in publishEvent at line 100
io.jmix.notificationsui.event.VaadinSessionNotificationEventPublisher in notifyUserSession at line 59
io.jmix.notificationsui.screen.inappnotification.UserInAppNotificationBrowseScreen in onAfterClose at line 88
io.jmix.core.common.event.EventHub in publish at line 170
io.jmix.ui.screen.Screen in fireEvent at line 126
io.jmix.ui.screen.Screen in close at line 332
io.jmix.ui.component.impl.DialogWindowImpl in onCloseButtonClick at line 134

Unfortunatelly I’m not able to reproduce it locally on my laptop but on both environments (test and production) this error presents. I’m also using OpenID addon.

This problem started to appear right after Jmix upgrade from version 1.5 to 1.6.

Thank you for any advice!
OG

Hello Vlastimil,

I created an issue to fix this problem NPE in notifications addon in Jmix 1.6.

Best regards,
Ilya

1 Like