java.lang.NullPointerException

There are no available Samebug tips for this exception. Do you have an idea how to solve this issue? A short tip would help users who saw this issue last week.

  • I am trying to configure Spring Security to use a custom Session Registry which will based on JDBC and completely disable HttpSession. I started with this piece of configuration: {code} http .requestCache() .requestCache(new NullRequestCache()) .and() .sessionManagement() .sessionCreationPolicy(SessionCreationPolicy.STATELESS) .and() .formLogin() .loginPage("/login") .permitAll() .and() .logout() .logoutUrl("/logout") .permitAll() .and() .authorizeRequests() .antMatchers("/").anonymous() .antMatchers("/static/**").anonymous() .antMatchers("/version").anonymous() .anyRequest().authenticated(); {code} When I am tring to login, an exception occurs: {code} ! java.lang.NullPointerException: null ! at org.springframework.security.web.csrf.HttpSessionCsrfTokenRepository.saveToken(HttpSessionCsrfTokenRepository.java:58) ~[spring-security-web-3.2.0.RC2.jar:3.2.0.RC2] ! at org.springframework.security.web.csrf.CsrfFilter$SaveOnAccessCsrfToken.saveTokenIfNecessary(CsrfFilter.java:207) ~[spring-security-web-3.2.0.RC2.jar:3.2.0.RC2] ! at org.springframework.security.web.csrf.CsrfFilter$SaveOnAccessCsrfToken.getToken(CsrfFilter.java:165) ~[spring-security-web-3.2.0.RC2.jar:3.2.0.RC2] ! at org.springframework.security.web.csrf.CsrfFilter.doFilterInternal(CsrfFilter.java:92) ~[spring-security-web-3.2.0.RC2.jar:3.2.0.RC2] ! at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) ~[spring-web-3.2.5.RELEASE.jar:3.2.5.RELEASE] ! at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342) ~[spring-security-web-3.2.0.RC2.jar:3.2.0.RC2] ! at org.springframework.security.web.header.HeaderWriterFilter.doFilterInternal(HeaderWriterFilter.java:57) ~[spring-security-web-3.2.0.RC2.jar:3.2.0.RC2] {code} Is this exception expected?
    via by Cemo Koc,
  • I am trying to configure Spring Security to use a custom Session Registry which will based on JDBC and completely disable HttpSession. I started with this piece of configuration: {code} http .requestCache() .requestCache(new NullRequestCache()) .and() .sessionManagement() .sessionCreationPolicy(SessionCreationPolicy.STATELESS) .and() .formLogin() .loginPage("/login") .permitAll() .and() .logout() .logoutUrl("/logout") .permitAll() .and() .authorizeRequests() .antMatchers("/").anonymous() .antMatchers("/static/**").anonymous() .antMatchers("/version").anonymous() .anyRequest().authenticated(); {code} When I am tring to login, an exception occurs: {code} ! java.lang.NullPointerException: null ! at org.springframework.security.web.csrf.HttpSessionCsrfTokenRepository.saveToken(HttpSessionCsrfTokenRepository.java:58) ~[spring-security-web-3.2.0.RC2.jar:3.2.0.RC2] ! at org.springframework.security.web.csrf.CsrfFilter$SaveOnAccessCsrfToken.saveTokenIfNecessary(CsrfFilter.java:207) ~[spring-security-web-3.2.0.RC2.jar:3.2.0.RC2] ! at org.springframework.security.web.csrf.CsrfFilter$SaveOnAccessCsrfToken.getToken(CsrfFilter.java:165) ~[spring-security-web-3.2.0.RC2.jar:3.2.0.RC2] ! at org.springframework.security.web.csrf.CsrfFilter.doFilterInternal(CsrfFilter.java:92) ~[spring-security-web-3.2.0.RC2.jar:3.2.0.RC2] ! at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) ~[spring-web-3.2.5.RELEASE.jar:3.2.5.RELEASE] ! at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342) ~[spring-security-web-3.2.0.RC2.jar:3.2.0.RC2] ! at org.springframework.security.web.header.HeaderWriterFilter.doFilterInternal(HeaderWriterFilter.java:57) ~[spring-security-web-3.2.0.RC2.jar:3.2.0.RC2] {code} Is this exception expected?
    via by Cemo Koc,
    • java.lang.NullPointerException: null at org.springframework.security.web.csrf.HttpSessionCsrfTokenRepository.saveToken(HttpSessionCsrfTokenRepository.java:58)[spring-security-web-3.2.0.RC2.jar:3.2.0.RC2] at org.springframework.security.web.csrf.CsrfFilter$SaveOnAccessCsrfToken.saveTokenIfNecessary(CsrfFilter.java:207)[spring-security-web-3.2.0.RC2.jar:3.2.0.RC2] at org.springframework.security.web.csrf.CsrfFilter$SaveOnAccessCsrfToken.getToken(CsrfFilter.java:165)[spring-security-web-3.2.0.RC2.jar:3.2.0.RC2] at org.springframework.security.web.csrf.CsrfFilter.doFilterInternal(CsrfFilter.java:92)[spring-security-web-3.2.0.RC2.jar:3.2.0.RC2] at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)[spring-web-3.2.5.RELEASE.jar:3.2.5.RELEASE] at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)[spring-security-web-3.2.0.RC2.jar:3.2.0.RC2] at org.springframework.security.web.header.HeaderWriterFilter.doFilterInternal(HeaderWriterFilter.java:57)[spring-security-web-3.2.0.RC2.jar:3.2.0.RC2]
    No Bugmate found.