2 Replies Latest reply on Feb 13, 2013 12:32 AM by sivaprasad9394

    Problems Starting Richfaces Screens.

    dcarda

      Okay, I'm having a few really weird problems.  I'm getting some very unusual behaviro out of my screens and I'm really not sure what's going on.

       

      I'm a bit new to Richfaces and no doubt my problems are caused by me.  However, I would really appreciate a pair (or two) of expert eyes to give me some suggestions on what I did wrong.  Or general suggestions on how to improve my code.

       

      First, I'm using Richfaces 4.3.0.Final on JBoss 7.1.1 AS. 

       

      When I first load the screen, I get the following error message:

       

      Load Error Message From JBoss 7.1.1

      10:09:52,943 SEVERE [javax.enterprise.resource.webcontainer.jsf.application] (http--127.0.0.1-8180-1) Error Rendering View[/index.xhtml]: java.lang.IllegalStateException: Cannot create a session after the response has been committed

              at org.apache.catalina.connector.Request.doGetSession(Request.java:2636) [jbossweb-7.0.13.Final.jar:]

              at org.apache.catalina.connector.Request.getSession(Request.java:2375) [jbossweb-7.0.13.Final.jar:]

              at org.apache.catalina.connector.RequestFacade.getSession(RequestFacade.java:841) [jbossweb-7.0.13.Final.jar:]

              at com.sun.faces.context.ExternalContextImpl.getSession(ExternalContextImpl.java:155) [jsf-impl-2.1.7-jbossorg-2.jar:]

              at javax.faces.context.ExternalContextWrapper.getSession(ExternalContextWrapper.java:396) [jboss-jsf-api_2.1_spec-2.0.1.Final.jar:2.0.1.Final]

              at com.sun.faces.renderkit.ServerSideStateHelper.writeState(ServerSideStateHelper.java:175) [jsf-impl-2.1.7-jbossorg-2.jar:]

              at com.sun.faces.renderkit.ResponseStateManagerImpl.writeState(ResponseStateManagerImpl.java:122) [jsf-impl-2.1.7-jbossorg-2.jar:]

              at com.sun.faces.application.StateManagerImpl.writeState(StateManagerImpl.java:166) [jsf-impl-2.1.7-jbossorg-2.jar:]

              at com.sun.faces.application.view.WriteBehindStateWriter.flushToWriter(WriteBehindStateWriter.java:225) [jsf-impl-2.1.7-jbossorg-2.jar:]

              at com.sun.faces.application.view.FaceletViewHandlingStrategy.renderView(FaceletViewHandlingStrategy.java:419) [jsf-impl-2.1.7-jbossorg-2.jar:]

              at com.sun.faces.application.view.MultiViewHandler.renderView(MultiViewHandler.java:125) [jsf-impl-2.1.7-jbossorg-2.jar:]

              at javax.faces.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:288) [jboss-jsf-api_2.1_spec-2.0.1.Final.jar:2.0.1.Final]

              at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:121) [jsf-impl-2.1.7-jbossorg-2.jar:]

              at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101) [jsf-impl-2.1.7-jbossorg-2.jar:]

              at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139) [jsf-impl-2.1.7-jbossorg-2.jar:]

              at javax.faces.webapp.FacesServlet.service(FacesServlet.java:594) [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:]

       

      HOWEVER, the screen does load and seems to be formatted correctly. 

       

      So, I enter in my order number and hit the "lookup" button. 

       

      The first time I press the Lookup button nothing happens.  HOWEVER, the second time I press the Lookup button everything works fine.  In fact, from this point forward the screen works great.

       

      I am totally confused...

       

      Below is my main index.xhtml.  I'm sure I'm doing something simple that I can't see.  I would really appicate a quick glance by the experts! 

       

       

      index.xhtml

      <?xml version="1.0" encoding="UTF-8"?>

      <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

       

       

      <html xmlns="http://www.w3.org/1999/xhtml"

          xmlns:h="http://java.sun.com/jsf/html"

          xmlns:f="http://java.sun.com/jsf/core"

          xmlns:ui="http://java.sun.com/jsf/facelets"

          xmlns:a4j="http://richfaces.org/a4j"

          xmlns:rich="http://richfaces.org/rich"

          xmlns:aj4="http://java.sun.com/jsf/html">

       

       

      <ui:composition xmlns="http://www.w3.org/1999/xhtml"

          xmlns:ui="http://java.sun.com/jsf/facelets"

          xmlns:h="http://java.sun.com/jsf/html"

          xmlns:f="http://java.sun.com/jsf/core"

          xmlns:a4j="http://richfaces.org/a4j"

          xmlns:rich="http://richfaces.org/rich"

          xmlns:aj4="http://java.sun.com/jsf/html"

          template="/templates/template.xhtml">

       

       

          <ui:define name="title">Resource Config Generator</ui:define>

          <ui:define name="body">

       

       

       

       

              <aj4:form id="id_topLevelForm">

       

       

                  <rich:tabPanel switchType="ajax"

                                 id="id_topPanel"

                                 headerPosition="top"

                                 headerLocation="center">

       

       

                      <rich:tab header="CPE Firewall Builder">

                          <rich:tabPanel switchType="ajax"

                                         id="id_fWCpeBldrTabPanel"

                                         headerPosition="top"

                                         headerLocation="center">

       

       

                              <rich:tab header="CPE Resource Config"

                                        immediate="true"

                                        switchType="ajax"

                                        id="id_cpeFwResConfigTab">

       

       

                                  <rich:panel>

       

       

                                      <f:facet name="header">

                                          <h:outputText value="Enter Order Information"/>

                                      </f:facet>

                                      <aj4:form id="id_testtabplesework">

                                          <h:panelGrid columns="2">

                                              <rich:column>

                                                  <h:outputText value="Please Enter the Order Number: " />

                                              </rich:column>

                                              <rich:column>

                                                  <h:inputText

                                                      value="#{mssCpeResourceConfigBackingBean._OrderNumber}"

                                                      slyleClass="rich-select"

                                                      reRender="id_ResConfDisplay">

                                                      <f:convertNumber integerOnly="true" />

                                                  </h:inputText>

                                              </rich:column>

                                              <rich:column>

                                                  <a4j:commandButton

                                                      action="#{mssCpeResourceConfigBackingBean.btnCheckForMultipleServicePiids}"

                                                      id="processLookupBtn"

                                                      status="transmitCoreDocStatus"

                                                      type="button"

                                                      render="id_ServicePiidList id_ServicePiidStatus id_ResConfDisplay"

                                                      rendered="true"

                                                      value="Lookup" />

                                              </rich:column>

                                              <rich:column>

                                                  <a4j:status name="transmitCoreDocStatus">

                                                      <f:facet name="start">

                                                          <h:graphicImage value="/images/ai.gif" alt="ai" />

                                                      </f:facet>

                                                  </a4j:status>

                                              </rich:column>

       

       

                                              <rich:column>

                                                  <h:outputText value="Please Select the Service PIID: "

                                                      rendered="true" />

                                              </rich:column>

                                              <rich:column>

                                                  <rich:select directInputSuggestions="true"

                                                      defaultLabel="Select PIID Value..."

                                                      id="id_ServicePiidList"

                                                      rendered="true"

                                                      value="#{mssCpeResourceConfigBackingBean.selectedServicePiid}">

                                                      <f:selectItems

                                                          value="#{mssCpeResourceConfigBackingBean._AccountInfoArrayList}" />

                                                      <a4j:ajax event="change"

                                                                render="btnProcessResourceConfig" />

       

       

                                                  </rich:select>

                                              </rich:column>

                                              <rich:column>

                                                  <a4j:commandButton

                                                      action="#{mssCpeResourceConfigBackingBean.buttonProcessResourceConfig}"

                                                      id="btnProcessResourceConfig"

                                                      oncomplete="this.disabled=false"  

                                                      onclick="this.disabled=true"

                                                      render="id_ResConfDisplay"

                                                      rendered="true"

                                                      status="id_ServicePiidStatus"

                                                      type="button"

                                                      value="Process" />

                                              </rich:column>

                                              <rich:column>

                                                  <a4j:status name="id_ServicePiidStatus">

                                                      <f:facet name="start">

                                                          <h:graphicImage value="/images/ai.gif" alt="ai" />

                                                      </f:facet>

                                                  </a4j:status>

                                              </rich:column>

       

       

                                          </h:panelGrid>

                                         

                                      <br clear="none" />

                                      <br clear="none" />

                                                                 

                                      <h:inputTextarea

                                          id="id_ResConfDisplay"

                                          rendered="true"

                                          value="#{mssCpeResourceConfigBackingBean._resourceConfContents}"

                                          rows="35" cols="85" />

                                         

                                         

                                      </aj4:form>

                                     

         

                                  </rich:panel>

       

       

                              </rich:tab>

                              <!--  ==========

                              <rich:tab header="CPE Service Config" 

                                        immediate="true" 

                                        switchType="ajax"

                                        id="id_cpeFwSrvcConfigTab" >

                              </rich:tab>                          

                               -->

                          </rich:tabPanel>

                      </rich:tab>

       

       

                      <rich:tab header="NET Firewall Builder" switchType="ajax"

                          id="id_netFwBldrTab">

                          <rich:tabPanel switchType="ajax" id="id_fWBldrTabPanel"

                              headerPosition="top" headerLocation="center">

                              <rich:tab header="NET Resource Config" immediate="true"

                                  switchType="ajax" id="id_netFwResConfigTab">

                              </rich:tab>      

                                      -->

       

       

                              <rich:tab header="NET Service Config" immediate="true"

                                  switchType="ajax" id="id_netFwSrvcConfigTab">

                              </rich:tab>

                          </rich:tabPanel>

                      </rich:tab>

       

       

                  </rich:tabPanel>

       

       

              </aj4:form>

       

       

          </ui:define>

      </ui:composition>

      </html>

       

       

      Many Thanks!

      Daniel Carda

        • 1. Re: Problems Starting Richfaces Screens.
          dcarda

          Well, I have continued to work on this issue and I have discovered something.  The first error (and maybe all the errors are being caused by the rich:select.

           

          This is causing the problem:

           

                                             <rich:select directInputSuggestions="true"

                                                          defaultLabel="Select PIID Value..."

                                                          id="id_ServicePiidList"

                                                          rendered="true"

                                                          value="#{mssCpeResourceConfigBackingBean.selectedServicePiid}">

                                                          <f:selectItems

                                                              value="#{mssCpeResourceConfigBackingBean._AccountInfoArrayList}" />

                                                          <a4j:ajax event="change"

                                                                    render="btnProcessResourceConfig" />

                                                                                            </rich:select>

           

                                                      </rich:select>

           

          I pull this select out of the column and the start-up error goes away.

           

          Any idea why?