4 Replies Latest reply on Oct 12, 2009 6:47 AM by sumit kumar

    Problem in identifying order of seam components creation sequence

    sumit kumar Newbie
      Hi All,

      I am very new to seam. Let me put my problem straight away;.
      I have 3 seam components
      ComponentA
      ComponentB
      ComponentC

      in the order in which they are by default created.

      I am injecting ComponentB in the other two components in the way

      @In(create=true)
        private ComponentB componentB;


      I am able to inject ComponentB in ComponentC and work successfully.
      However i am not able to inject ComponentB in ComponentA.

      i am getting NullPointer exception when i use componentB.function(), thats because componentB is null.


      the code is same at both the places. Still it doesn't work in ComponentA.

      i tried @In(create=true,required=true) , @In(create=true,required=false)

      But no success :(
      Please help


      Regards,
      Sumit
        • 1. Re: Problem in identifying order of seam components creation sequence
          Shervin Asgari Master
          My guess is your injection is wrong. You need to be sure you are using the same name as the @Name on your components.

          Try also putting @AutoCreate on all 3 components, that way you dont need to say create=true, you dont have to specify required = false/true
          • 2. Re: Problem in identifying order of seam components creation sequence
            sumit kumar Newbie
            'Hi Shervin,

            Thanks for the early reply.

            I am using the same name thats used in @Name for the components.


            Also i tried @AutoCreate,but its also not working

            I am attaching the log too.


            /WEB-INF/lib/richfaces-ui-3.3.1.GA.jar!/META-INF/richfaces.taglib.xml
            09:38:36,175 INFO  [Authenticator] In Authenticate Method
            09:38:36,175 INFO  [STDOUT] ----------------------- In the Authenticator..................
            09:38:42,472 INFO  [Authenticator] Authenticated the User : sumitkumar
            09:38:43,534 INFO  [HomepageBacking] ENTERING GET PERMISSION
            09:38:43,534 INFO  [AuthorizationBacking] Entering hasRole
            09:38:43,972 INFO  [HomepageBacking] EXITING GET PERMISSION
            09:38:47,503 INFO  [ADHOCInvoiceBacking] Entering authorization initial setup =======================
            09:38:47,503 INFO  [WorkUpPlanningBacking] Entering authorization setup
            09:38:47,503 INFO  [AuthorizationBacking] Entering getModulePermission
            09:38:47,784 INFO  [AuthorizationBacking] Entering getScreenPermission
            09:38:47,893 INFO  [ADHOCInvoiceBacking] Entering authorization view ====================
            09:38:47,893 INFO  [ADHOCInvoiceBacking] Exiting authorization view ====================
            09:38:47,893 INFO  [WorkUpPlanningBacking] Exiting authorization setup
            09:38:47,893 INFO  [AuthorizationBacking] Entering getScreenPermission
            09:38:47,940 INFO  [ADHOCInvoiceBacking] adhoc invoice backing rendering true accessPermission false
            09:38:47,940 INFO  [ADHOCInvoiceBacking] Exiting authorization initial setup==========================
            09:38:48,659 INFO  [ADHOCInvoiceBacking] Screen ----->null
            09:38:48,690 INFO  [AuthorizationBacking] Entering getScreenPermission
            09:38:48,706 INFO  [RaiseAdhocInvoiceBacking] raise adhoc invoice backing rendering true accessPermission false
            09:38:49,128 INFO  [MaintainSlaSettingsBacking] ******************* sla settings screen permission***************************
            09:38:49,128 INFO  [AuthorizationBacking] Entering getScreenPermission
            09:38:49,159 INFO  [MaintainSlaSettingsBacking] *************** exiting sla settings screen permission**********true false
            09:38:49,190 INFO  [ChainBalancingSettingsBacking] ******************* chainbalancing screen permission***************************
            09:38:49,190 INFO  [AuthorizationBacking] Entering getScreenPermission
            09:38:49,253 INFO  [ChainBalancingSettingsBacking] *************** exiting chainbalancing screen permission**********true false
            09:38:49,675 INFO  [ContractBacking] inside get setroyalmaillist0
            09:38:49,722 INFO  [ContractBacking] 22222222222222222222222222222222222222333[ContractBacking--->Constractor]3333333333333333333344444444444444444444
            444444455555555555555555[]
            09:38:49,800 INFO  [ContractBacking] inside get setroyalmaillist0
            09:38:49,815 INFO  [ContractBacking] 22222222222222222222222222222222222222333[ContractBacking--->Constractor]3333333333333333333344444444444444444444
            444444455555555555555555[]
            09:38:50,440 INFO  [ContractBacking] Entering authorization initial setup =======================
            09:38:50,440 INFO  [WorkUpPlanningBacking] Entering authorization setup
            09:38:50,456 INFO  [AuthorizationBacking] Entering getModulePermission
            09:38:50,456 INFO  [AuthorizationBacking] Entering getScreenPermission
            09:38:50,472 INFO  [ContractBacking] Entering authorization view ====================
            09:38:50,487 INFO  [ContractBacking] Calling adhoc invoice backing
            09:38:50,487 ERROR [viewhandler] Error Rendering View[/Order.xhtml]
            javax.faces.FacesException: org.jboss.seam.InstantiationException: Could not instantiate Seam component: contractBacking
                    at javax.faces.component.UIComponentBase$AttributesMap.get(UIComponentBase.java:1553)
                    at com.sun.faces.renderkit.html_basic.OutputLinkRenderer.encodeBegin(OutputLinkRenderer.java:104)
                    at javax.faces.component.UIComponentBase.encodeBegin(UIComponentBase.java:788)
                    at org.ajax4jsf.renderkit.RendererBase.renderChild(RendererBase.java:275)
                    at org.ajax4jsf.renderkit.RendererBase.renderChildren(RendererBase.java:258)
                    at org.richfaces.renderkit.html.MenuItemRenderer.doEncodeEnd(MenuItemRenderer.java:274)
                    at org.richfaces.renderkit.html.MenuItemRenderer.doEncodeEnd(MenuItemRenderer.java:293)
                    at org.ajax4jsf.renderkit.RendererBase.encodeEnd(RendererBase.java:134)
                    at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:836)
            at org.ajax4jsf.renderkit.RendererBase.renderChild(RendererBase.java:281)
            at org.richfaces.renderkit.html.AbstractMenuRenderer.encodeItems(AbstractMenuRenderer.java:204)
            at org.richfaces.renderkit.html.AbstractMenuRenderer.processLayer(AbstractMenuRenderer.java:173)
            at org.richfaces.renderkit.html.AbstractMenuRenderer.encodeChildren(AbstractMenuRenderer.java:155)
            at org.richfaces.renderkit.html.DropDownMenuRendererBase.encodeChildren(DropDownMenuRendererBase.java:115)
            at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:812)
            at org.ajax4jsf.renderkit.RendererBase.renderChild(RendererBase.java:277)
            at org.richfaces.renderkit.html.ToolBarGroupRenderer.renderChild(ToolBarGroupRenderer.java:74)
            at org.richfaces.renderkit.html.ToolBarGroupRenderer.encodeChildren(ToolBarGroupRenderer.java:56)
            at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:812)
            at org.ajax4jsf.renderkit.RendererBase.renderChild(RendererBase.java:277)
            at org.richfaces.renderkit.html.ToolBarRendererBase.encodeChildren(ToolBarRendererBase.java:103)
            at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:812)
            at javax.faces.component.UIComponent.encodeAll(UIComponent.java:886)
            at javax.faces.render.Renderer.encodeChildren(Renderer.java:137)
            at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:812)
            at javax.faces.component.UIComponent.encodeAll(UIComponent.java:886)
            at javax.faces.component.UIComponent.encodeAll(UIComponent.java:892)
            at com.sun.facelets.FaceletViewHandler.renderView(FaceletViewHandler.java:592)
            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:106)
            at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:251)
            at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:144)
            at javax.faces.webapp.FacesServlet.service(FacesServlet.java:245)
            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 org.jboss.seam.debug.hot.HotDeployFilter.doFilter(HotDeployFilter.java:51)
            at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
            at org.jboss.seam.web.IdentityFilter.doFilter(IdentityFilter.java:38)
            at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
            at org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:90)
            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.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:45)
            at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
            at org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:178)
            at org.ajax4jsf.webapp.BaseFilter.handleRequest(BaseFilter.java:290)
            at org.ajax4jsf.webapp.BaseFilter.processUploadsAndHandleRequest(BaseFilter.java:368)
            at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:495)
            at org.jboss.seam.web.Ajax4jsfFilter.doFilter(Ajax4jsfFilter.java:56)
            at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
            at org.jboss.seam.web.LoggingFilter.doFilter(LoggingFilter.java:58)
            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.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
            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:230)
            at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
            at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:179)
            at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:432)
            at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
            at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)

                    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
                    at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
                    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
                    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:262)
                    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:446)
                    at java.lang.Thread.run(Thread.java:595)
            Caused by: org.jboss.seam.InstantiationException: Could not instantiate Seam component: contractBacking
                    at org.jboss.seam.Component.newInstance(Component.java:2096)
                    at org.jboss.seam.Component.getInstance(Component.java:1978)
                    at org.jboss.seam.Component.getInstance(Component.java:1940)
                    at org.jboss.seam.Component.getInstance(Component.java:1934)
                    at org.jboss.seam.Namespace.getComponentInstance(Namespace.java:55)
                    at org.jboss.seam.Namespace.getComponentInstance(Namespace.java:50)
                    at org.jboss.seam.el.SeamELResolver.resolveBase(SeamELResolver.java:166)
                    at org.jboss.seam.el.SeamELResolver.getValue(SeamELResolver.java:53)
                    at javax.el.CompositeELResolver.getValue(CompositeELResolver.java:53)
                    at com.sun.faces.el.FacesCompositeELResolver.getValue(FacesCompositeELResolver.java:64)
                    at org.jboss.el.parser.AstIdentifier.getValue(AstIdentifier.java:44)
                    at org.jboss.el.parser.AstValue.getValue(AstValue.java:63)
                    at org.jboss.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:186)
                    at com.sun.facelets.el.TagValueExpression.getValue(TagValueExpression.java:71)
                    at javax.faces.component.html.HtmlOutputLink.isDisabled(HtmlOutputLink.java:187)
                    at sun.reflect.GeneratedMethodAccessor125.invoke(Unknown Source)
                    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
                    at java.lang.reflect.Method.invoke(Method.java:585)
                    at javax.faces.component.UIComponentBase$AttributesMap.get(UIComponentBase.java:1545)
                    ... 74 more
            Caused by: java.lang.NullPointerException
                    at uk.co.tntpost.umbrella.order.backing.ADHOCInvoiceBacking.decideRequester(ADHOCInvoiceBacking.java:1891)
                    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:22)
                    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:28)
                    at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
                    at org.jboss.seam.core.BijectionInterceptor.aroundInvoke(BijectionInterceptor.java:77)
                    at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
                    at org.jboss.seam.core.MethodContextInterceptor.aroundInvoke(MethodContextInterceptor.java:44)
                    at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
                    at org.jboss.seam.core.SynchronizationInterceptor.aroundInvoke(SynchronizationInterceptor.java:32)
                    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 uk.co.tntpost.umbrella.order.backing.ADHOCInvoiceBacking_$$_javassist_15.decideRequester(ADHOCInvoiceBacking_$$_javassist_15.java)
                    at uk.co.tntpost.umbrella.order.backing.ContractBacking.authorizationView(ContractBacking.java:6303)
                    at uk.co.tntpost.umbrella.security.backing.AuthorizationBaseBacking.authorizationSetup(AuthorizationBaseBacking.java:74)
                    at uk.co.tntpost.umbrella.order.backing.ContractBacking.authorizationInitialSetup(ContractBacking.java:6259)
                    at uk.co.tntpost.umbrella.order.backing.ContractBacking.initialize(ContractBacking.java:6251)
                    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:22)
                    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:28)
                    at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
                    at org.jboss.seam.core.BijectionInterceptor.aroundInvoke(BijectionInterceptor.java:77)
                    at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
                    at org.jboss.seam.core.MethodContextInterceptor.aroundInvoke(MethodContextInterceptor.java:44)
                    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 uk.co.tntpost.umbrella.order.backing.ContractBacking_$$_javassist_34.initialize(ContractBacking_$$_javassist_34.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:22)
                    at org.jboss.seam.util.Reflections.invokeAndWrap(Reflections.java:138)
                    at org.jboss.seam.Component.callComponentMethod(Component.java:2201)
                    at org.jboss.seam.Component.callCreateMethod(Component.java:2124)
                    at org.jboss.seam.Component.newInstance(Component.java:2084)
                    ... 92 more'
            • 3. Re: Problem in identifying order of seam components creation sequence
              sumit kumar Newbie

              ComponentA --- ContractBacking


              ComponentB --- AdhocInvoiceBacking

              • 4. Re: Problem in identifying order of seam components creation sequence
                sumit kumar Newbie

                Hi Shervin,


                I figured out the problem.
                The null pointer exception was happening in my business logic.
                Its resolved now.



                Still i want to know is there some place where seam keeps its list in the order in which the seam components would be initialized?