1 Reply Latest reply on Mar 19, 2012 10:31 PM by kalvish

    Problems with session

    kalvish Newbie

      Hi,

       

      I'm new to RichFaces. I have a very peculiar situation happening in my code. When the user logs in for the first time (right after the application comes up) everything works as expected. The user is able to log in, and see everything. But any subsequent user is having an null pointer exception with the session, and i'm not sure why. Even if the first user logs out, there is still a null pointer exception. The error is printed below:

       

      java.lang.NullPointerException

                at com.sun.faces.context.SessionMap.put(ExternalContextImpl.java:970)

                at com.mounza.common.Util.logUser(Util.java:129)

                at com.mounza.common.Util.userStart(Util.java:159)

                at com.mounza.homepage.UserHomepageAction.<init>(UserHomepageAction.java:39)

                at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)

                at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)

                at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)

                at java.lang.reflect.Constructor.newInstance(Constructor.java:513)

                at java.lang.Class.newInstance0(Class.java:355)

                at java.lang.Class.newInstance(Class.java:308)

                at com.sun.faces.mgbean.BeanBuilder.newBeanInstance(BeanBuilder.java:186)

                at com.sun.faces.mgbean.BeanBuilder.build(BeanBuilder.java:106)

                at com.sun.faces.mgbean.BeanManager.createAndPush(BeanManager.java:368)

                at com.sun.faces.mgbean.BeanManager.create(BeanManager.java:230)

                at com.sun.faces.el.ManagedBeanELResolver.getValue(ManagedBeanELResolver.java:86)

                at javax.el.CompositeELResolver.getValue(CompositeELResolver.java:54)

                at com.sun.faces.el.FacesCompositeELResolver.getValue(FacesCompositeELResolver.java:72)

                at org.apache.el.parser.AstIdentifier.getValue(AstIdentifier.java:69)

                at org.apache.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:186)

                at com.sun.faces.application.ValueBindingValueExpressionAdapter.getValue(ValueBindingValueExpressionAdapter.java:113)

                at org.ajax4jsf.taglib.html.facelets.KeepAliveHandler.apply(KeepAliveHandler.java:76)

                at com.sun.facelets.tag.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:47)

                at com.sun.facelets.tag.jsf.ComponentHandler.applyNextHandler(ComponentHandler.java:314)

                at com.sun.facelets.tag.jsf.ComponentHandler.apply(ComponentHandler.java:169)

                at com.sun.facelets.tag.jsf.core.ViewHandler.apply(ViewHandler.java:109)

                at com.sun.facelets.tag.ui.DefineHandler.applyDefinition(DefineHandler.java:64)

                at com.sun.facelets.tag.ui.CompositionHandler.apply(CompositionHandler.java:131)

                at com.sun.facelets.impl.DefaultFaceletContext$TemplateManager.apply(DefaultFaceletContext.java:337)

                at com.sun.facelets.impl.DefaultFaceletContext.includeDefinition(DefaultFaceletContext.java:307)

                at com.sun.facelets.tag.ui.InsertHandler.apply(InsertHandler.java:68)

                at com.sun.facelets.tag.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:47)

                at com.sun.facelets.tag.jsf.core.ViewHandler.apply(ViewHandler.java:109)

                at com.sun.facelets.tag.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:47)

                at com.sun.facelets.tag.ui.CompositionHandler.apply(CompositionHandler.java:119)

                at com.sun.facelets.compiler.NamespaceHandler.apply(NamespaceHandler.java:49)

                at com.sun.facelets.compiler.EncodingHandler.apply(EncodingHandler.java:25)

                at com.sun.facelets.impl.DefaultFacelet.include(DefaultFacelet.java:248)

                at com.sun.facelets.impl.DefaultFacelet.include(DefaultFacelet.java:294)

                at com.sun.facelets.impl.DefaultFacelet.include(DefaultFacelet.java:273)

                at com.sun.facelets.impl.DefaultFaceletContext.includeFacelet(DefaultFaceletContext.java:140)

                at com.sun.facelets.tag.ui.CompositionHandler.apply(CompositionHandler.java:113)

                at com.sun.facelets.compiler.NamespaceHandler.apply(NamespaceHandler.java:49)

                at com.sun.facelets.compiler.EncodingHandler.apply(EncodingHandler.java:25)

                at com.sun.facelets.impl.DefaultFacelet.apply(DefaultFacelet.java:95)

                at com.sun.facelets.FaceletViewHandler.buildView(FaceletViewHandler.java:524)

                at com.sun.facelets.FaceletViewHandler.renderView(FaceletViewHandler.java:567)

                at org.ajax4jsf.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:100)

                at org.ajax4jsf.application.AjaxViewHandler.renderView(AjaxViewHandler.java:176)

                at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:110)

                at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:100)

                at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139)

                at javax.faces.webapp.FacesServlet.service(FacesServlet.java:266)

                at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)

                at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)

                at org.apache.myfaces.webapp.filter.ExtensionsFilter.doFilter(ExtensionsFilter.java:349)

                at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)

                at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)

                at org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:206)

                at org.ajax4jsf.webapp.BaseFilter.handleRequest(BaseFilter.java:290)

                at org.ajax4jsf.webapp.BaseFilter.processUploadsAndHandleRequest(BaseFilter.java:388)

                at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:515)

                at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)

                at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)

                at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:369)

                at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:109)

                at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:83)

                at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:381)

                at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:97)

                at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:381)

                at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:100)

                at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:381)

                at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:78)

                at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:381)

                at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:54)

                at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:381)

                at org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:35)

                at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:381)

                at org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:187)

                at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:381)

                at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:105)

                at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:381)

                at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:79)

                at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:381)

                at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:168)

                at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:237)

                at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:167)

                at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)

                at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)

                at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)

                at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)

                at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)

                at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)

                at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)

                at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)

                at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:859)

                at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:602)

                at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)

                at java.lang.Thread.run(Thread.java:680)

       

      Does anybody know what the issue is? All i'm doing where the NPE is showing up is:

      FacesContext.getCurrentInstance().getExternalContext().getSessionMap().put("userSession", session);

       

      Can somebody help with this? It's a major show stopper for me...