3 Replies Latest reply on Sep 9, 2008 1:29 PM by guy bashan

    Outjection problem

    guy bashan Apprentice

      Hi, I am trying to outject one of my bean properties. But when pressing the save button I am getting exception.
      This is the bean:


      @Name("forumEntryAction")
      public class ForumEntryAction
      {
        @In
        private User user;
      
        @In (create=true)
        @Out (required=false)
        private ForumEntry forumEntry;
      
        @In
        private FacesMessages facesMessages;
      
        public String save()
        {
          facesMessages.add("Saved!!!");
      
          return null;
        }
      



      This is the exception:


      WARNING: /picture.upload.xhtml @19,102 value="#{forumEntry.name}": Target Unreachable, identifier 'forumEntry' resolved to null
      javax.el.PropertyNotFoundException: /picture.upload.xhtml @19,102 value="#{forumEntry.name}": Target Unreachable, identifier 'forumEntry' resolved to null
           at com.sun.facelets.el.TagValueExpression.getType(TagValueExpression.java:62)
           at com.sun.faces.renderkit.html_basic.HtmlBasicInputRenderer.getConvertedValue(HtmlBasicInputRenderer.java:81)
           at javax.faces.component.UIInput.getConvertedValue(UIInput.java:934)
           at javax.faces.component.UIInput.validate(UIInput.java:860)
           at javax.faces.component.UIInput.executeValidate(UIInput.java:1065)
           at javax.faces.component.UIInput.processValidators(UIInput.java:666)
           at javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:1033)
           at javax.faces.component.UIForm.processValidators(UIForm.java:229)
           at javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:1033)
           at javax.faces.component.UIViewRoot.processValidators(UIViewRoot.java:662)
           at org.ajax4jsf.component.AjaxViewRoot.access$201(AjaxViewRoot.java:57)
           at org.ajax4jsf.component.AjaxViewRoot$3.invokeRoot(AjaxViewRoot.java:319)
           at org.ajax4jsf.context.JsfOneOneInvoker.invokeOnRegionOrRoot(JsfOneOneInvoker.java:56)
           at org.ajax4jsf.context.AjaxContextImpl.invokeOnRegionOrRoot(AjaxContextImpl.java:170)
           at org.ajax4jsf.component.AjaxViewRoot.processValidators(AjaxViewRoot.java:333)
           at com.sun.faces.lifecycle.ProcessValidationsPhase.execute(ProcessValidationsPhase.java:100)
           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.apache.myfaces.webapp.filter.ExtensionsFilter.doFilter(ExtensionsFilter.java:147)
           at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
           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:80)
           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.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: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:845)
           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:619)
      



      Am I missing something?


      Thanks

        • 1. Re: Outjection problem
          Bernard Labno Master

          Information provided is not enough for precise diagnose. We need to know the sequence of actions (from which page you start, what method do you invoke before you get the exception).
          From the first look it seems that since forumEntryAction is event scoped you try to use forumEntry outside of that scope.

          • 2. Re: Outjection problem
            nimo stephan Master

            Try to call it in JSF via forumEntryAction.forumEntryname and not via forumEntry.name. Use this in a datatable and provide a var in which you can iterate through the forumEntryname..then you can call e.g. in a row var.name.


            If you use a interface, then provide getters/setters for your forumEntryname even you outjected it..

            • 3. Re: Outjection problem
              guy bashan Apprentice

              Sorry, here are some more details:
              I get to this page with a simple link (s:link). No methods are invoked when page is accessed.
              I tried accessing forumEntry in the regular manner: forumEntryAction.forumEntry, but I get the same error. I believe, that the cause is that: create = true is not working for some reason, and the forumEntry member is simply not created.


              When adding this:


                @Create
                public void init()
                {
                  forumEntry = new ForumEntry();
                }



              Things are working properly.