on 2020 Jan 31 8:09 AM
Hi All,
I'm seeing null pointer exception when I hit the url https://hostname/my-account for the first time after clearing cache. Once reloaded issue is disappeared. Below is the exception.
SEVERE: Servlet.service() for servlet [DispatcherServlet] in context with path [] threw exception [Error while processing internal filterchain. Exception occurred at chain position: 12 of 16. Current filter: 'FilterChainProxy[Filter Chains: [[ Ant [pattern='/_ui/**'], []], [ Ant [pattern='/checkout/**'], [org.springframework.security.web.access.channel.ChannelProcessingFilter@17a77771, org.springframework.security.web.context.SecurityContextPersistenceFilter@7bcbaab4, org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter@41e7bec2, org.springframework.security.web.header.HeaderWriterFilter@8489662, org.springframework.security.web.authentication.logout.LogoutFilter@247864e5, org.springframework.security.web.csrf.CsrfFilter@2c0e4d4, org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter@7e2d4be0, org.springframework.security.web.savedrequest.RequestCacheAwareFilter@321a39c1, org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter@55223c2b, org.springframework.security.web.authentication.AnonymousAuthenticationFilter@5041841f, org.springframework.security.web.session.SessionManagementFilter@4427b7bc, org.springframework.security.web.access.ExceptionTranslationFilter@27905ac8, org.springframework.security.web.access.intercept.FilterSecurityInterceptor@6397f975]], [ com.abc.storefront.security.ExcludeUrlRequestMatcher@4e208a07, [org.springframework.security.web.access.channel.ChannelProcessingFilter@4ca8b6d4, org.springframework.security.web.context.SecurityContextPersistenceFilter@55679ac1, org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter@2f08d751, org.springframework.security.web.header.HeaderWriterFilter@65b21005, org.springframework.security.web.authentication.logout.LogoutFilter@247864e5, org.springframework.security.web.csrf.CsrfFilter@6ca50471, org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter@57d3ab6, org.springframework.security.web.savedrequest.RequestCacheAwareFilter@6ca6c717, org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter@19e1d0be, org.springframework.security.web.authentication.rememberme.RememberMeAuthenticationFilter@5da3c97f, org.springframework.security.web.authentication.AnonymousAuthenticationFilter@3167e0f7, org.springframework.security.web.session.SessionManagementFilter@6b2307b3, org.springframework.security.web.access.ExceptionTranslationFilter@7cd05e49, org.springframework.security.web.access.intercept.FilterSecurityInterceptor@3f7b889d]]]]'!; nested exception is java.lang.NullPointerException] with root cause
java.lang.NullPointerException
at com.abc.storefront.util.SiteThemeResolverUtils.resolveThemeForCurrentSite(SiteThemeResolverUtils.java:35)
at com.abc.storefront.web.theme.StorefrontResourceBundleSource.determineDefaultThemeName(StorefrontResourceBundleSource.java:215)
at com.abc.storefront.web.theme.StorefrontResourceBundleSource.getMessage(StorefrontResourceBundleSource.java:190)
at org.springframework.context.support.AbstractApplicationContext.getMessage(AbstractApplicationContext.java:1253)
at org.springframework.context.support.MessageSourceAccessor.getMessage(MessageSourceAccessor.java:85)
On further debugging, I understood the issue is due to session attribute DETECTED_UI_EXPERIENCE_LEVEL is null for the first time in DefaultUiExperienceService.java, but from second hit, the value is somehow populating with "DESKTOP" and there will not be any issue.
The same issue has also been reported below by some others.
@Override
public UiExperienceLevel getUiExperienceLevel()
{
// Lookup the UiExperienceLevel override specified in the current session
final UiExperienceLevel sessionOverrideUiExperienceLevel = getOverrideUiExperienceLevel();
if (sessionOverrideUiExperienceLevel != null)
{
return sessionOverrideUiExperienceLevel;
}
return getDetectedUiExperienceLevel();
}
@Override
public UiExperienceLevel getDetectedUiExperienceLevel()
{
return getSessionService().getAttribute(DETECTED_UI_EXPERIENCE_LEVEL);
}
Request clarification before answering.
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 1 | |
| 1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.