0 Replies Latest reply on Dec 24, 2012 10:03 AM by harish.varada

    valueChangeListener not working in ubuntu.

    harish.varada

      Hello,

       

      I'm trying to build an application using Richfaces. For this, I need to bind some html compnents and change data dynamically.

       

      Searching over internet, I could get some help on valueChangeListener object of richfaces and tried to acheive my requirement.

       

      Problem here is, the listner functions written are not working on delpoyed on a linux(ubuntu) machine. But, the same code set was working as expected on another windows-7 machine.

       

      I assume that I'm not handling exceptions perfectly and those exceptions might be ignored in windows and are strictly considered in linux but couldn't exactly judge the issue with this.

       

      My application setup is:

       

      Richfaces-4
      Springs
      Jboss7.1.1
      ubuntu
      Hibernate
      

       

      My jsf code is:

      <div class="control-group">
                <h:outputLabel value="Médico" styleClass="control-label"/>
                <div class="controls">
                          <h:selectOneMenu styleClass="span4 select2validation"
                                    id="medico" name="medico" value="0"
                                    valueChangeListener="#{doctorsBean.medicoSelected}">
                                    <f:selectItem itemValue="0" itemLabel=":: Seleccione una ::" />
                                    <f:selectItems value="#{doctorsBean.doctorsList}"
                                              var="doctors" itemLabel="#{doctors.name}"
                                              itemValue="#{doctors.id}" />
                                    <f:selectItem itemValue="medico_not_found"
                                              itemLabel="Médico Que No Se Encuentra" />
                                    <a4j:ajax event="valueChange" render="med_notfound"
                                              execute="@this" />
                          </h:selectOneMenu>
                </div>
      </div>
      

       

      My actionBean is:

      package com.wma.actionbean;
      
      
      import java.io.Serializable;
      import java.util.ArrayList;
      import java.util.List;
      
      
      import javax.faces.event.ValueChangeEvent;
      
      
      import org.apache.commons.logging.Log;
      import org.apache.commons.logging.LogFactory;
      import org.springframework.stereotype.Component;
      
      
      import com.ybrant.lgs.wma.persistance.entity.Doctors;
      import com.ybrant.lgs.wma.service.IDoctorsService;
      
      
      @Component
      public class DoctorsBean extends BaseBean implements Serializable {
      
      
                /**
                 *
                 */
                private static final long serialVersionUID = 1L;
                private static Log log = LogFactory.getLog(DoctorsBean.class);
                private boolean newMedico;
                List<Doctors> doctorsList;
                List<Doctors> doctorsByCityList;
      
      
                private IDoctorsService doctorsService;
      
      
                private boolean medicoNotAvailable;
      
      
                private String medicoAvailable          = "display: none;";
      
      
                public String getMedicoAvailable() {
                          return medicoAvailable;
                }
      
      
                public void setMedicoAvailable(String medicoAvailable) {
                          this.medicoAvailable = medicoAvailable;
                }
      
      
                public void setDoctorsService(IDoctorsService doctorsService) {
                          this.doctorsService = doctorsService;
                }
      
      
                public List<Doctors> getDoctorsList() {
                          doctorsList = new ArrayList<Doctors>();
      
      
                          doctorsList.addAll(doctorsService.getAllDoctors());
                          return doctorsList;
                }
      
      
                /*
                 * public List<Doctors> getDoctorssByCity(Long cityId) { doctorsByCityList =
                 * new ArrayList <Doctors> ();
                 *
                 * doctorsByCityList.addAll(doctorsService.getAllDoctorsByCity(cityId) );
                 * return doctorsByCityList; } public void
                 * setDoctorssByCityList(List<Doctors> doctorsByCityList) {
                 * this.doctorsByCityList = doctorsByCityList; }
                 */
                public void setDoctorsList(List<Doctors> doctorsList) {
                          this.doctorsList = doctorsList;
                }
      
      
                public void medicoSelected(ValueChangeEvent event) {
                          String medicoValue = event.getNewValue().toString();
                          log.info("** Medico selected ***" + medicoValue);
      
      
                          if (medicoValue.equals("medico_not_found")) {
                                    //setMedicoNotAvailable(true);
                                    this.setMedicoAvailable("display: block;");
                          }
                          else
                          {
                                    this.setMedicoAvailable("display: none;");
                          }
                                    //setMedicoNotAvailable(false);
      
      
                          log.info("** newMedico ***" + getMedicoNotAvailable());
                }
      
      
                public boolean isNewMedico() {
                          return newMedico;
                }
      
      
                public void setNewMedico(boolean newMedico) {
                          this.newMedico = newMedico;
                }
      
      
                public boolean getMedicoNotAvailable()
                {
                          return medicoNotAvailable;
                }
      
      
                public void setMedicoNotAvailable(boolean b)
                {
                          this.medicoNotAvailable          = b;
                }
      }
      
      

       

       

      My error when performed value change on the dropdown menu is:

      20:22:20,811 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/MedicalAudit].[Faces Servlet]] (http--0.0.0.0-8080-1) Servlet.service() for servlet Faces Servlet threw exception: java.lang.NullPointerException
                at com.sun.faces.context.PartialViewContextImpl.createPartialResponseWriter(PartialViewContextImpl.java:441) [jsf-impl-2.1.7-jbossorg-2.jar:]
                at com.sun.faces.context.PartialViewContextImpl.access$300(PartialViewContextImpl.java:71) [jsf-impl-2.1.7-jbossorg-2.jar:]
                at com.sun.faces.context.PartialViewContextImpl$DelayedInitPartialResponseWriter.getWrapped(PartialViewContextImpl.java:582) [jsf-impl-2.1.7-jbossorg-2.jar:]
                at javax.faces.context.PartialResponseWriter.startDocument(PartialResponseWriter.java:115) [jboss-jsf-api_2.1_spec-2.0.1.Final.jar:2.0.1.Final]
                at com.sun.faces.context.AjaxExceptionHandlerImpl.handlePartialResponseError(AjaxExceptionHandlerImpl.java:199) [jsf-impl-2.1.7-jbossorg-2.jar:]
                at com.sun.faces.context.AjaxExceptionHandlerImpl.handle(AjaxExceptionHandlerImpl.java:123) [jsf-impl-2.1.7-jbossorg-2.jar:]
                at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:119) [jsf-impl-2.1.7-jbossorg-2.jar:]
                at com.sun.faces.lifecycle.RestoreViewPhase.doPhase(RestoreViewPhase.java:116) [jsf-impl-2.1.7-jbossorg-2.jar:]
                at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118) [jsf-impl-2.1.7-jbossorg-2.jar:]
                at javax.faces.webapp.FacesServlet.service(FacesServlet.java:593) [jboss-jsf-api_2.1_spec-2.0.1.Final.jar:2.0.1.Final]
                at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:329) [jbossweb-7.0.13.Final.jar:]
                at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248) [jbossweb-7.0.13.Final.jar:]
                at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:275) [jbossweb-7.0.13.Final.jar:]
                at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:161) [jbossweb-7.0.13.Final.jar:]
                at org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:153) [jboss-as-web-7.1.1.Final.jar:7.1.1.Final]
                at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:155) [jbossweb-7.0.13.Final.jar:]
                at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) [jbossweb-7.0.13.Final.jar:]
                at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) [jbossweb-7.0.13.Final.jar:]
                at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:368) [jbossweb-7.0.13.Final.jar:]
                at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:877) [jbossweb-7.0.13.Final.jar:]
                at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:671) [jbossweb-7.0.13.Final.jar:]
                at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:930) [jbossweb-7.0.13.Final.jar:]
                at java.lang.Thread.run(Thread.java:662) [rt.jar:1.6.0_31]
      
      

       

      Please help me resolving this.

       

      Thanks in advance.

       

      Regards,

      Harish.Varada