3 Replies Latest reply on Jul 18, 2008 3:13 PM by gjeudy

    Exception problem

    bashan

      Hi, I am having an exception that I cannot figure out. I have a page backed by a bean, In the bean I have several propertis with getters and setters. When the page loads I am getting this exception:


      javax.faces.FacesException: javax.el.PropertyNotFoundException: /signup.xhtml @53,23 value="#{signup.password}": Property 'password' not found on type com.nikonians.ui.view.bean.SignupAction_$$_javassist_6
           at javax.faces.component.UIOutput.getValue(UIOutput.java:176)
           at com.sun.faces.renderkit.html_basic.HtmlBasicInputRenderer.getValue(HtmlBasicInputRenderer.java:189)
           at com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.getCurrentValue(HtmlBasicRenderer.java:320)
           at com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.encodeEnd(HtmlBasicRenderer.java:200)
           at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:836)
           at javax.faces.component.UIComponent.encodeAll(UIComponent.java:896)
           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:108)
           at org.ajax4jsf.application.AjaxViewHandler.renderView(AjaxViewHandler.java:216)
           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.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: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: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.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
           at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
           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:619)
      Caused by: javax.el.PropertyNotFoundException: /signup.xhtml @53,23 value="#{signup.password}": Property 'password' not found on type com.nikonians.ui.view.bean.SignupAction_$$_javassist_6
           at com.sun.facelets.el.TagValueExpression.getValue(TagValueExpression.java:73)
           at javax.faces.component.UIOutput.getValue(UIOutput.java:173)
           ... 47 more
      



      I doubled checked and the property password is there as well as it's setters and getters. When I move the control from my page the exception moves to the next control binded to a property.


      Does anyway has a clue what it means?
      Thanks,
      Guy.

        • 1. Re: Exception problem
          admin.admin.email.tld
          if your JSF EL is like such:

          <h:outputText value="#{foo.bar}"/>

          then there must be a class annotated as such:

          @Name("foo")

          and there must be a public method as such (e.g. returns String for example):

          public String getBar() {
          ...
          }

          and also you'll need a local interface that the SFSB/SLSB implements with that method in it (if you're using EJB as backing bean).

          post your backing bean code...
          • 2. Re: Exception problem
            bashan

            Hi,


            I have a bean named signup (using @Name), and I have a private member named password with public getter and setter. Isn't it enough for things to work. I have being working like this for several years with JSF only...


            I am not using EJB...


            This is my backing bean:



            @Name("signup")
            @Scope(ScopeType.CONVERSATION)
            public class SignupAction
            {
              @In(create = true)
              private User user;
            
              @In
              Session myDatabase;
            
              @In(create = true)
              private FacesMessages facesMessages;
            
              @Logger
              private Log log;
            
              @In
              private UserDAO userDAO;
            
              @In("uiComponent['passwordConfirm']")
              private HtmlInputHidden inputSecretPasswordConfirm;
            
              @In("uiComponent['day']")
              private HtmlSelectOneMenu htmlSelectOneMenuDay;
            
              @In("uiComponent['month']")
              private HtmlSelectOneMenu htmlSelectOneMenuMonth;
            
              @In("uiComponent['year']")
              private HtmlSelectOneMenu htmlSelectOneMenuYear;
            
              private String passwordConfirm;
                
              private Integer birthYear;
              private Integer birthMonth;
              private Integer birthDay;
            
              public void validateUsername(FacesContext context, UIComponent toValidate, Object value)
              {
                String email = (String)value;
                if (userDAO.getUser(email) != null)
                {
                  ((UIInput)toValidate).setValid(false);
                  FacesUtil.addErrorMessage(toValidate.getClientId(context), "Email already exists");
                }
              }
            
              public void validatePassword(FacesContext context, UIComponent toValidate, Object value)
              {
                String password = (String)value;
                String passwordConfirm = (String)inputSecretPasswordConfirm.getSubmittedValue();
            
                if (!(password.equals(passwordConfirm)))
                {
                  ((UIInput)toValidate).setValid(false);
                  FacesUtil.addErrorMessage(toValidate.getClientId(context),
                      "Password confirmation is invalid");
                }
              }
            
              public void validateGender(FacesContext context, UIComponent toValidate, Object value)
              {
                if (-1 == (Byte)value)
                {
                  ((UIInput)toValidate).setValid(false);
                  FacesUtil.addErrorMessage(toValidate.getClientId(context),
                      "Please select gender");
                }
              }
            
              public void validateSecurityCode(FacesContext context, UIComponent toValidate,
                                               Object value)
              {
                String securityCode = (String)value;
                //remenber that we need an id to validate!
                String captchaId = FacesUtil.getSession().getId();
            
                // Call the Service method
                boolean isOk = false;
                try
                {
                  isOk = CaptchaServiceSingleton.getInstance().validateResponseForID(captchaId, securityCode.toUpperCase());
                }
                catch (CaptchaServiceException e)
                {
                  //should not happen, may be thrown if the id is not valid
                }
                if (!isOk)
                {
                  ((HtmlInputText)toValidate).setSubmittedValue("");
                  ((UIInput)toValidate).setValid(false);
                  FacesUtil.addErrorMessage(toValidate.getClientId(context),
                      "Security code is incorrect");
                }
              }
            
              public void validateDate(FacesContext context, UIComponent toValidate, Object value)
              {
                int day = Integer.valueOf((String)htmlSelectOneMenuDay.getSubmittedValue());
                int month = Integer.valueOf((String)htmlSelectOneMenuMonth.getSubmittedValue());
                int year = Integer.valueOf((String)htmlSelectOneMenuYear.getSubmittedValue());
            
                if (day > -1 && month > -1 && year > -1)
                {
                  if (!DateUtils.isDateValid(day, month + 1, year))
                  {
                    ((UIInput)toValidate).setValid(false);
                    FacesUtil.addErrorMessage(toValidate.getClientId(context), "Date is not valid");
                  }
                }
            
                if (month < 0)
                {
                  ((UIInput)toValidate).setValid(false);
                  FacesUtil.addErrorMessage(toValidate.getClientId(context), "Please select month");
                }
                else if (day < 0)
                {
                  ((UIInput)toValidate).setValid(false);
                  FacesUtil.addErrorMessage(toValidate.getClientId(context), "Please select day");
                }
                else if (year < 0)
                {
                  ((UIInput)toValidate).setValid(false);
                  FacesUtil.addErrorMessage(toValidate.getClientId(context), "Please select year");
                }
              }
            
              public String saveAction()
              {
                user = userDAO.getUser(user.getEmail());
            
                String remoteAdrr = FacesUtil.getRequest().getRemoteAddr();
                Country country = LookupServiceSingleton.getInstance().getCountry(remoteAdrr);
            
                user.setCountry(country.getCode());
            
                Date currentDate = new Date();
                String confirmationCode = DigestUtils.shaHex(FacesUtil.getSession().getId() + Math.random());
                user.setConfirmationCode(confirmationCode);
                user.setStatus(UserStatus.NEW);
                user.setDateRegistered(currentDate);
                user.setDateBirth(DateUtils.getDate(birthYear, birthMonth, birthDay));
            
                
                Renderer.instance().render("/mail/activation.xhtml");
            
                myDatabase.persist(user);
            
                return "/confirmation.xhtml";
              }
            
              public List<SelectItem> getGenders()
              {
                List<SelectItem> list = new ArrayList<SelectItem>();
                list.add(new SelectItem((byte)-1, "-- Select --"));
                list.add(new SelectItem((byte)0, "Male"));
                list.add(new SelectItem((byte)1, "Female"));
            
                return list;
              }
            
              public List<SelectItem> getDays()
              {
                List<SelectItem> list = new ArrayList<SelectItem>();
                list.add(new SelectItem(-1, "-- Day --"));
                for (int i = 1; i <= 31; i++)
                {
                  list.add(new SelectItem(i, i + ""));
                }
            
                return list;
              }
            
              public List<SelectItem> getYears()
              {
                List<SelectItem> list = new ArrayList<SelectItem>();
                list.add(new SelectItem(-1, "-- Year --"));
                int currentYear = DateUtils.getCalendar(new Date()).get(Calendar.YEAR);
            
                for (int i = currentYear - 18; i > currentYear - 18 - 90; i--)
                {
                  list.add(new SelectItem(i, i + ""));
                }
            
                return list;
              }
            
              private static final String[] monthNames = new String[]{"January", "February", "March", "April", "May", "June",
                  "July", "August", "September", "October", "November", "December"};
            
              public List getMonths()
              {
                List list = new ArrayList();
                list.add(new SelectItem(-1, "-- Month --"));
                for (int i = 0; i < 12; i++)
                {
                  list.add(new SelectItem(i, monthNames[i]));
                }
            
                return list;
              }
            
              public Integer getBirthYear()
              {
                return birthYear;
              }
            
              public void setBirthYear(Integer birthYear)
              {
                this.birthYear = birthYear;
              }
            
              public Integer getBirthMonth()
              {
                return birthMonth;
              }
            
              public void setBirthMonth(Integer birthMonth)
              {
                this.birthMonth = birthMonth;
              }
            
              public Integer getBirthDay()
              {
                return birthDay;
              }
            
              public void setBirthDay(Integer birthDay)
              {
                this.birthDay = birthDay;
              }
            
              public String getPasswordConfirm()
              {
                return passwordConfirm;
              }
            
              public void setPasswordConfirm(String passwordConfirm)
              {
                this.passwordConfirm = passwordConfirm;
              }
            }
            
            


            • 3. Re: Exception problem
              gjeudy

              Try adding getPassword(), I don't see one.. or change you EL to:


              #{signup.passwordConfirm}