java.lang.NullPointerException: null

Spring JIRA | Cemo Koc | 3 years ago
  1. 0

    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?

    Spring JIRA | 3 years ago | Cemo Koc
    java.lang.NullPointerException: null
  2. 0

    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?

    Spring JIRA | 3 years ago | Cemo Koc
    java.lang.NullPointerException: null
  3. 0

    HQL Exception (org.hibernate.dialect.Dialect$3)

    Stack Overflow | 4 years ago | Hari
    java.lang.NullPointerException: null
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    Error loading model properties in JPA on play 2.0.3

    Stack Overflow | 4 years ago | Chappies
    java.lang.NullPointerException: null

    Not finding the right solution?
    Take a tour to get the most out of Samebug.

    Tired of useless tips?

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. java.lang.NullPointerException

      null

      at org.springframework.security.web.csrf.HttpSessionCsrfTokenRepository.saveToken()
    2. org.springframework.security
      CsrfFilter.doFilterInternal
      1. org.springframework.security.web.csrf.HttpSessionCsrfTokenRepository.saveToken(HttpSessionCsrfTokenRepository.java:58)[spring-security-web-3.2.0.RC2.jar:3.2.0.RC2]
      2. org.springframework.security.web.csrf.CsrfFilter$SaveOnAccessCsrfToken.saveTokenIfNecessary(CsrfFilter.java:207)[spring-security-web-3.2.0.RC2.jar:3.2.0.RC2]
      3. org.springframework.security.web.csrf.CsrfFilter$SaveOnAccessCsrfToken.getToken(CsrfFilter.java:165)[spring-security-web-3.2.0.RC2.jar:3.2.0.RC2]
      4. org.springframework.security.web.csrf.CsrfFilter.doFilterInternal(CsrfFilter.java:92)[spring-security-web-3.2.0.RC2.jar:3.2.0.RC2]
      4 frames
    3. Spring
      OncePerRequestFilter.doFilter
      1. org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)[spring-web-3.2.5.RELEASE.jar:3.2.5.RELEASE]
      1 frame
    4. Spring Security
      FilterChainProxy$VirtualFilterChain.doFilter
      1. org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)[spring-security-web-3.2.0.RC2.jar:3.2.0.RC2]
      1 frame
    5. org.springframework.security
      HeaderWriterFilter.doFilterInternal
      1. org.springframework.security.web.header.HeaderWriterFilter.doFilterInternal(HeaderWriterFilter.java:57)[spring-security-web-3.2.0.RC2.jar:3.2.0.RC2]
      1 frame