1 Reply Latest reply on Sep 25, 2008 3:43 PM by liu lei

    WorkingMemory Insert, NPE.HELP!

    liu lei Newbie
      @Name("postAuthenticateListener")
      public class PostAuthenticateListener {
           
           @Observer("org.jboss.seam.security.postAuthenticate")
           public void postAuthenticate(Identity identity) {
                Member member = ((MemberDAO) Component.getInstance(MemberDAO.class)).find(identity.getPrincipal().getName(), ValidateState.Nomal, false);
                
                Contexts.getSessionContext().set(Member.sessionName, member);
                
                StatefulSession securityContext= ((RuleBasedIdentity) RuleBasedIdentity.instance()).getSecurityContext();
                
                synchronized(securityContext){
                     for(Role role:member.getRoles()){
                          securityContext.insert(role);
                     }

                     List<OrganizationMember> organizationMembers = ((OrganizationMemberList) Component.getInstance(OrganizationMemberList.class)).getResultListByMember(member.getId(), ValidateState.Nomal, null, null);
                     for(OrganizationMember organizationMember:organizationMembers){
                          for(OrganizationRole organizationRole:organizationMember.getRoles()){
                               securityContext.insert(new MemberOrganizationRole(organizationRole,organizationMember.getOrganization()));
                          }
                     }
                }
           }
      }

      it throw exception in this line "securityContext.insert(new MemberOrganizationRole(organizationRole,organizationMember.getOrganization()));"
        • 1. Re: WorkingMemory Insert, NPE.HELP!
          liu lei Newbie
          : exception root cause
          javax.faces.FacesException: #{identity.login}: java.lang.NullPointerException
               at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:107)
               at javax.faces.component.UICommand.broadcast(UICommand.java:383)
               at org.ajax4jsf.component.AjaxViewRoot.processEvents(AjaxViewRoot.java:321)
               at org.ajax4jsf.component.AjaxViewRoot.broadcastEvents(AjaxViewRoot.java:296)
               at org.ajax4jsf.component.AjaxViewRoot.processPhase(AjaxViewRoot.java:253)
               at org.ajax4jsf.component.AjaxViewRoot.processApplication(AjaxViewRoot.java:466)
               at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:97)
               at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:251)
               at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:117)
               at javax.faces.webapp.FacesServlet.service(FacesServlet.java:244)
               at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
               at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
               at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:83)
               at com.jeehe.filter.VisitLogFilter.doFilter(VisitLogFilter.java:268)
               at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
               at org.jboss.seam.debug.hot.HotDeployFilter.doFilter(HotDeployFilter.java:68)
               at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
               at org.jboss.seam.web.CharacterEncodingFilter.doFilter(CharacterEncodingFilter.java:42)
               at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
               at org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:85)
               at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
               at org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:64)
               at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
               at org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:177)
               at org.ajax4jsf.webapp.BaseFilter.handleRequest(BaseFilter.java:267)
               at org.ajax4jsf.webapp.BaseFilter.processUploadsAndHandleRequest(BaseFilter.java:380)
               at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:507)
               at org.jboss.seam.web.Ajax4jsfFilter.doFilter(Ajax4jsfFilter.java:60)
               at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
               at org.jboss.seam.servlet.SeamFilter.doFilter(SeamFilter.java:158)
               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:175)
               at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:433)
               at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
               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:286)
               at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
               at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
               at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
               at java.lang.Thread.run(Thread.java:595)
          Caused by: javax.faces.el.EvaluationException: java.lang.NullPointerException
               at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:91)
               at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:91)
               ... 42 more
          Caused by: java.lang.NullPointerException
               at org.drools.rule.PredicateConstraint.createContextEntry(PredicateConstraint.java:201)
               at org.drools.common.SingleBetaConstraints.createContext(SingleBetaConstraints.java:94)
               at org.drools.common.SingleBetaConstraints.createBetaMemory(SingleBetaConstraints.java:171)
               at org.drools.reteoo.BetaNode.createMemory(BetaNode.java:236)
               at org.drools.common.AbstractWorkingMemory.getNodeMemory(AbstractWorkingMemory.java:1359)
               at org.drools.reteoo.JoinNode.assertObject(JoinNode.java:141)
               at org.drools.reteoo.CompositeObjectSinkAdapter.propagateAssertObject(CompositeObjectSinkAdapter.java:318)
               at org.drools.reteoo.ObjectTypeNode.assertObject(ObjectTypeNode.java:162)
               at org.drools.reteoo.Rete.assertObject(Rete.java:175)
               at org.drools.reteoo.ReteooRuleBase.assertObject(ReteooRuleBase.java:192)
               at org.drools.reteoo.ReteooWorkingMemory.doInsert(ReteooWorkingMemory.java:71)
               at org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:915)
               at org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:887)
               at org.drools.common.AbstractWorkingMemory.insert(AbstractWorkingMemory.java:688)
               at com.jeehe.listener.PostAuthenticateListener.postAuthenticate(PostAuthenticateListener.java:43)
               at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
               at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
               at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
               at java.lang.reflect.Method.invoke(Method.java:585)
               at org.jboss.seam.util.Reflections.invoke(Reflections.java:21)
               at org.jboss.seam.intercept.RootInvocationContext.proceed(RootInvocationContext.java:31)
               at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:56)
               at org.jboss.seam.transaction.RollbackInterceptor.aroundInvoke(RollbackInterceptor.java:31)
               at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
               at org.jboss.seam.core.MethodContextInterceptor.aroundInvoke(MethodContextInterceptor.java:42)
               at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
               at org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:107)
               at org.jboss.seam.intercept.JavaBeanInterceptor.interceptInvocation(JavaBeanInterceptor.java:166)
               at org.jboss.seam.intercept.JavaBeanInterceptor.invoke(JavaBeanInterceptor.java:102)
               at com.jeehe.listener.PostAuthenticateListener_$$_javassist_12.postAuthenticate(PostAuthenticateListener_$$_javassist_12.java)
               at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
               at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
               at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
               at java.lang.reflect.Method.invoke(Method.java:585)
               at org.jboss.seam.util.Reflections.invoke(Reflections.java:21)
               at org.jboss.seam.util.Reflections.invokeAndWrap(Reflections.java:125)
               at org.jboss.seam.Component.callComponentMethod(Component.java:2096)
               at org.jboss.seam.core.Events.raiseEvent(Events.java:84)
               at org.jboss.seam.security.Identity.postAuthenticate(Identity.java:303)
               at org.jboss.seam.security.RuleBasedIdentity.postAuthenticate(RuleBasedIdentity.java:80)
               at org.jboss.seam.security.Identity.authenticate(Identity.java:255)
               at org.jboss.seam.security.Identity.authenticate(Identity.java:243)
               at org.jboss.seam.security.Identity.login(Identity.java:200)
               at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
               at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
               at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
               at java.lang.reflect.Method.invoke(Method.java:585)
               at org.jboss.el.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:329)
               at org.jboss.el.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:342)
               at org.jboss.el.parser.AstPropertySuffix.invoke(AstPropertySuffix.java:58)
               at org.jboss.el.parser.AstValue.invoke(AstValue.java:96)
               at org.jboss.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:276)
               at com.sun.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:68)
               at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:77)
               ... 43 more