0 Replies Latest reply on Apr 27, 2009 3:44 PM by Kevin Erhardt

    f:convertNumber IllegalArgumentException in seam 2

    Kevin Erhardt Newbie

      Hello community,


      Im currently migrate step by step an application from seam 1.2 to seam 2, and now I have some problems with the legacy jsf code. For conversion and formatting Im using f:convertNumber. In the seam 1.2 it works fine but in seam 2.1.2CR1 version it works wrong. Seam throw always the IllegalArgumentException on fields favoriteNumber and Integer if I submit the form.


      My Code:
      ---------------------------------------------------------------
      Entity Class


      ...
      @Entity
      public class Contact
      {
         @Column(precision = 10, scale = 2)
         private double weight;
         private int favoriteNumber;
         private Integer counter;
      ...
      }



      JSF Code:


      ...
      <h:inputText id="weight" value="#{contact.weight}">
        <f:convertNumber locale="de" maxFractionDigits="2" minFractionDigits="2" />
      </h:inputText>
      ...
      <h:inputText id="number" value="#{contact.favoriteNumber}">
        <f:convertNumber integerOnly="true" />
      </h:inputText>
      ...
      <h:inputText id="counter" value="#{contact.counter}">
        <f:convertNumber integerOnly="true" />
      </h:inputText>
      ...
      <h:commandLink id="updateContact" action="#{contactHome.update}" value="Update Contact" rendered="#{contactHome.managed}"/>
      ...



      Exception:


      SCHWERWIEGEND: /editContact.xhtml @112,65 value="#{contact.favoriteNumber}": java.lang.IllegalArgumentException: argument type mismatch
      ...
      SCHWERWIEGEND: /editContact.xhtml @122,59 value="#{contact.counter}": java.lang.IllegalArgumentException: argument type mismatch
      java.lang.IllegalArgumentException: argument type mismatch
           at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
           at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
           at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
           at java.lang.reflect.Method.invoke(Method.java:597)
           at javax.el.BeanELResolver.setValue(BeanELResolver.java:108)
           at javax.el.CompositeELResolver.setValue(CompositeELResolver.java:68)
           at com.sun.faces.el.FacesCompositeELResolver.setValue(FacesCompositeELResolver.java:100)
           at org.jboss.el.parser.AstPropertySuffix.setValue(AstPropertySuffix.java:73)
           at org.jboss.el.parser.AstValue.setValue(AstValue.java:84)
           at org.jboss.el.ValueExpressionImpl.setValue(ValueExpressionImpl.java:249)
           at com.sun.facelets.el.TagValueExpression.setValue(TagValueExpression.java:93)
           at javax.faces.component.UIInput.updateModel(UIInput.java:771)
           at javax.faces.component.UIInput.processUpdates(UIInput.java:703)
           at javax.faces.component.UIComponentBase.processUpdates(UIComponentBase.java:1081)
           at javax.faces.component.UIComponentBase.processUpdates(UIComponentBase.java:1081)
           at javax.faces.component.UIForm.processUpdates(UIForm.java:261)
           at javax.faces.component.UIComponentBase.processUpdates(UIComponentBase.java:1081)
           at javax.faces.component.UIViewRoot.processUpdates(UIViewRoot.java:727)
           at com.sun.faces.lifecycle.UpdateModelValuesPhase.execute(UpdateModelValuesPhase.java:78)
           at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:100)
           at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
           at javax.faces.webapp.FacesServlet.service(FacesServlet.java:265)
           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.LoggingFilter.doFilter(LoggingFilter.java:58)
           at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
           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.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.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
           at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
           at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
           at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
           at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
           at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:262)
           at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
           at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
           at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:446)
           at java.lang.Thread.run(Thread.java:637
      ...



      In the previous version of my code, seam throws the exception on weight field too, After that I changed the type from java.lang.Double to double.


      here I found a solution, but without formatting :(


      Do anybody now, how I can fix this problem?


      Kevin