6 Replies Latest reply on Dec 22, 2006 12:25 AM by patrickmadden

    Project setup with Icefaces

    dustismo

      I have finally gotten a test Seam app to work with mysql. Now I would like to try Icefaces. Problem is, I have no idea how to integrate Icefaces. I have added all the appropriate jars, and changed the web.xml to the one from the icefaces example. I also replaced the faces-config.xml. Surprise, surprise this didn't work..

      Here is my web.xml

      <?xml version="1.0" encoding="UTF-8"?>
      
      
      
      <web-app version="2.5"
      
       xmlns="http://java.sun.com/xml/ns/javaee"
      
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      
       xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
      
      
      
       <context-param>
      
       <param-name>javax.faces.CONFIG_FILES</param-name>
      
       <param-value>/WEB-INF/navigation.xml</param-value>
      
       </context-param>
      
      
      
       <!-- Seam -->
      
      
      
       <listener>
      
       <listener-class>org.jboss.seam.servlet.SeamListener</listener-class>
      
       </listener>
      
      
      
       <!-- Propagate conversations across redirects -->
      
      <!--
      
       <filter>
      
       <filter-name>Seam Redirect Filter</filter-name>
      
       <filter-class>org.jboss.seam.servlet.SeamRedirectFilter</filter-class>
      
       </filter>
      
      
      
       <filter-mapping>
      
       <filter-name>Seam Redirect Filter</filter-name>
      
       <url-pattern>*.seam</url-pattern>
      
       </filter-mapping>
      
      -->
      
       <filter>
      
       <filter-name>Seam Exception Filter</filter-name>
      
       <filter-class>org.jboss.seam.servlet.SeamExceptionFilter</filter-class>
      
       </filter>
      
      
      
       <filter-mapping>
      
       <filter-name>Seam Exception Filter</filter-name>
      
       <url-pattern>*.seam</url-pattern>
      
       </filter-mapping>
      
      
      
       <!-- JSF -->
      
      
      
       <context-param>
      
       <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
      
       <param-value>client</param-value>
      
       </context-param>
      
      
      
       <context-param>
      
       <param-name>javax.faces.DEFAULT_SUFFIX</param-name>
      
       <param-value>.xhtml</param-value>
      
       </context-param>
      
      
      
       <context-param>
      
       <param-name>facelets.DEVELOPMENT</param-name>
      
       <param-value>true</param-value>
      
       </context-param>
      
      
      
       <context-param>
      
       <param-name>com.icesoft.faces.actionURLSuffix</param-name>
      
       <param-value>.seam</param-value>
      
       </context-param>
      
      
      
       <context-param>
      
       <param-name>com.icesoft.faces.synchronousUpdate</param-name>
      
       <param-value>true</param-value>
      
       </context-param>
      
      
      
       <servlet>
      
       <servlet-name>Faces Servlet</servlet-name>
      
       <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
      
       <load-on-startup>1</load-on-startup>
      
       </servlet>
      
      
      
       <!-- Faces Servlet Mapping -->
      
      <!--
      
       <servlet-mapping>
      
       <servlet-name>Faces Servlet</servlet-name>
      
       <url-pattern>*.seam</url-pattern>
      
       </servlet-mapping>
      
      
      
      -->
      
      
      
       <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>
      
       <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-mapping>
      
       <servlet-name>Persistent Faces Servlet</servlet-name>
      
       <url-pattern>/xmlhttp/*</url-pattern>
      
       </servlet-mapping>
      
      
      
       <servlet-mapping>
      
       <servlet-name>Persistent Faces Servlet</servlet-name>
      
       <url-pattern>/xmlhttp/*</url-pattern>
      
       </servlet-mapping>
      
      
      
       <servlet-mapping>
      
       <servlet-name>Persistent Faces Servlet</servlet-name>
      
       <url-pattern>*.iface</url-pattern>
      
       </servlet-mapping>
      
      
      
       <!-- Blocking Servlet Mapping -->
      
       <servlet-mapping>
      
       <servlet-name>Blocking Servlet</servlet-name>
      
       <url-pattern>/block/*</url-pattern>
      
       </servlet-mapping>
      
      
      
       <!-- Faces Servlet Mapping -->
      
       <servlet-mapping>
      
       <servlet-name>Persistent Faces Servlet</servlet-name>
      
       <url-pattern>*.seam</url-pattern>
      
       </servlet-mapping>
      
      
      
       <!-- MyFaces -->
      
       <listener>
      
       <listener-class>org.apache.myfaces.webapp.StartupServletContextListener</listener-class>
      
       </listener>
      
      
      
       <!-- JSF RI -->
      
       <!--
      
       <listener>
      
       <listener-class>com.sun.faces.config.ConfigureListener</listener-class>
      
       </listener>
      
       -->
      
      
      
      </web-app>
      



      Here is my faces-config.xml
      
      <?xml version='1.0' encoding='UTF-8'?>
      
      <?xml version="1.0" encoding="UTF-8"?>
      <!DOCTYPE faces-config
       PUBLIC "-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.0//EN"
       "http://java.sun.com/dtd/web-facesconfig_1_0.dtd">
      
      <faces-config>
      
       <managed-bean>
       <managed-bean-name>highlight</managed-bean-name>
       <managed-bean-class>com.icesoft.faces.context.effects.Highlight</managed-bean-class>
       <managed-bean-scope>application</managed-bean-scope>
       </managed-bean>
      
       <application>
       <view-handler>com.icesoft.faces.facelets.D2DSeamFaceletViewHandler</view-handler>
       </application>
      
       <!-- Select one of the standard transaction models for the Seam application -->
      
       <lifecycle>
       <phase-listener>org.jboss.seam.jsf.SeamPhaseListener</phase-listener>
       </lifecycle>
      
      </faces-config>
      
      


      I am using jboss 4.0.5GA and seam 1.1.0.CR2
      The project was generated using seam-gen (ideally I think the project setup should ask whether you want to use Icefaces and configure it accordingly).

      Here is the error message I get
      StandardWrapper.Throwable
      java.lang.IllegalStateException: No Factories configured for this Application. This happens if the faces-initialization does not work at all - make sure that you properly include all configuration settings necessary for a basic faces application and that all the necessary libs are included. Also check the logging output of your web application and your container for any exceptions!
      If you did that and find nothing, the mistake might be due to the fact that you use some special web-containers which do not support registering context-listeners via TLD files and a context listener is not setup in your web.xml.
      A typical config looks like this;
      <listener>
       <listener-class>org.apache.myfaces.webapp.StartupServletContextListener</listener-class>
      </listener>
      
       at javax.faces.FactoryFinder.getFactory(FactoryFinder.java:90)
       at javax.faces.webapp.FacesServlet.init(FacesServlet.java:88)
      ....
      ....
      


      Any help?

      Thanks much,
      Dustin

        • 1. Re: Project setup with Icefaces

          Your configuration looks exactly like mine, which works just fine apart from conversations.
          Where do you copy the jars? I have em all exclusively in WEB-INF/lib (3 x icefaces*.jar + commons-fileupload + oscache).

          When do you get the error, at startup or when requesting the first page?

          • 2. Re: Project setup with Icefaces
            dustismo

            Thanks for the response..

            These libs are in my /WE-INF/lib folder:

            commons-fileupload.jar
            el-api.jar
            el-ri.jar
            icefaces-comps.jar
            icefaces-facelets.jar
            icefaces.jar
            jboss-seam-debug.jar
            jboss-seam-ui.jar
            oscache-2.3.2.jar
            


            The error appears at startup

            Thanks much,
            Dustin

            • 3. Re: Project setup with Icefaces

              Well, I guess I can't do anything more for you than sending my web.xml content for comparison. I read somewhere that even the element order is kinda important.... Don't know...

              <?xml version="1.0" ?>
              
              <web-app version="2.5"
               xmlns="http://java.sun.com/xml/ns/javaee"
               xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
               xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
              
               <context-param>
               <param-name>javax.faces.CONFIG_FILES</param-name>
               <param-value>/WEB-INF/navigation.xml</param-value>
               </context-param>
              
               <context-param>
               <param-name>facelets.LIBRARIES</param-name>
               <param-value>
               <!--/WEB-INF/tags/jsf-core.taglib.xml;-->
               /WEB-INF/tags/artfact.taglib.xml
               </param-value>
               </context-param>
              
               <listener>
               <listener-class>org.jboss.seam.servlet.SeamListener</listener-class>
               </listener>
              
               <listener>
               <listener-class>org.apache.myfaces.webapp.StartupServletContextListener</listener-class>
               </listener>
              
               <context-param>
               <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
               <param-value>client</param-value>
               </context-param>
              
               <context-param>
               <param-name>facelets.DEVELOPMENT</param-name>
               <param-value>true</param-value>
               </context-param>
              
               <context-param>
               <param-name>javax.faces.DEFAULT_SUFFIX</param-name>
               <param-value>.xhtml</param-value>
               </context-param>
              
               <context-param>
               <param-name>com.icesoft.faces.actionURLSuffix</param-name>
               <param-value>.seam</param-value>
               </context-param>
              
               <context-param>
               <param-name>com.icesoft.faces.synchronousUpdate</param-name>
               <param-value>true</param-value>
               </context-param>
              
               <filter>
               <filter-name>Seam Exception Filter</filter-name>
               <filter-class>org.jboss.seam.servlet.SeamExceptionFilter</filter-class>
               </filter>
              
               <filter-mapping>
               <filter-name>Seam Exception Filter</filter-name>
               <url-pattern>/*</url-pattern>
               </filter-mapping>
              
               <servlet>
               <servlet-name>Faces Servlet</servlet-name>
               <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
               <load-on-startup>1</load-on-startup>
               </servlet>
              
               <!-- ICEFACES -->
               <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>
               <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-mapping>
               <servlet-name>Persistent Faces Servlet</servlet-name>
               <url-pattern>/xmlhttp/*</url-pattern>
               </servlet-mapping>
              
               <servlet-mapping>
               <servlet-name>Persistent Faces Servlet</servlet-name>
               <url-pattern>/xmlhttp/*</url-pattern>
               </servlet-mapping>
              
               <servlet-mapping>
               <servlet-name>Persistent Faces Servlet</servlet-name>
               <url-pattern>*.iface</url-pattern>
               </servlet-mapping>
              
              <!-- Blocking Servlet Mapping -->
               <servlet-mapping>
               <servlet-name>Blocking Servlet</servlet-name>
               <url-pattern>/block/*</url-pattern>
               </servlet-mapping>
               <servlet-mapping>
               <servlet-name>Persistent Faces Servlet</servlet-name>
               <url-pattern>*.seam</url-pattern>
               </servlet-mapping>
              </web-app>
              


              Good luck!

              • 4. Re: Project setup with Icefaces
                dustismo

                Unfortunately that didn't help.

                Perhaps you could do a little step by step of creating a new project with Icefaces? I'm sure others would appreciate that as well (you could post it on the wiki). If not, thanks much for your help thus far.

                -Dustin

                • 5. Re: Project setup with Icefaces
                  ansel1

                  I was running into this too. I read somewhere that this might help, and when I tried it, it did work.

                  Replace:

                  <servlet>
                   <servlet-name>Faces Servlet</servlet-name>
                   <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
                   <load-on-startup>1</load-on-startup>
                  </servlet>


                  with this myfaces servlet:

                  <servlet>
                   <servlet-name>Faces Servlet</servlet-name>
                   <servlet-class>org.apache.myfaces.webapp.MyFacesServlet</servlet-class>
                   <load-on-startup>1</load-on-startup>
                  </servlet>


                  • 6. Re: Project setup with Icefaces
                    patrickmadden

                    I would download the latest 1.1.0.GA of Seam. I too was just using the CR2 version. As with any software there are a few other hoops you will have to jump through.

                    My faces-config.xml has the following:

                    
                    <faces-config>
                    
                     <managed-bean>
                     <managed-bean-name>highlight</managed-bean-name>
                     <managed-bean-class>com.icesoft.faces.context.effects.Highlight</managed-bean-class>
                     <managed-bean-scope>application</managed-bean-scope>
                     </managed-bean>
                    
                     <application>
                     <message-bundle>messages</message-bundle>
                     <!-- view-handler>com.sun.facelets.FaceletViewHandler</view-handler -->
                     <view-handler>com.icesoft.faces.facelets.D2DSeamFaceletViewHandler</view-handler>
                     </application>
                    
                     <!-- Seam transaction management -->
                     <lifecycle>
                     <phase-listener>org.jboss.seam.jsf.TransactionalSeamPhaseListener</phase-listener>
                     </lifecycle>
                    </faces-config>
                    


                    My application.xml has the following:

                    
                    <application>
                     <display-name>Seam Generated Application</display-name>
                     <description>created by seam-gen</description>
                    
                     <module>
                     <web>
                     <web-uri>CloosterWeb20.war</web-uri>
                     <context-root>/Clooster</context-root>
                     </web>
                     </module>
                     <module>
                     <java>jboss-seam.jar</java>
                     </module>
                     <module>
                     <ejb>CloosterWeb20.jar</ejb>
                     </module>
                     <module>
                     <java>icefaces.jar</java>
                     </module>
                     <module>
                     <java>icefaces-facelets.jar</java>
                     </module>
                     <module>
                     <java>icefaces-comps.jar</java>
                     </module>
                     <module>
                     <java>jbpm-3.1.2.jar</java>
                     </module>
                     <module>
                     <java>el-api.jar</java>
                     </module>
                     <module>
                     <java>el-ri.jar</java>
                     </module>
                    </application>
                    


                    And here is my web.xml

                    
                    <?xml version="1.0" ?>
                    <web-app version="2.5"
                     xmlns="http://java.sun.com/xml/ns/j2ee"
                     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                     xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_5.xsd">
                    
                     <context-param>
                     <param-name>javax.faces.CONFIG_FILES</param-name>
                     <param-value>/WEB-INF/navigation.xml</param-value>
                     </context-param>
                    
                     <!-- Seam -->
                     <listener>
                     <listener-class>org.jboss.seam.servlet.SeamListener</listener-class>
                     </listener>
                    
                     <!-- Propagate conversations across redirects -->
                    
                    <!--
                     <filter>
                     <filter-name>Seam Redirect Filter</filter-name>
                     <filter-class>org.jboss.seam.servlet.SeamRedirectFilter</filter-class>
                     </filter>
                    
                     <filter-mapping>
                     <filter-name>Seam Redirect Filter</filter-name>
                     <url-pattern>*.seam</url-pattern>
                     </filter-mapping>
                    -->
                    
                     <!-- propogate seam context to servlets (pvm) addition -->
                     <filter>
                     <filter-name>Seam Servlet Filter</filter-name>
                     <filter-class>org.jboss.seam.servlet.SeamServletFilter</filter-class>
                     </filter>
                     <filter-mapping>
                     <filter-name>Seam Servlet Filter</filter-name>
                     <url-pattern>/servlet/*</url-pattern>
                     </filter-mapping>
                     <!-- end seam context to servlets -->
                    
                     <filter>
                     <filter-name>Seam Exception Filter</filter-name>
                     <filter-class>org.jboss.seam.servlet.SeamExceptionFilter</filter-class>
                     </filter>
                    
                     <filter-mapping>
                     <filter-name>Seam Exception Filter</filter-name>
                     <url-pattern>*.seam</url-pattern>
                     </filter-mapping>
                    
                     <!-- End Seam -->
                    
                    
                     <!-- JSF -->
                     <context-param>
                     <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
                     <param-value>client</param-value>
                     </context-param>
                    
                     <context-param>
                     <param-name>javax.faces.DEFAULT_SUFFIX</param-name>
                     <param-value>.xhtml</param-value>
                     </context-param>
                    
                     <context-param>
                     <param-name>facelets.DEVELOPMENT</param-name>
                     <param-value>true</param-value>
                     </context-param>
                    
                     <context-param>
                     <param-name>com.icesoft.faces.actionURLSuffix</param-name>
                     <param-value>.seam</param-value>
                     </context-param>
                    
                     <context-param>
                     <param-name>com.icesoft.faces.synchronousUpdate</param-name>
                     <param-value>true</param-value>
                     </context-param>
                    
                     <servlet>
                     <servlet-name>Faces Servlet</servlet-name>
                     <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
                     <load-on-startup>1</load-on-startup>
                     </servlet>
                    
                     <!-- Faces Servlet Mapping -->
                    <!--
                     <servlet-mapping>
                     <servlet-name>Faces Servlet</servlet-name>
                     <url-pattern>*.seam</url-pattern>
                     </servlet-mapping>
                    
                    -->
                    
                     <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>
                     <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-mapping>
                     <servlet-name>Persistent Faces Servlet</servlet-name>
                     <url-pattern>/xmlhttp/*</url-pattern>
                     </servlet-mapping>
                    
                     <servlet-mapping>
                     <servlet-name>Persistent Faces Servlet</servlet-name>
                     <url-pattern>/xmlhttp/*</url-pattern>
                     </servlet-mapping>
                    
                     <servlet-mapping>
                     <servlet-name>Persistent Faces Servlet</servlet-name>
                     <url-pattern>*.iface</url-pattern>
                     </servlet-mapping>
                    
                     <!-- Blocking Servlet Mapping -->
                     <servlet-mapping>
                     <servlet-name>Blocking Servlet</servlet-name>
                     <url-pattern>/block/*</url-pattern>
                     </servlet-mapping>
                    
                    
                     <!-- Faces Servlet Mapping -->
                     <servlet-mapping>
                     <servlet-name>Persistent Faces Servlet</servlet-name>
                     <url-pattern>*.seam</url-pattern>
                     </servlet-mapping>
                    
                     <!-- MyFaces -->
                     <listener>
                     <listener-class>org.apache.myfaces.webapp.StartupServletContextListener</listener-class>
                     </listener>
                     <!-- End MyFaces -->
                    
                     <!-- JSF RI -->
                     <!--
                     <listener>
                     <listener-class>com.sun.faces.config.ConfigureListener</listener-class>
                     </listener
                     -->
                    </web-app>
                    
                    


                    When upgrading from CR2 to GA I just made sure to copy my seam-gen/build.properties to from my CR2 to GA directory. I also then copied the GA jboss-seam*.jar (minus the sem-gen.jar) to my own eclipse project's lib directory.

                    I'm no expert, in fact I'm a seam newbie. Only been using it for 2 weeks max. Regardless, I was able to get my project running with Icefaces. You'll notice a pretty significant difference when jboss starts up. I'm using 4.0.5 GA.

                    Hope this is of help.

                    PVM