8 Replies Latest reply on May 27, 2008 4:51 PM by judy guglielmin

    Seam + Icefaces made easy?

    Matt Davis Newbie

      Is there anyplace that shows exactly what you need to do to use icefaces in an existing seam project? I used the JBoss Tools to generate a project and I seem to run into problems whenever I try to modify the config files to use icefaces. I know I'm either adding something I shouldn't, removing something I shouldn't, or not adding the tags in all the right files...


      I found this:
      http://www.seamframework.org/Documentation/UsingICEFacesWithJBossToolsGeneratedProjects


      But it wants me to use icefaces seam gen to generate a project, which was written for older versions of seam. I have a ton of sample projects using icefaces, but I run into all sorts of trouble when I try to modify an existing/working project to have access to the icefaces tags. 


      If somebody could tell me exactly what is required for a seam project to use icefaces, which jars, which xml files need which tags etc... I would be SO grateful.

        • 1. Re: Seam + Icefaces made easy?
          Dan Allen Master

          In the Seam distribution, support for both RichFaces and ICEFaces is included for seam-gen. In the setup questionnaire you simply answer yes to using ICEFaces. That gives you the latest version of Seam (whichever distribution you downloaded) and ICEFaces 1.7.


          I'm pretty sure the ICEFaces developers would be sad that you aren't acknowledging their hardwork on keeping the ICEFaces seam-gen build up to date. They do a great job!

          • 2. Re: Seam + Icefaces made easy?
            Matt Davis Newbie

            So perhaps it's the Jboss Tools IDE that I'm using isn't using the latest seam-gen? the New Seam Project option doesn't say anything about icefaces unless I manually add libraries and stuff, and I haven't been able to get that to work either. 


            I've shied away from the text-based version of seam-gen thus far, and the projects it creates are much different from the ones the eclipse plugin creates.


            I guess I'll take another stab at it with the text-based seam-gen.

            • 3. Re: Seam + Icefaces made easy?
              Matt Davis Newbie

              I guess I'll ask one more time to make it clear what I'm hoping someone will be able to tell me.


              What exactly is required to make Icefaces work? Which xml files require which tags...  When those files already have tags that conflict, such as the seam facelets handler thing, which do you remove?


              Generating a new project that works is great and all... but I'd like to know exactly which icefaces jars are required in my ear deployment, and exactly which items need to be included in which config files.


              It's not the case that I can take the files that the seam-gen makes and replace my files with them. This breaks the things I've already done, and my attempts to pick what is important, and which things are redundant have thus far failed miserably.


              Thanks!

              • 4. Re: Seam + Icefaces made easy?
                Nicklas Karlsson Master

                (from memory)


                - Take out the ricfaces libs (richfaces*)


                - Take out facelets (jsf-facelets)


                - Put in the icefaces libs (icefaces, icefaces-comps)


                - Put in the icefaces facelets lib (icefaces-facelets)


                - Put in icefaces deps (backport-util-concurrent.jar, commons-fileupload)


                - use faces-config.xml


                <faces-config>
                     <application>
                          <view-handler>
                com.icesoft.faces.facelets.D2DSeamFaceletViewHandler
                          </view-handler>
                     </application>
                </faces-config>
                



                If using server-push, put in components.xml a


                     <component scope="application" auto-create="true"
                          name="renderManager"
                          class="com.icesoft.faces.async.render.RenderManager" />
                



                Put stuff in the web.xml ;-) See the icefaces manual. At least


                    <listener>
                        <listener-class>com.icesoft.faces.util.event.servlet.ContextEventRepeater</listener-class>
                    </listener>
                
                    <context-param>
                        <param-name>com.icesoft.faces.actionURLSuffix</param-name>
                        <param-value>.seam</param-value>
                    </context-param>
                
                    <servlet>
                        <servlet-name>Persistent Faces Servlet</servlet-name>
                        <servlet-class>com.icesoft.faces.webapp.xmlhttp.PersistentFacesServlet</servlet-class>
                        <load-on-startup> 1 </load-on-startup>
                    </servlet>
                
                    <servlet>
                        <servlet-name>Blocking Servlet</servlet-name>
                        <servlet-class>com.icesoft.faces.webapp.xmlhttp.BlockingServlet</servlet-class>
                        <load-on-startup> 1 </load-on-startup>
                    </servlet>  
                
                    <servlet-mapping>
                        <servlet-name>Persistent Faces Servlet</servlet-name>
                        <url-pattern>*.seam</url-pattern>
                    </servlet-mapping>
                
                      <servlet-mapping>
                        <servlet-name>Persistent Faces Servlet</servlet-name>
                        <url-pattern>/xmlhttp/*</url-pattern>
                    </servlet-mapping>   
                
                    <servlet-mapping>
                        <servlet-name>Blocking Servlet</servlet-name>
                        <url-pattern>/block/*</url-pattern>
                    </servlet-mapping>
                
                



                The following web.xml additions might also be of use (seam-gen puts them there, don't know if they are default or required etc)


                    <context-param>
                        <param-name>com.icesoft.faces.synchronousUpdate</param-name>
                        <param-value>false</param-value>
                    </context-param>
                
                    <context-param> 
                        <param-name>com.icesoft.faces.doJSFStateManagement</param-name>
                     <param-value>true</param-value>
                    </context-param> 
                
                   <context-param>
                        <param-name>com.icesoft.faces.standardRequestScope</param-name>
                        <param-value>true</param-value>
                    </context-param>
                



                • 5. Re: Seam + Icefaces made easy?
                  judy guglielmin Novice

                  Although seam-gen is a great way to start a new project (providing all the configuration for data sources and packaging, etc), you could also download some sample applications from the ICEfaces download page 


                  Just look under Projects, then JBoss Seam


                  There are examples of seam-comp-showcase (various application servers including portlet targets) and seam-auctionMonitor which is a simple example of ajax push using Seam and ICEfaces.


                  If you want support from ICEfaces personnel, it is much quicker to post any problems you might have to ICEfaces Jboss Seam Integration forum



                  ALso, once you run seam setup from the command-line, it is quite easy to run the other ant targets within any IDE.

                  • 6. Re: Seam + Icefaces made easy?
                    Matt Davis Newbie

                    Ok, I've gotten very close.


                    I'm using an ear deployment... I got the seam component showcase running, and it is a war.  I admit I'm a bit of a newb when it comes to how an ear deployment loads its libraries, but I'm not 100% sure which jars should be in which folders.


                    I put all of the jars that Nicklas listed into the war's WEB-INF directory AND the ear base directory. I know that one of these, or some of these are in the wrong spot now, but it's tedious to move them around and recompile and see what works and what doesn't.


                    Things are working... but I'm getting this error:
                    java.lang.IllegalStateException: Application was not properly initialized at startup, could not find Factory: javax.faces.render.RenderKitFactory


                    I'm using this code:



                      
                    import org.jboss.seam.faces.FacesMessages;
                    import org.jboss.seam.faces.Renderer;
                    
                        
                        @In(create=true)
                        Renderer renderer;
                    
                    ...
                    
                      public void sendRegistrationEmail(){
                                try{
                                  renderer.render("email/userConfirmation.xhtml");
                             }catch(Exception e){
                                  e.printStackTrace();
                             }
                        }
                    




                    Should this be handled differently with icefaces? or is there another file I need to update or something?  I guess this may deserve a different thread...

                    • 7. Re: Seam + Icefaces made easy?
                      Nicklas Karlsson Master

                      That sounds more like the a class from the JSF implementation not being found. What AS are you deploying to?


                      Keeping jar files in both EAR and WAR sounds like a good idea if you want to run into classloading problems at some point. Check where seam-gen puts the files and whether they are listed in application.xml or not (can't remember).

                      • 8. Re: Seam + Icefaces made easy?
                        judy guglielmin Novice

                        If you are using Seam-2.0.0.GA, then please see the following forum posting for ICEfaces forum posting seam mail


                        Pete Muir made a change on the Seam 2.1.0 trunk that allows us to use jsf delegation with seam mail, and I do have an example of that , but since there is no release for users yet, it has not been made available. I am trying to get around having the seam-ui jar in both the ear and the war, but not having much luck in this.  Once I get a final configuration, I can make a build script for the sample project and it will become available on the ICEfaces forum http://www.icefaces.org/JForum/forums/show/22.page