3 Replies Latest reply on Dec 9, 2008 7:05 AM by Craig Brumfield

    Home component not found

    Craig Brumfield Newbie
      I am trying to process a link similar to the registration activation link for this forum using a home class, subclass of EntityHome.  If I implement as a normal JavaBean, it seems to work fine.  But when I create an entity class to map to the database table that I have to track the activation codes (e.g, ActivationCode), and then a home class (e.g., ActivationCodeHome), I get a Seam error when I open the page indicating that the home component could not be found.

      For example, the link for email activation for this Seam forum is http://www.seamframework.org/confirmRegistration.seam?activationCode=bd126517e96e051.  I want to add a similar feature to my application where a method on the home class is invoked when the page is displayed.  For example, here are snippets of the entity and home classes, and the page configuration.

      @Entity
      @Name("activationCode")
      public class ActivationCode implements Serializable {…}

      @Name("activationCodeHome")
      public class ActivationCodeHome extends EntityHome< ActivationCode > {
          public void verify() {…}
      }

      <page view-id="/activationCode.xhtml">
          <param name="id" value="#{activationCodeHome.id}"/>
          <action execute="#{activationCodeHome.verify}"/>
      </page>

      I am new to Seam and realize I am probably missing something simple.  When the page is displayed, I get an error about the "activationCodeHome" not being found.

      Thanks in advance.
      Craig
        • 1. Re: Home component not found
          Craig Brumfield Newbie

          Here is some more information.  First, the error is that the component cannot be instantiated, not that it cannot be found.  Here is a stack trace.


          org.jboss.seam.InstantiationException: Could not instantiate Seam component: activationCodeHome
                at org.jboss.seam.Component.newInstance(Component.java:1986)
                at org.jboss.seam.Component.getInstance(Component.java:1876)
                at org.jboss.seam.Component.getInstance(Component.java:1843)
                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.getValueFacesCompositeELResolver.java:72)
                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 org.jboss.seam.core.Expressions$1.getValue(Expressions.java:111)
                at org.jboss.seam.navigation.Param.getStringValueFromModel(Param.java:133)
                at org.jboss.seam.navigation.Pages.getStringValuesFromModel(Pages.java:697)
                at org.jboss.seam.ui.component.UISeamCommandBase.getUrl(UISeamCommandBase.java:63)
                at org.jboss.seam.ui.renderkit.LinkRendererBase.doEncodeBeginLinkRendererBase.java:26)
                at org.jboss.seam.ui.util.cdk.RendererBase.encodeBegin(RendererBase.java:79)
                at javax.faces.component.UIComponentBase.encodeBegin(UIComponentBase.java:813)
                at javax.faces.component.UIComponent.encodeAll(UIComponent.java:934)
                at javax.faces.component.UIComponent.encodeAll(UIComponent.java:942)
                at com.sun.facelets.FaceletViewHandler.renderView(FaceletViewHandler.java:592)
                at org.ajax4jsf.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:108)
                at org.ajax4jsf.application.AjaxViewHandler.renderView(AjaxViewHandler.java:216)
                at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:109)
                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.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:83)
                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.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:141)
                at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:281)
                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.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.internalDoFilterApplicationFilterChain.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:182)
                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:619)
          Caused by: java.lang.IllegalStateException: entityManager is null
                at org.jboss.seam.framework.EntityHome.create(EntityHome.java:33)
                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:597)
                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.persistence.ManagedEntityIdentityInterceptor.aroundInvoke(ManagedEntityIdentityInterceptor.java:48)
                at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
                at org.jboss.seam.transaction.RollbackInterceptor.aroundInvoke(RollbackInterceptor.java:31)
                at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
                at org.jboss.seam.transaction.TransactionInterceptor$1.work(TransactionInterceptor.java:38)
                at org.jboss.seam.util.Work.workInTransaction(Work.java:41)
                at org.jboss.seam.transaction.TransactionInterceptor.aroundInvoke(TransactionInterceptor.java:32)
                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.cci.action.ClickHome$$javassist1.create(ClickHome$$javassist1.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:597)
                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:2092)
                at org.jboss.seam.Component.callCreateMethod(Component.java:2015)
                at org.jboss.seam.Component.newInstance(Component.java:1976)
                ... 61 more


          • 2. Re: Home component not found
            Ingo Jobling Master

            Hi Craig,


            Caused by: java.lang.IllegalStateException: entityManager is null



            Please review the configuration of the entity manager in components.xml and persistence.xml.
            More information can be found here.


            Examine the console output to confirm that the entity manager is started successfully.

            • 3. Re: Home component not found
              Craig Brumfield Newbie

              Actually, I meant to use HibernateEntityHome, but had changed to JPA EntityHome to try to debug the problem.  I switched back and now get Session is null instead.  But if I access other pages in my application that use Hibernate session, it works correctly, so I think that the session is configured properly in components.xml.


              What about the scope of my ActivationCodeHome class--does it need another scope besides the default?  If this is the first link I hit in my server after the server is started, isn't a temporary conversation started which should create the session?


              Thanks in advance for your help.


              Regards,
              Craig