8 Replies Latest reply on Jul 16, 2006 10:38 AM by Basel Al-Mustafa

    create method not found + @Factory

    Basel Al-Mustafa Newbie

      Hello,

      I am trying to cerate a new entry, entity bean, using three pages with the help of jBPM similar to the example illustrated in jbossworld-seam-lab.zip file. These three pages are going to be used in a RESTful application that follows the blog example.

      So, I have a data entry page called newentry.jsf, similar to the bolg example, that has a reference to a variable created with the help of the @Factory annotation. In that page the variable is referenced just like any bean:

      <h:inputText id="title" value="#{newEntry.title}"
       size="70" maxlength="70" required="true"/>
      


      The method that creates the variable is in a stateful session bean, to take advantage of jBPM pageflow:
      @Stateful
      @Name("postAction")
      public class PostAction implements PostActionInterface{
      
       @In(create=true)
       private Category category;
      
       //@In(create=false, value="newEntry")
       @In(create=false)
       private Entry entry;
      
       @Factory("newEntry")
       public void createNewEntry(){
       entry = new Entry(category);
       }
      
       @Logger
       private Log log;
      
       //@Begin(pageflow="new-entry", join=true)
       @Begin(pageflow="new-entry")
       public void startPost(){
       log.info("Starting to create a new post");
       }
      
       @Remove @Destroy
       public void destroy(){}
      }
      


      As you might have noticed, there is a page event in pages.xml that is supposed to call startPost() method in order to start a new conversation:
      <page view-id="/newentry.jsf" action="#{postAction.startPost}"/>
      


      Unfortunately, when I try to access the newentry.jsf page I get the following stacktrace:
      SEVERE: Error Rendering View[/newentry.xhtml]
      java.lang.IllegalArgumentException: create method not found
       at org.jboss.seam.Component.callComponentMethod(Component.java:1342)
       at org.jboss.seam.Component.getInstanceFromFactory(Component.java:1293)
       at org.jboss.seam.Component.getInstance(Component.java:1260)
       at org.jboss.seam.Component.getInstance(Component.java:1246)
       at org.jboss.seam.jsf.SeamVariableResolver.resolveVariable(SeamVariableResolver.java:44)
       at com.sun.faces.el.VariableResolverChainWrapper.getValue(VariableResolverChainWrapper.java:71)
       at javax.el.CompositeELResolver.getValue(CompositeELResolver.java:135)
       at com.sun.faces.el.FacesCompositeELResolver.getValue(FacesCompositeELResolver.java:58)
       at com.sun.el.parser.AstIdentifier.getValue(AstIdentifier.java:65)
       at com.sun.el.parser.AstValue.getValue(AstValue.java:106)
       at com.sun.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:192)
       at com.sun.facelets.el.TagValueExpression.getValue(TagValueExpression.java:71)
       at javax.faces.component.UIOutput.getValue(UIOutput.java:176)
       at com.sun.faces.renderkit.html_basic.HtmlBasicInputRenderer.getValue(HtmlBasicInputRenderer.java:100)
       at com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.getCurrentValue(HtmlBasicRenderer.java:282)
       at com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.encodeEnd(HtmlBasicRenderer.java:208)
       at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:847)
       at javax.faces.component.UIComponent.encodeAll(UIComponent.java:893)
       at javax.faces.component.UIComponent.encodeAll(UIComponent.java:889)
       at javax.faces.render.Renderer.encodeChildren(Renderer.java:137)
       at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:827)
       at javax.faces.component.UIComponent.encodeAll(UIComponent.java:883)
       at javax.faces.component.UIComponent.encodeAll(UIComponent.java:889)
       at com.sun.facelets.FaceletViewHandler.renderView(FaceletViewHandler.java:552)
       at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:108)
       at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:266)
       at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:159)
       at javax.faces.webapp.FacesServlet.service(FacesServlet.java:245)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
       at org.jboss.seam.servlet.SeamExceptionFilter.doFilter(SeamExceptionFilter.java:45)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
       at org.jboss.seam.servlet.SeamRedirectFilter.doFilter(SeamRedirectFilter.java:30)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
       at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
       at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
       at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
       at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:175)
       at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:432)
       at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)
       at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
       at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
       at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
       at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
       at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
       at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
       at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
       at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
       at java.lang.Thread.run(Thread.java:595)
      Caused by: java.lang.NoSuchMethodException: $Proxy275.createNewEntry()
       at java.lang.Class.getMethod(Class.java:1581)
       at org.jboss.seam.Component.callComponentMethod(Component.java:1331)
       ... 52 more
      19:54:41,948 INFO [SeamExceptionFilter] killing transaction
      


      I forgot to mention that the entity bean entry is only annotated with @Entity. What did I do worng?

        • 1. Re: create method not found + @Factory
          Gavin King Master

          I don't see any code with a @Create annotation. Seam would not throw that exception unless it appears somewhere. I think you are looking in the wrong place for the problem.

          • 2. Re: create method not found + @Factory
            Gavin King Master

            Oh, woops! Actually it is a misleading exception message. I'll fix that.

            I think the problem is that your @Factory method is not declared on the local interface.

            • 3. Re: create method not found + @Factory
              Basel Al-Mustafa Newbie

               

              "gavin.king@jboss.com" wrote:

              I think the problem is that your @Factory method is not declared on the local interface.

              Yeah that is right, I forgot to add the createNewEntry method to the local interface. Thank you Gavin ^_^

              • 4. Re: create method not found + @Factory
                Basel Al-Mustafa Newbie

                Could someone please help me with getting a component initialized properly? I have read so many posts and tried many solutions with no avail.
                Few things that I have leaned from the posts:
                1. @Begin does not start a new conversation. It only promotes a short-running conversation to a long-running mode.
                2. @Factory get called whenever your JSF EL code is trying to access a context variable that is null.
                3. The variable that that gets initialized by the @Factory method might need to be annotated using @Out(scope=CONVERSATION)

                Let me rephrase what I am currently doing. There three pages:
                1. An input page called newentry.jsf that has a button which directs the user to confirmentry.jsf
                2. A confirmation page called confimentry.jsf that show the date from newentry.jsf and ask the user to confirm or edit.
                3. View result page called saveentry.jsf that tells the user whether the record was saved or not.

                These three pages depend on a component called newEntry which happens to be an entity bean, Entry.java. This component gets created inside a stateful session bean, PostAction.java, with the help of the @Factory annotation. The session bean persists the entity bean once the user clicks the save button on the confirmentry.jsf page. Since jBPM is used to manage the page flow I had to add a method that triggers the beginning of the conversation and the name of the pageflow definition.

                When I try to access newentry.jsf I get the first six lines below. Once I input some data and hit process I get two line from postAction in addition to the stacktrace:

                21:00:47,163 INFO [PostAction] Creating a new empty entry
                21:00:47,163 INFO [PostAction] Created a new empty entry
                21:00:47,168 INFO [PostAction] Creating a new empty entry
                21:00:47,169 INFO [PostAction] Created a new empty entry
                21:00:47,173 INFO [PostAction] Creating a new empty entry
                21:00:47,174 INFO [PostAction] Created a new empty entry
                21:00:54,474 INFO [PostAction] Creating a new empty entry
                21:00:54,474 INFO [PostAction] Created a new empty entry
                21:00:54,475 ERROR [STDERR] Jul 16, 2006 9:00:54 PM com.sun.faces.lifecycle.ProcessValidationsPhase execute
                WARNING: /newentry.xhtml @18,48 value="#{newEntry.title}": Target Unreachable, identifier 'newEntry' resolved to null
                javax.el.PropertyNotFoundException: /newentry.xhtml @18,48 value="#{newEntry.title}": Target Unreachable, identifier 'newEntry' resolved to null
                 at com.sun.facelets.el.TagValueExpression.getType(TagValueExpression.java:62)
                 at com.sun.faces.renderkit.html_basic.HtmlBasicInputRenderer.getConvertedValue(HtmlBasicInputRenderer.java:129)
                 at javax.faces.component.UIInput.getConvertedValue(UIInput.java:943)
                 at javax.faces.component.UIInput.validate(UIInput.java:868)
                 at javax.faces.component.UIInput.executeValidate(UIInput.java:1078)
                 at javax.faces.component.UIInput.processValidators(UIInput.java:670)
                 at javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:1039)
                 at javax.faces.component.UIForm.processValidators(UIForm.java:229)
                 at javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:1039)
                 at javax.faces.component.UIViewRoot.processValidators(UIViewRoot.java:672)
                 at com.sun.faces.lifecycle.ProcessValidationsPhase.execute(ProcessValidationsPhase.java:100)
                 at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:266)
                 at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:132)
                 at javax.faces.webapp.FacesServlet.service(FacesServlet.java:244)
                 at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
                 at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
                 at org.jboss.seam.servlet.SeamExceptionFilter.doFilter(SeamExceptionFilter.java:45)
                 at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
                 at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
                 at org.jboss.seam.servlet.SeamRedirectFilter.doFilter(SeamRedirectFilter.java:30)
                 at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
                 at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
                 at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
                 at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
                 at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
                 at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
                 at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
                 at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:175)
                 at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:432)
                 at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)
                 at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
                 at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
                 at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
                 at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
                 at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
                 at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
                 at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
                 at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
                 at java.lang.Thread.run(Thread.java:595)
                21:00:54,477 ERROR [STDERR] Jul 16, 2006 9:00:54 PM com.sun.faces.lifecycle.LifecycleImpl phase
                WARNING: executePhase(PROCESS_VALIDATIONS 3,com.sun.faces.context.FacesContextImpl@1a2dbfc1) threw exception
                javax.faces.FacesException: /newentry.xhtml @18,48 value="#{newEntry.title}": Target Unreachable, identifier 'newEntry' resolved to null
                 at com.sun.faces.lifecycle.ProcessValidationsPhase.execute(ProcessValidationsPhase.java:108)
                 at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:266)
                 at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:132)
                 at javax.faces.webapp.FacesServlet.service(FacesServlet.java:244)
                 at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
                 at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
                 at org.jboss.seam.servlet.SeamExceptionFilter.doFilter(SeamExceptionFilter.java:45)
                 at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
                 at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
                 at org.jboss.seam.servlet.SeamRedirectFilter.doFilter(SeamRedirectFilter.java:30)
                 at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
                 at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
                 at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
                 at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
                 at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
                 at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
                 at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
                 at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:175)
                 at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:432)
                 at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)
                 at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
                 at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
                 at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
                 at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
                 at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
                 at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
                 at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
                 at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
                 at java.lang.Thread.run(Thread.java:595)
                Caused by: javax.el.PropertyNotFoundException: /newentry.xhtml @18,48 value="#{newEntry.title}": Target Unreachable, identifier 'newEntry' resolved to null
                 at com.sun.facelets.el.TagValueExpression.getType(TagValueExpression.java:62)
                 at com.sun.faces.renderkit.html_basic.HtmlBasicInputRenderer.getConvertedValue(HtmlBasicInputRenderer.java:129)
                 at javax.faces.component.UIInput.getConvertedValue(UIInput.java:943)
                 at javax.faces.component.UIInput.validate(UIInput.java:868)
                 at javax.faces.component.UIInput.executeValidate(UIInput.java:1078)
                 at javax.faces.component.UIInput.processValidators(UIInput.java:670)
                 at javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:1039)
                 at javax.faces.component.UIForm.processValidators(UIForm.java:229)
                 at javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:1039)
                 at javax.faces.component.UIViewRoot.processValidators(UIViewRoot.java:672)
                 at com.sun.faces.lifecycle.ProcessValidationsPhase.execute(ProcessValidationsPhase.java:100)
                 ... 28 more
                21:00:54,481 ERROR [SeamExceptionFilter] uncaught exception handled by Seam
                javax.servlet.ServletException: /newentry.xhtml @18,48 value="#{newEntry.title}": Target Unreachable, identifier 'newEntry' resolved to null
                 at javax.faces.webapp.FacesServlet.service(FacesServlet.java:256)
                 at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
                 at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
                 at org.jboss.seam.servlet.SeamExceptionFilter.doFilter(SeamExceptionFilter.java:45)
                 at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
                 at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
                 at org.jboss.seam.servlet.SeamRedirectFilter.doFilter(SeamRedirectFilter.java:30)
                 at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
                 at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
                 at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
                 at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
                 at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
                 at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
                 at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
                 at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:175)
                 at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:432)
                 at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)
                 at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
                 at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
                 at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
                 at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
                 at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
                 at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
                 at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
                 at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
                 at java.lang.Thread.run(Thread.java:595)
                21:00:54,494 ERROR [[Faces Servlet]] Servlet.service() for servlet Faces Servlet threw exception
                javax.el.PropertyNotFoundException: /newentry.xhtml @18,48 value="#{newEntry.title}": Target Unreachable, identifier 'newEntry' resolved to null
                 at com.sun.facelets.el.TagValueExpression.getType(TagValueExpression.java:62)
                 at com.sun.faces.renderkit.html_basic.HtmlBasicInputRenderer.getConvertedValue(HtmlBasicInputRenderer.java:129)
                 at javax.faces.component.UIInput.getConvertedValue(UIInput.java:943)
                 at javax.faces.component.UIInput.validate(UIInput.java:868)
                 at javax.faces.component.UIInput.executeValidate(UIInput.java:1078)
                 at javax.faces.component.UIInput.processValidators(UIInput.java:670)
                 at javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:1039)
                 at javax.faces.component.UIForm.processValidators(UIForm.java:229)
                 at javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:1039)
                 at javax.faces.component.UIViewRoot.processValidators(UIViewRoot.java:672)
                 at com.sun.faces.lifecycle.ProcessValidationsPhase.execute(ProcessValidationsPhase.java:100)
                 at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:266)
                 at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:132)
                 at javax.faces.webapp.FacesServlet.service(FacesServlet.java:244)
                 at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
                 at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
                 at org.jboss.seam.servlet.SeamExceptionFilter.doFilter(SeamExceptionFilter.java:45)
                 at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
                 at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
                 at org.jboss.seam.servlet.SeamRedirectFilter.doFilter(SeamRedirectFilter.java:30)
                 at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
                 at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
                 at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
                 at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
                 at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
                 at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
                 at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
                 at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:175)
                 at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:432)
                 at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)
                 at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
                 at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
                 at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
                 at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
                 at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
                 at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
                 at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
                 at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
                 at java.lang.Thread.run(Thread.java:595)
                


                Excerpts of the source code and configuration files follows:

                newentry.jsf
                <ui:define name="content">
                 <div class="entry">
                 <h:form>
                 <s:validateAll>
                 <div>
                 <h:outputLabel for="title">Title: </h:outputLabel>
                 </div>
                 <div>
                 <h:inputText id="title" value="#{newEntry.title}"
                 size="70" maxlength="70" required="true"/>
                 <span class="errors"><h:message for="title"/></span>
                 </div>
                 <div>
                 <h:outputLabel for="excerpt">
                 Excerpt (optional):
                 </h:outputLabel>
                 </div>
                 <div>
                 <h:inputTextarea id="excerpt"
                 value="#{newEntry.excerpt}" cols="68" rows="3"/>
                 <span class="errors"><h:message for="excerpt"/></span>
                 </div>
                 <div>
                 <h:outputLabel for="body">Body text: </h:outputLabel>
                 </div>
                 <div>
                 <h:inputTextarea id="body" value="#{newEntry.body}"
                 cols="68" rows="20" required="true"/>
                 <span class="errors"><h:message for="body"/></span>
                 </div>
                 <div>
                 <h:commandButton value="Proceed" action="proceed"/>
                 </div>
                 </s:validateAll>
                 </h:form>
                 </div>
                </ui:define>
                


                Entry.java and PostAction.java
                @Entity(name="gs_entry")
                public class Entry {
                
                 @Id
                 @GeneratedValue(strategy=AUTO)
                 @Column(name="entry_id")
                 private int id;
                
                 @NotNull
                 @Length(max=70)
                 private String title;
                
                 @Length(max=200)
                 private String excerpt;
                
                 @NotNull
                 @Length(max=1400)
                 private String body;
                
                 @NotNull
                 @Column(name="post_date")
                 private Date postDate = new Date();
                
                // @Length(max = 50)
                // @JoinColumn(name="category_name", referencedColumnName="name")
                 @NotNull
                 @ManyToOne
                 @JoinColumn(name="categoryid", referencedColumnName="category_id")
                 private Category mycategory;
                
                 public Entry(){}
                 public Entry(Category category){
                 this.mycategory = category;
                 }
                }
                
                @Stateful
                @Name("postAction")
                public class PostAction implements PostActionInterface{
                
                 @In(create=true)
                 private Category category;
                
                 @In(create=true, value="entityManager")
                 private EntityManager em;
                
                 //@In(required=false)
                 //@Out(value="newEntry")
                 //@Out(value="newEntry", scope=ScopeType.CONVERSATION)
                 private Entry entry;
                
                 @Factory("newEntry")
                 //@Begin(pageflow="new-entry", join=true)
                 public void createNewEntry(){
                 log.info("Creating a new empty entry");
                 entry = new Entry(category);
                 if(entry == null){
                 log.info("The entry IS NULL");
                 }
                 log.info("Created a new empty entry");
                 }
                
                 @Logger
                 private Log log;
                
                 @Begin(pageflow="new-entry", join=true)
                 public void startPost(){
                 log.info("Starting to create a new post");
                 }
                
                 @End
                 public String post(){
                 log.info("Saving entry #{newEntry}");
                 entry.setPostDate(new Date());
                 category.getEntries().add(entry);
                 em.persist(entry);
                 return "/saveentry.xhtml";
                 }
                
                 /*
                 * Stateful seam components should have a destroy method to link
                 * the stateful bean lifecycle to the Seam component lifecycle.
                 */
                 @Remove @Destroy
                 public void destroy(){}
                }
                


                pages.xml
                <pages>
                 <!--
                 <page view-id="/newentry.jsf" action="#{conversation.begin}"/>
                 -->
                 <page view-id="/newentry.jsf" action="#{postAction.startPost}"/>
                </pages>
                


                I am so sorry if this was discussed in the past but I am desperate at the moment after spending two full days without being able to find a solution.

                • 5. Re: create method not found + @Factory
                  Jim Hazen Expert

                  As far as I can see, a value for newEntry is never outjected. You'll need to enable one of those commented out outjections.

                  • 6. Re: create method not found + @Factory
                    Basel Al-Mustafa Newbie

                    Isn't that being taken care of by the @Factory("newEntry") annotation? Neither the jbossworld-seam-lab example nor Gavin's http://www.jboss.com/index.html?module=bb&op=viewtopic&t=72267 thread used an @Out annotation.

                    • 7. Re: create method not found + @Factory
                      Jim Hazen Expert

                      No it isn't. @Factory("name") on a void method tells Seam to call this method when "name" needs to be created. This method typically sets an instance variable that is labeled for outjection like in Gavin's example. What is different in Gavin's example is that @DataModel implicitly outjects. All databinders implicitly outject.

                      There is a new feature in CVS that allows you to specify a return value for @Factory methods. If specified this value will be outjected. This actually causes problems for older apps (like mine) who depended on this not happening.

                      • 8. Re: create method not found + @Factory
                        Basel Al-Mustafa Newbie

                        Thank you so much guys. It finally worked ^_^

                        Here is what I did:
                        1. Add @Out(value="newEntry", scope=ScopeType.CONVERSATION) annotation to the instance variable Entry. It won't work if you do not specify a scope.
                        2. Remove the @Factory("newEntry") annotation from createNewEntry method.
                        3. Move the code that creates the entry to the startPost method which is called by a page event.

                        Here is the code:

                        @Out(value="newEntry", scope=ScopeType.CONVERSATION)
                        private Entry entry;
                        
                        @Begin(pageflow="new-entry", join=true)
                        public void startPost(){
                         log.info("Starting to create a new post");
                         if( entry == null)
                         entry = new Entry(category);
                        }