2 Replies Latest reply on Mar 30, 2009 7:27 PM by Aldo Bonzi

    Properties of h:selectOneMenu tags become to null after button clicked

    ioannis ntantis Newbie

      Hi all,


      I have created a seam application using seam gen and now i am trying to extend its functionality. What am trying to do is:


      i) render the page and display some lists using s:selectItems and h:selectOneMenu.
      ii) the user should select the desired values, put the search text in a h:inputText box and hit submit.
      iii) now the suer should the results of the search at the bottom of the page.


      The problem is that as soon i hit the button to execute the query all the values of the h:selectOneMenu tags resolve to null so the application fails.


      I was wondering if i could somehow disable the h:selectOneMenu tags or give a sollution to this.


      Below i give my source pages:


      My action class MotorcycleActionImpl.java is:


      
      package com.advert.sbeans;
      
      import java.io.Serializable;
      import java.math.BigInteger;
      import java.util.ArrayList;
      import java.util.List;
      import javax.ejb.Remove;
      import javax.ejb.Stateful;
      import javax.persistence.EntityManager;
      import javax.persistence.PersistenceContext;
      import com.advert.ebeans.Motorcycle;
      import com.advert.ebeans.Motorcyclecateg;
      import org.jboss.seam.ScopeType;
      import org.jboss.seam.annotations.Destroy;
      import org.jboss.seam.annotations.Factory;
      import org.jboss.seam.annotations.In;
      import org.jboss.seam.annotations.Name;
      import org.jboss.seam.annotations.Out;
      import org.jboss.seam.annotations.Scope;
      import org.jboss.seam.annotations.datamodel.DataModel;
      import org.jboss.seam.annotations.datamodel.DataModelSelection;
      
      @Stateful
      @Name("motorcycleService")
      @Scope(ScopeType.SESSION)
      public class MotorcycleActionImpl implements Serializable,MotorcycleAction{
              /**
               * 
               */
              private static final long serialVersionUID = 1L;
              private String searchString;
              private int pageSize = 10;
          private int page  = 2;
          private List<Integer> registrationYears = new ArrayList<Integer>();
          private List<Integer> kilometers = new ArrayList<Integer>();
          private List<String> price = new ArrayList<String>();
         // @DataModelSelection(value="motorcyclesList")
          private Motorcycle motor;
              private String motorcyclecategory;
              @PersistenceContext
          private EntityManager entityManager;
      
              private String category;
              @In(required=false)
              @Out(required=false)
              private Integer fromYear; 
              @In(required=false)
              @Out(required=false)
              private Integer toYear;
              @In(required=false)
              @Out(required=false)
              private Integer fromKilometers;
              @In(required=false)
              @Out(required=false)
              private Integer toKilometers;
              @In(required=false)
              @Out(required=false)
              private String fromPrice;
              @In(required=false)
              @Out(required=false)
              private String toPrice;
              @DataModel
              private List<String> motorcycleCats =  new ArrayList<String>();
          @DataModel
          private List<Motorcycle> motorcyclesList  =  new ArrayList<Motorcycle>();
            
          @SuppressWarnings("unchecked")
          public void queryMotorcycles() {
                      System.out.println("size of motorcycles");
              //getMotorcycleCats();
                      List temp;
                      motorcyclesList = entityManager.createQuery(
                              "select motor from  Motorcycle motor "// +
                              //" where lower(motoCategory.category) like #{pattern} "
                      ).getResultList();
              System.out.println("motorcyclesList : " + motorcyclesList.toString());
              //System.out.println("size of motorcycles is: " + motorcycles.size());
          }
          
          
         // @Factory("motorcyclesList")
          public List<Motorcycle> getMotorcyclesList() {
                      return motorcyclesList;
              }
      
      
      
              public void setMotorcyclesList(List<Motorcycle> motorcyclesList) {
                      this.motorcyclesList = motorcyclesList;
              }
      
      
              //@Factory("motor")
              public Motorcycle getMotor() {
                      return motor;
              }
      
      
      
              public void setMotor(Motorcycle motor) {
                      this.motor = motor;
              }
      
      
              //@Factory("motorcyclecategory")
              public String getMotorcyclecategory() {
              System.out.println("getMotorcyclecateg()");
                      return motorcyclecategory;
              }
      
      
              public void setMotorcyclecategory(String motorcyclecategory) {
                      System.out.println("setMotorcyclecateg()");
                      this.motorcyclecategory = motorcyclecategory;
              }
      
              
              //@Factory("price")
          public List<String> getPrice() {
              Integer priceInt = 0;
              
              while (priceInt <= 10000) {
                      this.price.add(priceInt.toString());
                      priceInt = priceInt + 2000;
              }
              while (priceInt <= 50000) {
                      this.price.add(priceInt.toString());
                      priceInt = priceInt + 5000;
              }
              this.price.add("More than 50000");
              
              
                      return price;
              }
      
      
              public void setPrice(List<String> price) {
                      
                      this.price = price;
              }
      
              //@Factory("fromPrice")
              public String getFromPrice() {
                      return fromPrice;
              }
      
      
              public void setFromPrice(String fromPrice) {
                      System.out.println("setFromPrice");
                      this.fromPrice = fromPrice;
              }
      
              //@Factory("toPrice")
              public String getToPrice() {
                      return toPrice;
              }
      
      
              public void setToPrice(String toPrice) {
                      this.toPrice = toPrice;
              }
      
              //@Factory("kilometers")
              public List<Integer> getKilometers() {    
                      Integer max  = 300000;
                      Integer min = 0;
                      while (min < max) {
                              kilometers.add(min);
                              min  = min + 5000;
                              
                      }
                      return kilometers;
              }
      
      
              public void setKilometers(List<Integer> kilometers) {
                      this.kilometers = kilometers;
              }
      
              //@Factory("registrationYears")
          public List<Integer> getRegistrationYears() {
              if (this.registrationYears != null || this.registrationYears.size() > 0) {
                      registrationYears = new ArrayList<Integer>();
              }
              BigInteger  year = (BigInteger ) entityManager.createNativeQuery(
                              "select year(current_date())" 
              ) .getSingleResult();
              for (Integer from = Integer.parseInt(year.toString()) - 50; from <= Integer.parseInt(year.toString()); from++) {
                      this.registrationYears.add(from);
              }
                      return registrationYears;
              }
      
      
              public void setRegistrationYears(List<Integer> registrationYears) {
                      this.registrationYears = registrationYears;
              }
              
          
              //@Factory("motorcycleCats")
          public List<String> getMotorcycleCats() {
                      System.out.println("getMotorcycleCats");
                      List<Motorcyclecateg> temp = new ArrayList<Motorcyclecateg>();
              
                      temp =   entityManager.createQuery(
                              "select motoCategory from  Motorcyclecateg motoCategory " 
                      ) .getResultList();
              
              
                      
              for(Motorcyclecateg cat: temp) {
                      motorcycleCats.add(cat.getCategory());
              }
              
              return motorcycleCats;
              }
          
              //@Factory("fromKilometers")
              public Integer getFromKilometers() {
                      return fromKilometers;
              }
      
      
              public void setFromKilometers(Integer fromKilometers) {
                      this.fromKilometers = fromKilometers;
              }
      
              //@Factory("toKilometers")
              public Integer getToKilometers() {
                      return toKilometers;
              }
      
      
              public void setToKilometers(Integer toKilometers) {
                      this.toKilometers = toKilometers;
              }
      
              //@Factory("fromYear")
              public Integer getFromYear() {
                      return fromYear;
              }
      
      
              public void setFromYear(Integer fromYear) {
                      this.fromYear = fromYear;
              }
      
              //@Factory("toYear")
              public Integer getToYear() {
                      return toYear;
              }
      
      
              public void setToYear(Integer toYear) {
                      this.toYear = toYear;
              }
              
              
              public void setMotorcycleCats(List<String> motorcycleCats) {
                      System.out.println("setMotorcycleCats");
                      this.motorcycleCats = motorcycleCats;
              }
              //@Factory("category")
          public String getCategory() {
                      return category;
              }
      
      
              public void setCategory(String category) {
                      this.category = category;
              }
      
              public void nextPage()
          {
             page++;
          }
          
              public void find() {
              page = 0;
              if (motorcycleCats != null) {
                      motorcycleCats.clear();
              }
          }
              
              public void validate(){
                      
              }
              
               public boolean isNextPageAvailable()
                 {
                    return motorcycleCats!=null && motorcycleCats.size()==pageSize;
                 }
      
              
          public String getSearchString() {
                      return searchString;
              }
      
              public void setSearchString(String searchString) {
                      this.searchString = searchString;
              }
      
              public int getPageSize() {
                      return pageSize;
              }
      
              public void setPageSize(int pageSize) {
                      this.pageSize = pageSize;
              }
      
              public int getPage() {
                      return page;
              }
      
              public void setPage(int page) {
                      this.page = page;
              }
      
              
              @Remove
              public void remove(){
                      
              }
              
              @Destroy
              public void destroy(){
                      
              }
      
      }
      
      



      Which implements the interface:



      package com.advert.sbeans;
      
      import java.util.List;
      
      import javax.ejb.Local;
      
      import com.advert.ebeans.Motorcycle;
      import com.advert.ebeans.Motorcyclecateg;
      @Local
      public interface MotorcycleAction {
              
              public String getCategory();
              public void setCategory(String category); 
              
              public void setMotor(Motorcycle motor) ;
              public Motorcycle getMotor() ;
              public void setMotorcyclecategory(String motorcyclecategory);
               public List<String> getPrice() ;
               public void setPrice(List<String> price);
               public String getFromPrice();
               public void setFromPrice(String fromPrice);
               public String getToPrice() ;
               public void setToPrice(String toPrice);
              public Integer getFromYear();
              public void setFromYear(Integer fromYear);
              public Integer getToYear();
              public void setToYear(Integer toYear);
              public void setRegistrationYears(List<Integer> registrationYears);
              public List<Integer> getKilometers();
              public void setKilometers(List<Integer> kilometers);
              public Integer getFromKilometers();
              public void setFromKilometers(Integer fromKilometers) ;
              public Integer getToKilometers() ;
              public void setToKilometers(Integer toKilometers);
               public List<Integer> getRegistrationYears();
              public void queryMotorcycles();
              
              
                public List<Motorcycle> getMotorcyclesList();
                public void setMotorcyclesList(List<Motorcycle> motorcyclesList);
      
              
               public void nextPage();
               public void find();
               public void validate();
               public boolean isNextPageAvailable();
                public String getSearchString();
               public void setSearchString(String searchString);
               public int getPageSize();
               public void setPageSize(int pageSize);
               public int getPage();
               public void setPage(int page);
               public List<String> getMotorcycleCats();
               public void setMotorcycleCats(List<String> motorcycleCats);
               public void remove();
      }
      
      



      And my xhtml page is:



      <!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
          "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
      <ui:composition xmlns="http://www.w3.org/1999/xhtml"
          xmlns:s="http://jboss.com/products/seam/taglib"
          xmlns:ui="http://java.sun.com/jsf/facelets"
          xmlns:f="http://java.sun.com/jsf/core"
          xmlns:h="http://java.sun.com/jsf/html"
          xmlns:rich="http://richfaces.org/rich"
          xmlns:a="http://richfaces.org/a4j"
          template="layout/template.xhtml">
      
      <ui:define name="body">  
      
              <f:facet name="header">motorcycleAction</f:facet>
              <h:form id="MotorcycleActionForm">
               
                       <fieldset> 
                       
                              <table border="1">
                                      <tr>
                                              <td>Select Category</td>
                                              <td><h:selectOneMenu id="selectedMotoCategory"
                                                              value="#{motorcycleService.category}" required="false" >
                                                              <s:selectItems id="selectMotoCategory"
                                                                      value="#{motorcycleService.motorcycleCats}" var="category"  
                                                                      label="#{category}"/>
                                                              </h:selectOneMenu> 
                                              </td>
                                      </tr>
                                      <tr>
                                              <td>From: </td>
                                              <td><h:selectOneMenu id="selectedFromYear"
                                                                      value="#{fromYear}" >
                                                                      <s:selectItems id="selectFromYear"
                                                                              value="#{motorcycleService.registrationYears}" var="fromYear"  
                                                                              label="#{fromYear}"/>
                                                                      </h:selectOneMenu>
                                              </td>
                                              <td>To:</td>
                                              <td><h:selectOneMenu id="selectedToYear" 
                                                                      value="toYear" >
                                                                      <s:selectItems id="selectToYear"
                                                                              value="#{motorcycleService.registrationYears}" var="toYear"  
                                                                              label="#{toYear}"/>
                                                                      </h:selectOneMenu>
                                              </td>
                                      </tr>
                                      <tr>
                                              <td>From Kms: </td>
                                              <td><h:selectOneMenu id="selectedFromKilometers"
                                                                      value="#{fromKilometers}" >
                                                                      <s:selectItems id="selectFromKilometers"
                                                                              value="#{motorcycleService.kilometers}" var="fromKilometers"  
                                                                              label="#{fromKilometers}"/>
                                                                      </h:selectOneMenu>
                                              </td> 
                                              <td>To Kms:</td>
                                              <td><h:selectOneMenu id="selectedToKilometers" 
                                                                      value="toKilometers" >
                                                                      <s:selectItems id="selectToKilometers"
                                                                              value="#{motorcycleService.kilometers}" var="toKilometers"  
                                                                              label="#{toKilometers}"/>
                                                                      </h:selectOneMenu>
                                              </td>
                                      </tr>
                                                                      <tr>
                                              <td>From Price: </td>
                                              <td><h:selectOneMenu id="selectedFromPrice"
                                                                      value="#{fromPrice}" >
                                                                      <s:selectItems id="selectFromPrice"
                                                                              value="#{motorcycleService.price}" var="fromPrice"  
                                                                              label="#{fromPrice}"/>
                                                                      </h:selectOneMenu>
                                              </td> 
                                              <td>To Price:</td>
                                              <td><h:selectOneMenu id="selectedToPrice" 
                                                                      value="toPrice" >
                                                                      <s:selectItems id="selectToPrice"
                                                                              value="#{motorcycleService.price}" var="toPrice"  
                                                                              label="#{toPrice}"/>
                                                                      </h:selectOneMenu>
                                              </td>
                                      </tr>
                                      <tr>
                                              <td>
                                                      Select Criteria
                                              </td>
                                              <td>
                                                       <h:inputText id="searchString" value="#{motorcycleService.searchString}" 
                                              style="width: 165px;">
                                              </h:inputText> 
                                              </td>
                                      </tr>
                                       
                                      <tr> 
                                              <td>
                                                      <h:commandButton id="searchMotorcycles" value="Find Motorcycles" 
                                                      action="#{motorcycleService.queryMotorcycles}" 
                                      reRender="motorcycleResults"/> 
                                              </td> 
                                      </tr>     
                              </table>  
      
                      </fieldset>
              </h:form>
                
       <a:outputPanel id="motorcycleResults">
        <div class="section">
          <h:outputText value="No Motorcycles Found"
                        rendered="#{motorcyclesList} != null and #{motorcyclesList}.rowCount==0}"/>
          <h:dataTable id="motorcyclesList" value="#{motorcyclesList}" var="motor" rendered="#{motorcyclesList.rowCount>0}">
              <h:column> 
                  <f:facet name="header">Name</f:facet>
                  #{motor.category}
              </h:column>
              <h:column> 
                  <f:facet name="header1">Price</f:facet>  
                  #{motor.price} 
              </h:column>
              <h:column> 
                  <f:facet name="header2">Model</f:facet>
                  #{motor.model}
              </h:column>
          </h:dataTable>
        
        </div>
      </a:outputPanel>
      
      
      </ui:define>
      
      </ui:composition>
      




      Any help would be much appreciated.


      Kind Regards,
      Ioannis

        • 1. Re: Properties of h:selectOneMenu tags become to null after button clicked
          ioannis ntantis Newbie

          Sorry forgot to paste the log file.


          Here is its content:



          javax.faces.FacesException: javax.el.ELException: /motorcycleSearchAction.xhtml @23,65 value="#{motorcycleService.category}": Error reading 'category' on type org.javassist.tmp.java.lang.Object_$$_javassist_5
               at javax.faces.component.UIOutput.getValue(UIOutput.java:187)
               at org.jboss.seam.ui.component.UISelectItems.getParentValue(UISelectItems.java:293)
               at org.jboss.seam.ui.component.UISelectItems.isShowNoSelectionLabel(UISelectItems.java:256)
               at org.jboss.seam.ui.component.UISelectItems.noSelectionLabel(UISelectItems.java:234)
               at org.jboss.seam.ui.component.UISelectItems.getValue(UISelectItems.java:154)
               at com.sun.faces.renderkit.RenderKitUtils.getSelectItems(RenderKitUtils.java:296)
               at com.sun.faces.renderkit.html_basic.MenuRenderer.renderSelect(MenuRenderer.java:801)
               at com.sun.faces.renderkit.html_basic.MenuRenderer.encodeEnd(MenuRenderer.java:280)
               at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:861)
               at javax.faces.component.UIComponent.encodeAll(UIComponent.java:946)
               at javax.faces.render.Renderer.encodeChildren(Renderer.java:148)
               at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:837)
               at javax.faces.component.UIComponent.encodeAll(UIComponent.java:936)
               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:196)
               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.IdentityFilter.doFilter(IdentityFilter.java:40)
               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:177)
               at org.ajax4jsf.webapp.BaseFilter.handleRequest(BaseFilter.java:267)
               at org.ajax4jsf.webapp.BaseFilter.processUploadsAndHandleRequest(BaseFilter.java:380)
               at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:507)
               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.web.HotDeployFilter.doFilter(HotDeployFilter.java:53)
               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:182)
               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(Unknown Source)
          Caused by: javax.el.ELException: /motorcycleSearchAction.xhtml @23,65 value="#{motorcycleService.category}": Error reading 'category' on type org.javassist.tmp.java.lang.Object_$$_javassist_5
               at com.sun.facelets.el.TagValueExpression.getValue(TagValueExpression.java:76)
               at javax.faces.component.UIOutput.getValue(UIOutput.java:184)
               ... 61 more
          Caused by: javax.ejb.EJBTransactionRolledbackException: could not set field value: motorcycleService.fromYear
               at org.jboss.ejb3.tx.Ejb3TxPolicy.handleInCallerTx(Ejb3TxPolicy.java:87)
               at org.jboss.aspects.tx.TxPolicy.invokeInCallerTx(TxPolicy.java:130)
               at org.jboss.aspects.tx.TxInterceptor$Required.invoke(TxInterceptor.java:195)
               at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
               at org.jboss.aspects.tx.TxPropagationInterceptor.invoke(TxPropagationInterceptor.java:95)
               at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
               at org.jboss.ejb3.stateful.StatefulInstanceInterceptor.invoke(StatefulInstanceInterceptor.java:83)
               at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
               at org.jboss.aspects.security.AuthenticationInterceptor.invoke(AuthenticationInterceptor.java:77)
               at org.jboss.ejb3.security.Ejb3AuthenticationInterceptor.invoke(Ejb3AuthenticationInterceptor.java:110)
               at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
               at org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:46)
               at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
               at org.jboss.ejb3.asynchronous.AsynchronousInterceptor.invoke(AsynchronousInterceptor.java:106)
               at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
               at org.jboss.ejb3.stateful.StatefulContainer.localInvoke(StatefulContainer.java:206)
               at org.jboss.ejb3.stateful.StatefulLocalProxy.invoke(StatefulLocalProxy.java:119)
               at $Proxy99.getCategory(Unknown Source)
               at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
               at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
               at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
               at java.lang.reflect.Method.invoke(Unknown Source)
               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.ClientSideInterceptor$1.proceed(ClientSideInterceptor.java:76)
               at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:56)
               at org.jboss.seam.ejb.RemoveInterceptor.aroundInvoke(RemoveInterceptor.java:43)
               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.ClientSideInterceptor.invoke(ClientSideInterceptor.java:54)
               at org.javassist.tmp.java.lang.Object_$$_javassist_5.getCategory(Object_$$_javassist_5.java)
               at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
               at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
               at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
               at java.lang.reflect.Method.invoke(Unknown Source)
               at javax.el.BeanELResolver.getValue(BeanELResolver.java:62)
               at javax.el.CompositeELResolver.getValue(CompositeELResolver.java:53)
               at com.sun.faces.el.FacesCompositeELResolver.getValue(FacesCompositeELResolver.java:72)
               at org.jboss.el.parser.AstPropertySuffix.getValue(AstPropertySuffix.java:53)
               at org.jboss.el.parser.AstValue.getValue(AstValue.java:67)
               at org.jboss.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:186)
               at com.sun.facelets.el.TagValueExpression.getValue(TagValueExpression.java:71)
               ... 62 more
          Caused by: java.lang.IllegalArgumentException: could not set field value: motorcycleService.fromYear
               at org.jboss.seam.Component.setFieldValue(Component.java:1894)
               at org.jboss.seam.Component.access$600(Component.java:127)
               at org.jboss.seam.Component$BijectedField.set(Component.java:2902)
               at org.jboss.seam.Component.injectAttributes(Component.java:1703)
               at org.jboss.seam.Component.inject(Component.java:1521)
               at org.jboss.seam.core.BijectionInterceptor.aroundInvoke(BijectionInterceptor.java:61)
               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.persistence.EntityManagerProxyInterceptor.aroundInvoke(EntityManagerProxyInterceptor.java:29)
               at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
               at org.jboss.seam.persistence.HibernateSessionProxyInterceptor.aroundInvoke(HibernateSessionProxyInterceptor.java:31)
               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.SessionBeanInterceptor.aroundInvoke(SessionBeanInterceptor.java:50)
               at sun.reflect.GeneratedMethodAccessor113.invoke(Unknown Source)
               at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
               at java.lang.reflect.Method.invoke(Unknown Source)
               at org.jboss.ejb3.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:118)
               at org.jboss.ejb3.interceptor.EJB3InterceptorsInterceptor.invoke(EJB3InterceptorsInterceptor.java:63)
               at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
               at org.jboss.ejb3.entity.ExtendedPersistenceContextPropagationInterceptor.invoke(ExtendedPersistenceContextPropagationInterceptor.java:57)
               at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
               at org.jboss.ejb3.entity.TransactionScopedEntityManagerInterceptor.invoke(TransactionScopedEntityManagerInterceptor.java:54)
               at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
               at org.jboss.ejb3.AllowedOperationsInterceptor.invoke(AllowedOperationsInterceptor.java:47)
               at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
               at org.jboss.aspects.tx.TxPolicy.invokeInCallerTx(TxPolicy.java:126)
               ... 104 more
          Caused by: java.lang.IllegalArgumentException: Could not set field value by reflection: MotorcycleActionImpl.fromYear on: com.advert.sbeans.MotorcycleActionImpl with value: class java.lang.String
               at org.jboss.seam.util.Reflections.set(Reflections.java:86)
               at org.jboss.seam.Component.setFieldValue(Component.java:1890)
               ... 131 more
          Caused by: java.lang.IllegalArgumentException: Can not set java.lang.Integer field com.advert.sbeans.MotorcycleActionImpl.fromYear to java.lang.String
               at sun.reflect.UnsafeFieldAccessorImpl.throwSetIllegalArgumentException(Unknown Source)
               at sun.reflect.UnsafeFieldAccessorImpl.throwSetIllegalArgumentException(Unknown Source)
               at sun.reflect.UnsafeObjectFieldAccessorImpl.set(Unknown Source)
               at java.lang.reflect.Field.set(Unknown Source)
               at org.jboss.seam.util.Reflections.set(Reflections.java:71)
               ... 132 more
          
          


          Thanks,
          giannis

          • 2. Re: Properties of h:selectOneMenu tags become to null after button clicked
            Aldo Bonzi Novice

            I think your problem can come from the fact that sometimes you are not passing a valid argument in the h:selectOneMenu's value property.
            toprice, tokilometer and toYear are not valid SEAM EL, so maybe if you replace it by #{toprice}, #{tokilometer} and #{toYear} could work