1 Reply Latest reply on Mar 17, 2009 9:05 AM by Ilya Shaikovsky

    issue of rich calendar organizer using datamodel

    chinni akoju Newbie

      Hi,

      I'm using jboss-4.2.2.GA, richfaces-3.3.0.GA

      Currently, I'm facing problem while using rich calendar organizer with datamodel

      Code:

      <rich:calendar value="#{timeDataBean.selectedDate}"
      popup="false" showApplyButton="false"
      cellWidth="100px" cellHeight="100px"
      boundaryDatesMode="none" showWeeksBar="false"
      dataModel="#{timeDataModelImpl}" reRender="#{timeDataModelImpl}" onchanged="if (event.rich.date) {ajaxSubmit();}" oncurrentdateselect="return false" id="organizer" valueChangeListener="#{timeDataModelImpl.valueChanged}" showFooter="false">


      <f:facet name="header">
      <h:panelGroup>
      <h:outputText value="Current Month" styleClass="header"/>
      </h:panelGroup>
      </f:facet>
      <a4j:outputPanel layout="block" id="cell" onclick="#{rich:component('organizer')}.resetSelectedDate()" style="height: 100%;">
      <h:panelGrid columns="1">
      <h:outputText value="{day}" style="align:center"/>
      <h:outputText value="{data.shortDescription.escapeHTML()}"/>
      <h:outputText value="{data.description.escapeHTML()}"/>
      </h:panelGrid>
      </a4j:outputPanel>
      </rich:calendar>


      and the following exception is raised in which i'm not able to proceed further:

      ERROR [ExceptionFilter] handling uncaught exception
      javax.servlet.ServletException: Servlet execution threw an exception
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:313)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
      at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:83)
      at org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:85)
      at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
      at org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:64)
      at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
      at org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:45)
      at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
      at org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:178)
      at org.ajax4jsf.webapp.BaseFilter.handleRequest(BaseFilter.java:290)
      at org.ajax4jsf.webapp.BaseFilter.processUploadsAndHandleRequest(BaseFilter.java:390)
      at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:517)
      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.debug.hot.HotDeployFilter.doFilter(HotDeployFilter.java:68)
      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(Unknown Source)
      Caused by: java.lang.NoClassDefFoundError: org/apache/commons/beanutils/PropertyUtils
      at org.ajax4jsf.javascript.ScriptUtils.toScript(ScriptUtils.java:127)
      at org.ajax4jsf.javascript.ScriptUtils.toScript(ScriptUtils.java:67)
      at org.ajax4jsf.javascript.ScriptUtils.toScript(ScriptUtils.java:106)
      at org.richfaces.renderkit.CalendarRendererBase.writePreloadBody(CalendarRendererBase.java:447)
      at org.richfaces.renderkit.html.CalendarRenderer.doEncodeEnd(CalendarRenderer.java:478)
      at org.richfaces.renderkit.html.CalendarRenderer.doEncodeEnd(CalendarRenderer.java:489)
      at org.ajax4jsf.renderkit.RendererBase.encodeEnd(RendererBase.java:135)
      at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:836)
      at javax.faces.component.UIComponent.encodeAll(UIComponent.java:896)
      at javax.faces.render.Renderer.encodeChildren(Renderer.java:137)
      at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:812)
      at javax.faces.component.UIComponent.encodeAll(UIComponent.java:886)
      at javax.faces.component.UIComponent.encodeAll(UIComponent.java:892)
      at com.sun.facelets.FaceletViewHandler.renderView(FaceletViewHandler.java:592)
      at org.ajax4jsf.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:100)
      at org.ajax4jsf.application.AjaxViewHandler.renderView(AjaxViewHandler.java:176)
      at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:106)
      at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:251)
      at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:144)
      at javax.faces.webapp.FacesServlet.service(FacesServlet.java:245)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
      ... 38 more
      10:59:20,965 ERROR [ExceptionFilter] exception root cause


      Note: When i'm removed the datamodel, then its working fine.

      Also, i'm sending the source code of java

      import java.util.Calendar;
      import java.util.Date;
      import java.util.HashMap;
      import java.util.Map;

      import javax.faces.event.ValueChangeEvent;

      import org.jboss.seam.annotations.Name;
      import org.richfaces.model.CalendarDataModel;
      import org.richfaces.model.CalendarDataModelItem;


      @Name("timeDataModelImpl")
      public class TimeDataModelImpl implements CalendarDataModel {

      /* (non-Javadoc)
      * @see org.richfaces.component.CalendarDataModel#getData(java.util.Date[])
      */

      private TimeDataModelItemImpl[] items;

      private String currentDescription;
      private String currentShortDescription;
      private Date currentDate;
      private boolean currentDisabled;


      /* (non-Javadoc)
      * @see org.richfaces.model.CalendarDataModel#getData(java.util.Date[])
      */
      public TimeDataModelItemImpl[] getData(Date[] dateArray) {
      System.out.println("TimeDataModelItemImpl");
      if (dateArray == null) {
      return null;
      }
      if (items==null) {
      items = new TimeDataModelItemImpl[dateArray.length];
      System.out.println("items==null");
      for (int i = 0; i < dateArray.length; i++) {
      items = createDataModelItem(dateArray );
      }
      }
      return items;
      }

      /**
      * @param date
      * @return CalendarDataModelItem for date
      */
      protected TimeDataModelItemImpl createDataModelItem(Date date) {
      System.out.println("createDataModelItem");
      TimeDataModelItemImpl item = new TimeDataModelItemImpl();
      Map data = new HashMap();
      data.put("shortDescription", "Nothing planned");
      data.put("description", "");
      Calendar c = Calendar.getInstance();
      c.setTime(date);
      item.setDay(c.get(Calendar.DAY_OF_MONTH));
      item.setEnabled(true);
      item.setStyleClass("rel-hol");
      item.setData(data);
      return item;
      }

      /* (non-Javadoc)
      * @see org.richfaces.model.CalendarDataModel#getToolTip(java.util.Date)
      */
      public Object getToolTip(Date date) {

      // TODO Auto-generated method stub
      return null;
      }

      /**
      * @return items
      */
      public TimeDataModelItemImpl[] getItems() {
      return items;
      }

      /**
      * @param setter for items
      */
      public void setItems(TimeDataModelItemImpl[] items) {
      this.items = items;
      }

      /**
      * @param valueChangeEvent handling
      */
      public void valueChanged(ValueChangeEvent event) {
      System.out.println(event.getNewValue()+"selected");
      setCurrentDate((Date)event.getNewValue());
      Calendar calendar = Calendar.getInstance();
      calendar.setTime(getCurrentDate());
      setCurrentDescription((String)((HashMap)items[calendar.get(Calendar.DAY_OF_MONTH)-1].getData()).get("description"));
      setCurrentShortDescription((String)((HashMap)items[calendar.get(Calendar.DAY_OF_MONTH)-1].getData()).get("shortDescription"));
      }

      /**
      * Storing changes action
      */
      public void storeDayDetails() {
      Calendar calendar = Calendar.getInstance();
      System.out.println("calendar--"+calendar+"::"+getCurrentDate());
      calendar.setTime(getCurrentDate());
      ((HashMap)items[calendar.get(Calendar.DAY_OF_MONTH)-1].getData()).put("shortDescription", getCurrentShortDescription());
      ((HashMap)items[calendar.get(Calendar.DAY_OF_MONTH)-1].getData()).put("description", getCurrentDescription());
      }

      /**
      * @return currentDescription
      */
      public String getCurrentDescription() {
      return currentDescription;
      }

      /**
      * @param currentDescription
      */
      public void setCurrentDescription(String currentDescription) {
      this.currentDescription = currentDescription;
      }

      /**
      * @return currentDisabled
      */
      public boolean isCurrentDisabled() {
      return currentDisabled;
      }

      /**
      * @param currentDisabled
      */
      public void setCurrentDisabled(boolean currentDisabled) {
      this.currentDisabled = currentDisabled;
      }

      /**
      * @return currentShortDescription
      */
      public String getCurrentShortDescription() {
      return currentShortDescription;
      }

      /**
      * @param currentShortDescription
      */
      public void setCurrentShortDescription(String currentShortDescription) {
      this.currentShortDescription = currentShortDescription;
      }

      /**
      * @return currentDate
      */
      public Date getCurrentDate() {
      return currentDate;
      }

      /**
      * @param currentDate
      */
      public void setCurrentDate(Date currentDate) {
      this.currentDate = currentDate;
      }

      }


      Kindly, look into this issue or if i'm doing anything wrong, please let me know immediately. Because i'm struggling for 2 days for the same issue.


      With Regards
      Chinni