问题描述
<div class="iteye-blog-content-contain" style="font-size: 14px"></div> 用到SPRING SECURITY3项目部署到tomcat下运行,登陆没有出问题,到第二天第一次登陆,出现空指针异常,返回后重新登陆,没问题;第三天第一次登陆问题又出现;发现只有没天第一次登陆会出现问题;错误如下type Exception reportmessagedescription The server encountered an internal error () that prevented it from fulfilling this request.exceptionjava.lang.NullPointerException org.pmp.dao.admin.BaseDAO.getInstance(BaseDAO.java:215) org.pmp.dao.impl.admin.UserDAO.getUserByUsername(UserDAO.java:83) org.pmp.security.MyUserDetailsService.loadUserByUsername(MyUserDetailsService.java:35) org.springframework.security.authentication.dao.DaoAuthenticationProvider.retrieveUser(DaoAuthenticationProvider.java:83) org.springframework.security.authentication.dao.AbstractUserDetailsAuthenticationProvider.authenticate(AbstractUserDetailsAuthenticationProvider.java:125) org.springframework.security.authentication.ProviderManager.doAuthentication(ProviderManager.java:121) org.springframework.security.authentication.AbstractAuthenticationManager.authenticate(AbstractAuthenticationManager.java:49) org.springframework.security.authentication.ProviderManager.doAuthentication(ProviderManager.java:139) org.springframework.security.authentication.AbstractAuthenticationManager.authenticate(AbstractAuthenticationManager.java:49) org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter.attemptAuthentication(UsernamePasswordAuthenticationFilter.java:98) org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:200) org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:356) org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:106) org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:356) org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:80) org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:356) org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:150) org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:237) org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:167) org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88) org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)note The full stack trace of the root cause is available in the Apache Tomcat/7.0.27 logs.
解决方案
mysql数据库么?
解决方案二:
是不是监听器在,提交之前获取值了,如果是这样,就拿到的是空值,第二次以后就不会了,我以前只遇到这样的问题。