1 2 Previous Next 18 Replies Latest reply on Jun 23, 2008 7:33 PM by baspet

    Dates and Seam 2.0.1.GA problem

      hi,
      I am using Seam 2.0.1.GA, JBoss 4.2.2 and RichFaces 3.1.4.GA.



      In a list page I want to filter by a date value using a java.util.date property in the backing bean.


      This is code from the xhtml page:



           <h:form id="instrumentFundExSearch" styleClass="edit">
              <rich:simpleTogglePanel label="#{messages['InstrumentFundEx']}: #{messages['search.parameters']}" switchType="ajax">
              
                  
                  <s:decorate template="layout/display.xhtml">
                      <ui:define name="label">#{messages['NavDate']}</ui:define>
                      <h:inputText id="navDate" value="#{instrumentFundExList.instrumentFundEx.id.navDate}">
                          <s:convertDateTime pattern="#{constantes.datePattern}"/>
                      </h:inputText>
                  </s:decorate>
      
              </rich:simpleTogglePanel>
              <br></br>
      <s:div styleClass="actionButtons" >
      <h:commandButton id="search" value="#{messages['Search']}" action="/InstrumentFundExList.xhtml"/>
          </s:div>
              
          </h:form>
      
      



      constantes.datePattern value is this: dd/MM/yyyy


      On the other hand in the page.xml I have:


      <param name="navDate" value="#{instrumentFundExList.instrumentFundEx.id.navDate}"/>   
      




      And java class code snippet is the following:


      ...
      import java.util.Date;
      ...
      
      @Name("instrumentFundExList")
      public class InstrumentFundExList extends EntityQuery {
      
              private Date navDateCompos;
      
           private static final String[] RESTRICTIONS = {
                              "lower(instrumentFundEx.id.entityGroupCode) like concat(lower(#{instrumentFundExList.instrumentFundEx.id.entityGroupCode}),'%')",
                     "instrumentFundEx.id.navDate = #{instrumentFundExList.instrumentFundEx.id.navDate}",
              };
      



      And instrumentFundExList.instrumentFundEx.id.navDate related code is this: (generated by means of seam-gen)


      public class InstrumentFundExId implements java.io.Serializable {
      private Date navDate;
      
           @Temporal(TemporalType.DATE)
              @Column(name = "nav_date", nullable = false, length = 23)
           @NotNull
           public Date getNavDate() {
                return this.navDate;
           }
      
           public void setNavDate(Date navDate) {
                this.navDate = navDate;
           }
      



      This is the log after filling with a date (20/03/2007)


      12:37:05,203 ERROR [SeamPhaseListener] uncaught exception
      javax.el.ELException: java.lang.IllegalArgumentException: java.lang.ClassCastException@1056bdd
              at javax.el.BeanELResolver.setValue(BeanELResolver.java:116)
              at javax.el.CompositeELResolver.setValue(CompositeELResolver.java:68)
      
      ...
      
      Caused by: java.lang.IllegalArgumentException: java.lang.ClassCastException@1056bdd
              at sun.reflect.GeneratedMethodAccessor326.invoke(Unknown Source)
      ..
      '
      




      Filtering by the date field does not work, on top of that after pressing Search button the value that has been field dissapears.
      What puzzles me is that same code works with my previous Seam 1.2.1 version !!




      I am using java.util.date that has always worked for me, I really do not understand why is there a

      javax.el.ELException: java.lang.IllegalArgumentException: argument type mismatch


      Any idea? I also have tried with Rich:Calendar with no success. In this link is a thread in the RichFaces users forum.
      I think it is a problem of Date conversions. Is not any longer java.util.date the way to do this. At least in Seam 1.2.1 I´ve used it without needing using a long for filtering.



      thanks in advance!!


        • 1. Re: Dates and Seam 2.0.1.GA problem
          mthiago

          Look in the InstrumentFundExId class if the Date type is java.util.Date.


          I don't know why the seam-gen create another Date type for the entity beans instead of java.util.Date.

          • 2. Re: Dates and Seam 2.0.1.GA problem

            Hi,
            the Date in InstrumentFundExId is a java.util.Date. I forgot to paste that import code in the snippet:


            import java.util.Date;
            



            And forget the line


            private Date navDateCompos;
            
            


            I added java.util.Date navDateCompos for a test, to try to assign to it instead of assigning the date to instrumentFundExList.instrumentFundEx.id.navDate, but howewer both are java.util.dates none of them work.


            any suggestion? thanks!



            • 3. Re: Dates and Seam 2.0.1.GA problem

              I have the same issue with the date filter


              I have the seam-gen generated: RegisterList.java, RegisterList.hxtml and RegisterList.page.xml based on an entity Register.java.


              Inside the Register entity I have a java.util.Date field that I want to use to filter the resultList().
              For the same page I use other types of filters: numerical, boolean, even a relationship an they work perfect.


              !On the .xhtml page I use rich:calendar as the rendering component!


              The problem seems to appear like this:
              - if I set the value of the date filter with an implicit value from the backing bean, the filter goes OK
              - if on the page the date field is set to a value other than null I get the
              javax.el.ELException: java.lang.IllegalArgumentException: argument type mismatch
                   at javax.el.BeanELResolver.setValue(BeanELResolver.java:116)
              exception


              In other words:
              - the problem appears when I submit a value for the date field from the .xhtml page
              - the exception is generated when rendering the result page, after the hibernate query returns successfully


              !!! My best guess is that the calendar doesn't know how to update it's value when it's value is not null !!!

              • 4. Re: Dates and Seam 2.0.1.GA problem

                Viorel, I would like to say you I´ve found a solution, but I haven´t.
                I tried with Rich:calendar and without success , as happened with using plain s:convertDateTime:


                <s:decorate template="layout/display.xhtml">
                                <ui:define name="label">#{messages['NavDate']}</ui:define>
                                <h:inputText id="navDate" value="#{instrumentFundExList.instrumentFundEx.id.navDate}">
                                    <s:convertDateTime pattern="#{constantes.datePattern}"/>
                                </h:inputText>
                            </s:decorate>
                



                and this trying with Rich:calendar:


                            <rich:calendar value="#{instrumentFundExList.instrumentFundEx.id.navDate}"
                                           ajaxSingle="true" 
                                           id="idNavDate" 
                                           popup="true"     
                                           datePattern="#{constantes.datePattern}"
                                           inputSize="23" 
                                           >



                Filtering works perfect with other types, but fails with Date.
                anyone has managed to filter using a Date field?
                any ideawill be welcomed!

                • 5. Re: Dates and Seam 2.0.1.GA problem
                  pmuir

                  Post the whole stack trace.

                  • 6. Re: Dates and Seam 2.0.1.GA problem
                    • 7. Re: Dates and Seam 2.0.1.GA problem

                      Here's what I did:


                      1. add a date field in the List entity


                      in my case I added


                      private Date registerDate = null;


                      to


                      RegisterList extends EntityQuery<Register>


                      2. generate getter and setter to access this field from the page


                      public Date getRegisterDate() {
                                return null;
                           }
                      
                      public void setRegisterDate(Date registerDate) {
                                this.registerDate = registerDate;
                           }


                      3. generate getter to use in the String[] RESTRICTIONS = {} field


                      public Date getFakeRegisterDate() {
                                return registerDate;
                           }


                      4. add @Scope(ScopeType.CONVERSATION) to the class and now it should work except that it doesn't persist the date field between pages(it is always null because the bug only appears when the calendar -js-object has the selectedDate property set to something other than null)

                      • 8. Re: Dates and Seam 2.0.1.GA problem

                        And here is the whole stack trace without using Rich:Calendar.


                        12:48:43,519 ERROR [SeamPhaseListener] uncaught exception
                        javax.el.ELException: java.lang.IllegalArgumentException: java.lang.ClassCastException@1d7b0
                                at javax.el.BeanELResolver.setValue(BeanELResolver.java:116)
                                at javax.el.CompositeELResolver.setValue(CompositeELResolver.java:68)
                                at com.sun.faces.el.FacesCompositeELResolver.setValue(FacesCompositeELResolver.java:93)
                                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 org.jboss.seam.core.Expressions$1.setValue(Expressions.java:116)
                                at org.jboss.seam.navigation.Pages.applyConvertedValidatedValuesToModel(Pages.java:781)
                                at org.jboss.seam.navigation.Pages.postRestore(Pages.java:402)
                                at org.jboss.seam.jsf.SeamPhaseListener.postRestorePage(SeamPhaseListener.java:533)
                                at org.jboss.seam.jsf.SeamPhaseListener.afterRestoreView(SeamPhaseListener.java:379)
                                at org.jboss.seam.jsf.SeamPhaseListener.afterServletPhase(SeamPhaseListener.java:216)
                                at org.jboss.seam.jsf.SeamPhaseListener.afterPhase(SeamPhaseListener.java:182)
                                at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:280)
                                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.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.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:73)
                                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.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:179)
                                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(Thread.java:619)
                        Caused by: java.lang.IllegalArgumentException: java.lang.ClassCastException@1d7b0
                                at sun.reflect.GeneratedMethodAccessor2701.invoke(Unknown Source)
                                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)
                                ... 51 more
                        12:48:43,910 ERROR [Exceptions] Can't find exception class for exception handler
                        java.lang.ClassNotFoundException: No ClassLoaders found for: com.sun.facelets.FaceletViewHandler.handleRenderException
                                at org.jboss.mx.loading.LoadMgr3.beginLoadTask(LoadMgr3.java:306)
                                at org.jboss.mx.loading.RepositoryClassLoader.loadClassImpl(RepositoryClassLoader.java:521)
                                at org.jboss.mx.loading.RepositoryClassLoader.loadClass(RepositoryClassLoader.java:415)
                                at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
                        
                                at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
                                at java.lang.Class.forName0(Native Method)
                                at java.lang.Class.forName(Class.java:169)
                                at org.jboss.seam.util.Reflections.classForName(Reflections.java:165)
                                at org.jboss.seam.exception.Exceptions.parse(Exceptions.java:139)
                                at org.jboss.seam.exception.Exceptions.initialize(Exceptions.java:97)
                                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 org.jboss.seam.util.Reflections.invoke(Reflections.java:21)
                                at org.jboss.seam.util.Reflections.invokeAndWrap(Reflections.java:125)
                                at org.jboss.seam.Component.callComponentMethod(Component.java:2082)
                                at org.jboss.seam.Component.callCreateMethod(Component.java:2005)
                                at org.jboss.seam.Component.newInstance(Component.java:1976)
                                at org.jboss.seam.Component.getInstance(Component.java:1873)
                                at org.jboss.seam.Component.getInstance(Component.java:1852)
                                at org.jboss.seam.Component.getInstance(Component.java:1829)
                                at org.jboss.seam.Component.getInstance(Component.java:1824)
                                at org.jboss.seam.exception.Exceptions.instance(Exceptions.java:196)
                                at org.jboss.seam.jsf.SeamPhaseListener.afterPhase(SeamPhaseListener.java:190)
                                at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:280)
                                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.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.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:73)
                                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.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:179)
                                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(Thread.java:619)
                        12:48:44,410 ERROR [CachedConnectionValve] Application error: Faces Servlet did not complete its transaction
                        
                        



                        If it is not possible to filter with java.util.Date no matter if using or not Rich:Calendar I wonder if there is something strange with date processing in Seam 2.0.1.GA.
                        Pete, If you would like me to provide more code just tell me, (although I warn you that tomorrow I´ll go to spend a week on holiday, by the way, to your place Edinburgh) :)
                        thanks in advance!

                        • 9. Re: Dates and Seam 2.0.1.GA problem
                          pmuir

                          Have you tried specifying a converter in pages.xml?

                          • 10. Re: Dates and Seam 2.0.1.GA problem

                            Try to use java.util.Calendar instead of java.util.Date in the backing bean

                            • 11. Re: Dates and Seam 2.0.1.GA problem

                              I´ve tried with java.util.Calendar without success. This is the code.


                              //Code from InstrumentFundExList.xhtml


                                  <h:messages globalOnly="true" styleClass="message" id="globalMessages"/>
                                   <h:form id="instrumentFundExSearch" styleClass="edit">
                                      <rich:simpleTogglePanel label="#{messages['InstrumentFundEx']}: #{messages['search.parameters']}" switchType="ajax">
                                      
                                          <rich:calendar value="#{instrumentFundExList.navDateCalendar}"
                                                         ajaxSingle="true" 
                                                         id="idNavDate" 
                                                         popup="true"     
                                                         datePattern="#{constantes.datePattern}"
                                                         inputSize="20" 
                                                         currentDate=""
                                                         >
                                          </rich:calendar>                
                                      </rich:simpleTogglePanel>
                                      <br></br>
                              <s:div styleClass="actionButtons" >
                              <h:commandButton id="search" value="#{messages['Search']}" action="/InstrumentFundExList.xhtml"/>
                                  </s:div>
                                  </h:form>
                              


                              //Code from InstrumentFundExList.page.xml


                              <param name="idNavDate" value="#{instrumentFundExList.navDateCalendar}"/>
                              



                              //Code from InstrumentFundExList.java


                              import java.util.Calendar;
                              ...
                              @Name("instrumentFundExList")
                              public class InstrumentFundExList extends EntityQuery {
                                      private Calendar navDateCalendar;
                              
                                  public Calendar getNavDateCalendar() {
                                      return navDateCalendar;
                                  }
                              
                                  public void setNavDateCalendar(Calendar navDateCalendar) {
                                      this.navDateCalendar = navDateCalendar;
                                  }        
                                  
                                      @Override        
                                      @SuppressWarnings("unchecked")
                                      public List getResultList()  {
                                          List listados  = null;
                                          try {
                                          System.out.println("instrumentFundExList - navDateCalendar: "+navDateCalendar);                
                              
                                            if (this.getNavDateCalendar() == null ) {
                                                  System.out.println("navDateCalendar is NULL!!!!!!!!!!!!");
                                                  //ASSIGN A DEFAULT DATE ...
                                                  ....
                                                  System.out.println("instrumentFundExList default date asigned!!!");
                               
                                              } else {
                                                  System.out.println("¡¡¡¡¡¡¡¡¡navDateCalendar-->" + navDateCalendar + "<--");
                                                  this.getInstrumentFundEx().getId().setNavDate(navDateCalendar.getTime());
                                              }
                              
                                          listados = super.getResultList();
                              
                                          }
                                          catch (Exception ex) {
                                              ex.printStackTrace();
                                              System.out.println("Exception instrumentFundExList------->"+ex.getMessage()+"<--");
                                          }
                                          return listados;
                                          
                                      }
                              

                                 



                              And this is from the log:


                              17:05:00,968 INFO  [STDOUT] navDateCalendar is NULL!!!!!!!!!!!!
                              17:05:00,968 INFO  [STDOUT] instrumentFundExList default date asigned!!!
                              17:05:01,171 INFO  [lifecycle] WARNING: FacesMessage(s) have been enqueued, but may not have been displayed.
                              sourceId=instrumentFundExSearch:idNavDate[severity=(ERROR 2), summary=(/InstrumentFundExList.xhtml @34,29 value="#{instrumentFundExList.navDateCalendar}": java.lang.IllegalArgumentException: argument type mismatch), detail=(/InstrumentFundExList.xhtml @34,29 value="#{instrumentFundExList.navDateCalendar}": java.lang.IllegalArgumentException: argument type mismatch)]
                              



                              I wonder what am I doing wrong, because I´ve read here
                              http://jira.jboss.com/jira/browse/RF-2578?page=comments#action_12404004
                              that this is not supposed to happen with java.util.Calendar.


                              thank you in advance!


                              • 12. Re: Dates and Seam 2.0.1.GA problem

                                Pete, about converters, I´m not sure what do you mean.
                                I tried with 


                                <s:convertDateTime pattern="dd/MM/yyyy"/> 
                                



                                what I guess you mean something different.


                                thanks!

                                • 13. Re: Dates and Seam 2.0.1.GA problem
                                  pmuir
                                  <param name="foo" value="#{bar.foo}" converter-id="org.jboss.seam.ui.DateTimeConverter" />

                                  • 14. Re: Dates and Seam 2.0.1.GA problem

                                    In spite of using that I keep on having a argument type mismatch  problem. I reproduce the matter in 3 simple test cases.¨


                                    FIRST TEST CASE


                                    Code in .xhtml: (navDate is java.util.Date)


                                                <rich:calendar value="#{instrumentFundExList.instrumentFundEx.id.navDate}"
                                                               ajaxSingle="true" 
                                                               id="idNavDate" 
                                                               popup="true"     
                                                               datePattern="#{constantes.datePattern}"
                                                               inputSize="20" 
                                                               currentDate=""
                                                               >
                                                </rich:calendar>                
                                    



                                    Code in page.xml: (navDate is java.util.Date)


                                    <param name="idNavDate" value="#{instrumentFundExList.instrumentFundEx.id.navDate}" converter-id="org.jboss.seam.ui.DateTimeConverter" />
                                    



                                    Query and restrictions defined in pojolist.java: (getResultList has not been overriden and both
                                    instrumentFundEx.id.navDate and instrumentFundExList.instrumentFundEx.id.navDate are java.util.date)


                                         @Override
                                         public String getEjbql() {
                                              return "select instrumentFundEx from InstrumentFundEx instrumentFundEx";
                                         }
                                         
                                         private static final String[] RESTRICTIONS = {
                                                   "instrumentFundEx.id.navDate = #{instrumentFundExList.instrumentFundEx.id.navDate}",};
                                    

                                                   
                                    When pressing search button this is what happens:


                                    12:48:10,937 ERROR [SeamPhaseListener] uncaught exception
                                    javax.el.ELException: java.lang.IllegalArgumentException: java.lang.ClassCastException@1d5e3a3
                                            at javax.el.BeanELResolver.setValue(BeanELResolver.java:116)
                                            at javax.el.CompositeELResolver.setValue(CompositeELResolver.java:68)
                                            at com.sun.faces.el.FacesCompositeELResolver.setValue(FacesCompositeELResolver.java:93)
                                            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 org.jboss.seam.core.Expressions$1.setValue(Expressions.java:116)
                                            at org.jboss.seam.navigation.Pages.applyConvertedValidatedValuesToModel(Pages.java:781)
                                            at org.jboss.seam.navigation.Pages.postRestore(Pages.java:402)
                                            at org.jboss.seam.jsf.SeamPhaseListener.postRestorePage(SeamPhaseListener.java:533)
                                            at org.jboss.seam.jsf.SeamPhaseListener.afterRestoreView(SeamPhaseListener.java:379)
                                            at org.jboss.seam.jsf.SeamPhaseListener.afterServletPhase(SeamPhaseListener.java:216)
                                            at org.jboss.seam.jsf.SeamPhaseListener.afterPhase(SeamPhaseListener.java:182)
                                            at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:280)
                                            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.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.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:73)
                                            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.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:179)
                                            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(Thread.java:619)
                                    Caused by: java.lang.IllegalArgumentException: java.lang.ClassCastException@1d5e3a3
                                            at sun.reflect.GeneratedMethodAccessor4476.invoke(Unknown Source)
                                            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)
                                            ... 51 more
                                    12:48:11,312 ERROR [Exceptions] Can't find exception class for exception handler
                                    java.lang.ClassNotFoundException: No ClassLoaders found for: com.sun.facelets.FaceletViewHandler.handleRenderException
                                            at org.jboss.mx.loading.LoadMgr3.beginLoadTask(LoadMgr3.java:306)
                                            at org.jboss.mx.loading.RepositoryClassLoader.loadClassImpl(RepositoryClassLoader.java:521)
                                            at org.jboss.mx.loading.RepositoryClassLoader.loadClass(RepositoryClassLoader.java:415)
                                            at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
                                            at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
                                            at java.lang.Class.forName0(Native Method)
                                            at java.lang.Class.forName(Class.java:169)
                                            at org.jboss.seam.util.Reflections.classForName(Reflections.java:165)
                                            at org.jboss.seam.exception.Exceptions.parse(Exceptions.java:139)
                                            at org.jboss.seam.exception.Exceptions.initialize(Exceptions.java:97)
                                            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 org.jboss.seam.util.Reflections.invoke(Reflections.java:21)
                                            at org.jboss.seam.util.Reflections.invokeAndWrap(Reflections.java:125)
                                            at org.jboss.seam.Component.callComponentMethod(Component.java:2082)
                                            at org.jboss.seam.Component.callCreateMethod(Component.java:2005)
                                            at org.jboss.seam.Component.newInstance(Component.java:1976)
                                            at org.jboss.seam.Component.getInstance(Component.java:1873)
                                            at org.jboss.seam.Component.getInstance(Component.java:1852)
                                            at org.jboss.seam.Component.getInstance(Component.java:1829)
                                            at org.jboss.seam.Component.getInstance(Component.java:1824)
                                            at org.jboss.seam.exception.Exceptions.instance(Exceptions.java:196)
                                            at org.jboss.seam.jsf.SeamPhaseListener.afterPhase(SeamPhaseListener.java:190)
                                            at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:280)
                                            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.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.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:73)
                                            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.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:179)
                                            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(Thread.java:619)
                                    12:48:11,328 ERROR [CachedConnectionValve] Application error: Faces Servlet did not complete its transaction
                                    



                                    SECOND TEST CASE


                                    I´ve overriden getResultList this way:


                                        @Override
                                        public List getResultList() {
                                            List listados = null;
                                            try {
                                                System.out.println("instrumentFundExList - navDateCompos: " + navDateCompos);
                                                this.getInstrumentFundEx().getId().setNavDate(navDateCompos);
                                                System.out.println("date asigned!!! instrumentFundExList.instrumentFundEx.id.navDate:" + getInstrumentFundEx().getId().getNavDate());
                                                listados = super.getResultList();
                                                System.out.println("QUERY OK, LIST SIZE:" + listados.size());
                                            } catch (Exception ex) {
                                                ex.printStackTrace();
                                                System.out.println("Exception instrumentFundExList------->" + ex.getMessage() + "<--");
                                            }
                                            return listados;
                                        }
                                    



                                    The Date is received by the backing bean and super.getResultList is executed, howewer javax.el.ELException: java.lang.IllegalArgumentException: argument type mismatch appears!


                                    This is StackTrace:


                                    13:06:02,031 INFO  date asigned!!! navDate: Tue Mar 11 00:00:00 CET 2008


                                    13:06:02,031 INFO  QUERY OK, LIST SIZE:0


                                    13:06:02,031 INFO  date asigned!!! navDate: Tue Mar 11 00:00:00 CET 2008


                                    13:06:02,031 INFO  QUERY OK, LIST SIZE:0



                                    13:06:06,562 ERROR SeamPhaseListener uncaught exception
                                    javax.el.ELException: java.lang.IllegalArgumentException: argument type mismatch (SAME AS BEFORE)



                                    THIRD TEST CASE
                                    I´ve overriden getResultList to assign a default value, no matter what has the user entered:


                                        @Override
                                        public List getResultList() {
                                            List listados = null;
                                            try {
                                                    GregorianCalendar gCal = new GregorianCalendar(2005,11,25);                    
                                                   System.out.println("gCal.getTime()-->" + gCal.getTime()+"<--");
                                                    System.out.println("YEAR: " + gCal.get(Calendar.YEAR));
                                                    System.out.println("MONTH: " + gCal.get(Calendar.MONTH));
                                                    System.out.println("DAY_OF_MONTH: " + gCal.get(Calendar.DAY_OF_MONTH));
                                                    this.getInstrumentFundEx().getId().setNavDate(gCal.getTime());
                                                System.out.println("date asigned!!! instrumentFundExList.instrumentFundEx.id.navDate-->" + getInstrumentFundEx().getId().getNavDate() + "<--");
                                                listados = super.getResultList();
                                                System.out.println("QUERY OK, LIST SIZE:------->" + listados.size() + "<--");
                                            } catch (Exception ex) {
                                                ex.printStackTrace();
                                                System.out.println("Exception instrumentFundExList------->" + ex.getMessage() + "<--");
                                            }
                                            return listados;
                                        }            
                                      

                                     


                                    The default value is asigned to the backing bean and super.getResultList is executed, howewer javax.el.ELException: java.lang.IllegalArgumentException: argument type mismatch appears!
                                    When page is loaded, default value is asigned and it works.



                                    13:26:56,312 INFO  gCal.getTime() Sun Dec 25 00:00:00 CET 2005


                                    13:26:56,312 INFO  YEAR: 2005


                                    13:26:56,312 INFO  MONTH: 11


                                    13:26:56,312 INFO  DAYOFMONTH: 25


                                    13:26:56,312 INFO  date asigned!!! instrumentFundExList.instrumentFundEx.id.navDate Sun Dec 25 00:00:00 CET 2005


                                    13:26:56,312 INFO  QUERY OK, LIST SIZE:0



                                    But when pressing search button...


                                    13:27:26,562 ERROR SeamPhaseListener uncaught exception
                                    javax.el.ELException: java.lang.IllegalArgumentException: argument type mismatch (SAME AS BEFORE)


                                    I do wonder what is wrong here. This is the code of that date property in the backing bean:



                                    private Date navDate;
                                    
                                         @Temporal(TemporalType.DATE)      @TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED)  //tried with and withouth this
                                            @Column(name = "nav_date", nullable = false, length = 23)
                                         @NotNull
                                         public Date getNavDate() {
                                              return this.navDate;
                                         }
                                    
                                         public void setNavDate(Date navDate) {
                                              this.navDate = navDate;
                                         }
                                    



                                    please any idea? thanks in advance!

                                    1 2 Previous Next