我正在努力弄清楚为什么(无害的)Null Pointer异常发生在我们在生产中运行的服务器上,因为还没有设置bean。这是场景:
可以在问题末尾找到stacktrace片段。
我无法在开发环境中重现这一点,所以我希望看到为什么会发生这种情况的想法。
注意:ZzzzSecurityContextService
有lazy-init="true"
; Spring版本为2.5.1
。
Dec 10, 2012 10:14:11 AM org.apache.catalina.core.ApplicationContext log
INFO: Initializing Spring root WebApplicationContext
...
Dec 10, 2012 10:14:13 AM org.apache.catalina.startup.Catalina start
INFO: Server startup in 33849 ms
Dec 10, 2012 10:14:15 AM org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Servlet.service() for servlet ZzzzGwtClient threw exception
org.zzzz.system.security.SecurityDataAccessException: Error reading user 'Zzzzzz' info from the database.; nested exception is java.lang.NullPointerException
at org.zzzz.system.security.UserService.loadUserByUsername(UserService.java:181)
at org.zzzz.system.security.DelegatingUserDetailsService.loadUserByUsername(DelegatingUserDetailsService.java:21)
at org.springframework.security.extensions.kerberos.KerberosServiceAuthenticationProvider.authenticate(KerberosServiceAuthenticationProvider.java:89)
at org.springframework.security.providers.ProviderManager.doAuthentication(ProviderManager.java:195)
at org.springframework.security.AbstractAuthenticationManager.authenticate(AbstractAuthenticationManager.java:46)
at org.zzzz.session.WebAuthenticationFilter.attemptAuthentication(WebAuthenticationFilter.java:117)
at org.springframework.security.ui.AbstractProcessingFilter.doFilterHttp(AbstractProcessingFilter.java:252)
...
Caused by: java.lang.NullPointerException
at zzzz.services.ZzzzSecurityContextService.getStructureService(ZzzzSecurityContextService.java:241)
at zzzz.services.ZzzzSecurityContextService.readSecurityContext(ZzzzSecurityContextService.java:50)
at org.zzzz.system.security.SecurityContextService.getSecurityContext(SecurityContextService.java:41)
at org.zzzz.system.security.UserService.loadUserByUsername(UserService.java:173)
... 29 more