4 Replies Latest reply on Feb 9, 2010 1:55 AM by John Leed

    Adding RichFaces to numberguess example

    Arbi Sookazian Master

      I'm trying to add an a4j:support tag to this snippet in the home.xhtml facelet:


      <div>
                     Your guess:
                     <h:inputText id="inputGuess" value="#{game.guess}"
                        required="true" size="3" disabled="#{game.number eq game.guess}" validator="#{game.validateNumberRange}">
                             <a4j:support event="onblur" action="#{game.doFoo}"/>
                     </h:inputText>
                     <h:commandButton id="guessButton" value="Guess" action="#{game.check}" disabled="#{game.number eq game.guess}"/>
                  </div>



      Does anybody know if RF 3.3.3.BETA1 is sufficient with this JSF2/Weld app?


      I added this xml snippet in the pom.xml:


      <dependency>
                 <groupId>org.richfaces.framework</groupId>
                 <artifactId>richfaces-impl-jsf2</artifactId>
                 <version>3.3.3.BETA1</version>
             </dependency>



      I am following this wiki: http://community.jboss.org/wiki/HowtoaddRichFaces33xtomavenbasedproject


      What else do I need to do to get this to work?  thx.

        • 1. Re: Adding RichFaces to numberguess example
          Arbi Sookazian Master

          So I followed this wiki: http://community.jboss.org/wiki/HowtoaddRichFaces33xtomavenbasedproject and this one as well: http://community.jboss.org/wiki/HowToConfigureMavenForRichFaces.


          I am getting the following stack trace when I click the submit (guess) button:


          14:28:55,009 WARNING [config] JSF1029:  Application is versioned at 2.0 (either explicitly by the version of /WEB-INF/faces-config.xml or the lack of a /WEB-INF/faces-confg.xml), however class 'org.ajax4jsf.taglib.html.facelets.AjaxPushHandler' depends on a legacy facelet class.  The facelet artifact represented by this class will not be registered.
          14:28:55,009 WARNING [config] JSF1029:  Application is versioned at 2.0 (either explicitly by the version of /WEB-INF/faces-config.xml or the lack of a /WEB-INF/faces-confg.xml), however class 'org.ajax4jsf.taglib.html.facelets.AjaxSupportHandler' depends on a legacy facelet class.  The facelet artifact represented by this class will not be registered.
          14:29:22,665 ERROR [[Faces Servlet]] Servlet.service() for servlet Faces Servlet threw exception
          java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
               at java.util.ArrayList.RangeCheck(ArrayList.java:547)
               at java.util.ArrayList.get(ArrayList.java:322)
               at javax.faces.component.AttachedObjectListHolder.restoreState(AttachedObjectListHolder.java:161)
               at javax.faces.component.UIInput.restoreState(UIInput.java:1366)
               at javax.faces.component.UIComponentBase.processRestoreState(UIComponentBase.java:1202)
               at javax.faces.component.UIComponentBase.processRestoreState(UIComponentBase.java:1217)
               at javax.faces.component.UIComponentBase.processRestoreState(UIComponentBase.java:1217)
               at javax.faces.component.UIViewRoot.processRestoreState(UIViewRoot.java:864)
               at org.ajax4jsf.component.AjaxViewRoot.processRestoreState(AjaxViewRoot.java:761)
               at com.sun.faces.application.StateManagerImpl.restoreView(StateManagerImpl.java:197)
               at javax.faces.application.StateManagerWrapper.restoreView(StateManagerWrapper.java:178)
               at com.sun.faces.application.view.ViewHandlingStrategy.restoreView(ViewHandlingStrategy.java:131)
               at com.sun.faces.application.view.FaceletViewHandlingStrategy.restoreView(FaceletViewHandlingStrategy.java:429)
               at com.sun.faces.application.view.MultiViewHandler.restoreView(MultiViewHandler.java:143)
               at javax.faces.application.ViewHandlerWrapper.restoreView(ViewHandlerWrapper.java:288)
               at org.ajax4jsf.application.ViewHandlerWrapper.restoreView(ViewHandlerWrapper.java:107)
               at com.sun.faces.lifecycle.RestoreViewPhase.execute(RestoreViewPhase.java:199)
               at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
               at com.sun.faces.lifecycle.RestoreViewPhase.doPhase(RestoreViewPhase.java:110)
               at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
               at javax.faces.webapp.FacesServlet.service(FacesServlet.java:310)
               at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
               at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
               at org.jboss.weld.servlet.ConversationPropagationFilter.doFilter(ConversationPropagationFilter.java:68)
               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:235)
               at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
               at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:183)
               at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:95)
               at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.process(SecurityContextEstablishmentValve.java:126)
               at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.invoke(SecurityContextEstablishmentValve.java:70)
               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:158)
               at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
               at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:330)
               at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:829)
               at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:598)
               at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
               at java.lang.Thread.run(Thread.java:619)
          



          Here is the mod to the pom.xml:


          <profiles>
                <profile>
                   <id>jboss5</id>
                   <activation>
                      <activeByDefault>true</activeByDefault>
                   </activation>
                   <dependencies>
                   
                        <dependency>
                          <groupId>org.richfaces.ui</groupId>
                          <artifactId>richfaces-ui</artifactId>
                          <version>3.3.3.BETA1</version>
                        </dependency>
                   
                        <dependency>
                          <groupId>org.richfaces.framework</groupId>
                          <artifactId>richfaces-impl-jsf2</artifactId>
                          <version>3.3.3.BETA1</version>
                        </dependency>



          and here is the mod to the settings.xml:


          <profiles>
                 <profile>
                     <id>environment</id>
                     <activation>
                        <activeByDefault>true</activeByDefault>
                     </activation>
                     <properties>
                        <jboss.home>/java/jboss-6.0.0.M1</jboss.home>
                     </properties>
                </profile>
                
                <profile>
                     <id>RichFaces</id>
                     <repositories>
                        <repository>
                           <releases>
                           <enabled>true</enabled>
                           </releases>
                           <snapshots>
                           <enabled>false</enabled>
                           <updatePolicy>never</updatePolicy>
                           </snapshots>
                           <id>repository.jboss.com</id>
                           <name>Jboss Repository for Maven</name>
                           <url>
                           http://repository.jboss.com/maven2/
                           </url>
                           <layout>default</layout>
                        </repository>
                        <repository>
                           <releases>
                           <enabled>false</enabled>
                           </releases>
                           <snapshots>
                           <enabled>true</enabled>
                           <updatePolicy>always</updatePolicy>
                           </snapshots>
                           <id>maven2-snapshots.jboss.com</id>
                           <name>Jboss Repository for Maven Snapshots</name>
                           <url>http://snapshots.jboss.org/maven2</url>
                           <layout>default</layout>
                        </repository>
                     </repositories>
                      <pluginRepositories>
                     <pluginRepository>
                           <id>maven2-snapshots.jboss.com</id>
                           <name>Jboss Repository for Maven Snapshots</name>
                           <url>http://snapshots.jboss.org/maven2</url>
                       <releases>
                         <enabled>false</enabled>
                       </releases>
                       <snapshots>
                         <enabled>true</enabled>
                         <updatePolicy>always</updatePolicy>
                       </snapshots>
                     </pluginRepository>
                     <pluginRepository>
                           <releases>
                           <enabled>true</enabled>
                           </releases>
                           <snapshots>
                           <enabled>false</enabled>
                           <updatePolicy>never</updatePolicy>
                           </snapshots>
                           <id>repository.jboss.com</id>
                           <name>Jboss Repository for Maven</name>
                           <url>
                           http://repository.jboss.com/maven2/
                           </url>
                           <layout>default</layout>
                     </pluginRepository>
                </pluginRepositories>
                </profile>



          <activeProfiles>
              <activeProfile>alwaysActiveProfile</activeProfile>
              <activeProfile>anotherAlwaysActiveProfile</activeProfile>
              <activeProfile>RichFaces</activeProfile>
            </activeProfiles>



          I'm sure that the stack trace is triggered somehow by the additional RF xml snippets in the pom.xml b/c if I comment it out, the program behaves properly.


          Any advice?  thx.

          • 2. Re: Adding RichFaces to numberguess example
            Arbi Sookazian Master

            btw, I'm deploying to JBoss 6.0.0.M1, so the versions of the JSF libs is Mojarra JSF API (javax.faces/2.0) 2.0.1-FCS.

            • 3. Re: Adding RichFaces to numberguess example
              Arbi Sookazian Master

              Most likely not a Weld issue.  Posted new topic in RF forum: http://community.jboss.org/thread/147855

              • 4. Re: Adding RichFaces to numberguess example
                John Leed Newbie

                I haven't been having any trouble with Weld and RF 3.3.3-BETA1. Are you using Facelets 2 (bundled with JSF 2) or 1.1.15? RF 3.3.3 is only compatible with the latter. See http://community.jboss.org/wiki/RichFaces333andJSF20