10 Replies Latest reply on Sep 26, 2007 11:19 AM by juanignaciosl

    MyFaces 1.5 and richfaces 3.1.0

      Hi All,

      I am trying to use MyFaces 1.5 with RichFaces 3.1.0.
      In Ajax4JSf I am trying to use a4j:include component.when I am trying that I am getting stream closed exception.(The Exception is like when we got the response is alredy committed.)

      I don't know as I have seen in the documentation It works with MyFaces 1.5.Is anyone trying the same combination or anyone had the same problem already please let me know the solution.

      Venkat.

        • 1. Re: MyFaces 1.5 and richfaces 3.1.0
          ilya_shaikovsky

          Show us your pages also please. I've deployed myFaces based applications day before And wasn't seen such problem.

          • 2. Re: MyFaces 1.5 and richfaces 3.1.0
            juanignaciosl

            I've been successfully using that combination for several months now (in fact, better than with JSF RI 1.1). I can't remember having that kind of exception, but I'd double check sources paths. Relative paths are often a source of problems.

            • 3. Re: MyFaces 1.5 and richfaces 3.1.0

              Hi ilya_shaikovsky,

              I am trying the basic example in the ajax include tag with MyFaces 1.5 and Tomahawk 1.3 and RichFaces.

              My Code is Here :

              <%@ taglib uri="http://richfaces.org/rich" prefix="rich" %>
              <%@ taglib uri="http://richfaces.org/a4j" prefix="a4j" %>
              <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
              <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>

              <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">





              .col1 { vertical-align:top; }
              .col2 { vertical-align:top; width:450px; }
              .wizard { width:400px; }
              .wform td { vertical-align:top; }
              .wfcol1 { width:60px; vertical-align:top; }
              .wfcol2 { vertical-align:top; }
              .wfcol3 { vertical-align:top; }
              .s1row td { height:30px; }
              .rich-message { color:red; }


              <rich:separator height="1" style="padding:10px"/>
              <h:panelGrid width="100%" columns="2" columnClasses="col1,col2">
              <f:verbatim>
              The demo shows the example of three-steps wizard created
              using a4j:include. The navigation rules defined in the
              faces-config.xml are used to navigate between the steps
              of the wizard.

              </f:verbatim>
              <a4j:keepAlive beanName="registerbean" />
              <rich:panel styleClass="wizard">
              <f:facet name="header">
              <h:outputText value="Using a4j:include for Wizard-like behaviour" />
              </f:facet>
              <h:form>
              <a4j:include viewId="/pages/logic/Registration/registration_basic.jsp" />
              </h:form>
              </rich:panel>

              </h:panelGrid>
              <rich:separator height="1" style="padding:10px"/>




              And when I am trying to access this page it is giving me the stream closed Exception.

              java.io.IOException: Stream closed
              org.apache.jasper.runtime.JspWriterImpl.ensureOpen(JspWriterImpl.java:204)
              org.apache.jasper.runtime.JspWriterImpl.write(JspWriterImpl.java:212)
              org.apache.myfaces.shared_impl.renderkit.html.HtmlResponseWriterImpl.startElement(HtmlResponseWriterImpl.java:171)
              org.richfaces.renderkit.html.PanelRenderer.doEncodeBegin(PanelRenderer.java:133)
              org.richfaces.renderkit.html.PanelRenderer.doEncodeBegin(PanelRenderer.java:128)
              org.ajax4jsf.renderkit.RendererBase.encodeBegin(RendererBase.java:101)
              javax.faces.component.UIComponentBase.encodeBegin(UIComponentBase.java:515)
              javax.faces.webapp.UIComponentTag.encodeBegin(UIComponentTag.java:467)
              javax.faces.webapp.UIComponentTag.doEndTag(UIComponentTag.java:363)
              org.apache.jsp.richajaxinclude_jsp._jspx_meth_rich_005fpanel_005f0(richajaxinclude_jsp.java:285)
              org.apache.jsp.richajaxinclude_jsp._jspx_meth_h_005fpanelGrid_005f0(richajaxinclude_jsp.java:183)
              org.apache.jsp.richajaxinclude_jsp._jspService(richajaxinclude_jsp.java:108)
              org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
              javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
              org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:393)
              org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320)
              org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
              javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
              org.apache.myfaces.context.servlet.ServletExternalContextImpl.dispatch(ServletExternalContextImpl.java:419)
              org.apache.myfaces.application.jsp.JspViewHandlerImpl.renderView(JspViewHandlerImpl.java:211)
              org.ajax4jsf.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:108)
              org.ajax4jsf.application.AjaxViewHandler.renderView(AjaxViewHandler.java:216)
              org.apache.myfaces.lifecycle.RenderResponseExecutor.execute(RenderResponseExecutor.java:41)
              org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:132)
              javax.faces.webapp.FacesServlet.service(FacesServlet.java:140)
              org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:141)
              org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:281)
              org.apache.myfaces.webapp.filter.ExtensionsFilter.doFilter(ExtensionsFilter.java:144)


              I think you may better understand why it is giving that error.

              Thanks
              Venkat.

              • 4. Re: MyFaces 1.5 and richfaces 3.1.0

                Hi juanignaciosl,

                Thanks for your reply.
                Can you suggest me where I have gone wrong in the above case I am using RichFaces 3.1.0.

                Can you name the jar files which you on the classpath and the web.xml configuration.

                Thanks
                Venkat.

                • 5. Re: MyFaces 1.5 and richfaces 3.1.0

                  Hi ilya_shaikovsky,

                  In the above I forgot to mention the RichFaces version that is RichFaces 3.1.0.

                  Venkat.

                  • 6. Re: MyFaces 1.5 and richfaces 3.1.0
                    juanignaciosl

                    I'm far for being a JSF expert, but top lines of the stack trace suggest it can't find/open included file, can it?

                    I'm using MyFaces 1.1.5 stable version, and I've been using several versions of RichFaces, from 3.0 to 3.1.1 snapshots.

                    This is my web.xml, check filter order:

                    <?xml version="1.0" encoding="UTF-8"?>
                    <web-app xmlns="http://java.sun.com/xml/ns/j2ee"
                     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="2.4"
                     xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee web-app_2_4.xsd">
                    
                    
                     <!-- Facelets -->
                     <context-param>
                     <param-name>javax.faces.DEFAULT_SUFFIX</param-name>
                     <param-value>.jspx</param-value>
                     </context-param>
                     <context-param>
                     <param-name>facelets.DEVELOPMENT</param-name>
                     <param-value>true</param-value>
                     </context-param>
                     <context-param>
                     <param-name>org.ajax4jsf.VIEW_HANDLERS</param-name>
                     <param-value>com.sun.facelets.FaceletViewHandler</param-value>
                     </context-param>
                     <context-param>
                     <param-name>facelets.LIBRARIES</param-name>
                     <param-value>/WEB-INF/gnomos.taglib.xml</param-value>
                     </context-param>
                    
                     <!-- JSF -->
                     <!-- Spring -->
                     <context-param>
                     <param-name>contextConfigLocation</param-name>
                     <param-value>/WEB-INF/applicationContext.xml</param-value>
                     </context-param>
                    
                     <!-- Ajax4JSF & Rich Faces -->
                     <context-param>
                     <param-name>enable-cache</param-name>
                     <param-value>false</param-value>
                     </context-param>
                    
                     <!-- Ajax4JSF (debe ser el primero) -->
                     <filter>
                     <display-name>RichFaces Filter</display-name>
                     <filter-name>richfaces</filter-name>
                     <filter-class>org.ajax4jsf.Filter</filter-class>
                     <init-param>
                     <param-name>forceparser</param-name>
                     <param-value>false</param-value>
                     </init-param>
                     </filter>
                    
                     <!-- Acegi -->
                     <filter>
                     <filter-name>Acegi Filter Chain Proxy</filter-name>
                     <filter-class>
                     org.acegisecurity.util.FilterToBeanProxy
                     </filter-class>
                     <init-param>
                     <param-name>targetClass</param-name>
                     <param-value>
                     org.acegisecurity.util.FilterChainProxy
                     </param-value>
                     </init-param>
                     </filter>
                    
                     <!-- Sesión en vista -->
                     <filter>
                     <filter-name>sessionFilter</filter-name>
                     <filter-class>
                     org.springframework.orm.hibernate3.support.OpenSessionInViewFilter
                     </filter-class>
                     <init-param>
                     <param-name>singleSession</param-name>
                     <param-value>true</param-value>
                     </init-param>
                     <init-param>
                     <param-name>sessionFactoryBeanName</param-name>
                     <param-value>sessionFactory</param-value>
                     </init-param>
                     </filter>
                     <!-- Tomahawk -->
                     <filter>
                     <filter-name>MyFacesExtensionsFilter</filter-name>
                     <filter-class>
                     org.apache.myfaces.webapp.filter.ExtensionsFilter
                     </filter-class>
                     <init-param>
                     <param-name>maxFileSize</param-name>
                     <param-value>20m</param-value>
                    
                     </init-param>
                     </filter>
                     <!-- FIN FILTROS -->
                    
                     <!-- MAPEOS DE FILTROS -->
                     <filter-mapping>
                     <filter-name>richfaces</filter-name>
                     <servlet-name>Faces Servlet</servlet-name>
                     <dispatcher>REQUEST</dispatcher>
                     <dispatcher>FORWARD</dispatcher>
                     <dispatcher>INCLUDE</dispatcher>
                     </filter-mapping>
                    
                     <!-- Descomentar para activar la autenticación -->
                     <!-- <filter-mapping>
                     <filter-name>Acegi Filter Chain Proxy</filter-name>
                     <url-pattern>/*</url-pattern>
                     </filter-mapping> -->
                    
                     <filter-mapping>
                     <filter-name>sessionFilter</filter-name>
                     <url-pattern>/*</url-pattern>
                     </filter-mapping>
                     <filter-mapping>
                     <filter-name>MyFacesExtensionsFilter</filter-name>
                     <url-pattern>/*</url-pattern>
                     </filter-mapping>
                     <!-- extension mapping for adding <script/>, <link/>, and other resource tags to JSF-pages -->
                     <!-- <filter-mapping>
                     <filter-name>MyFacesExtensionsFilter</filter-name>
                     <servlet-name>Faces Servlet</servlet-name>
                     </filter-mapping> -->
                     <!-- extension mapping for serving page-independent resources (javascript, stylesheets, images, etc.) -->
                     <filter-mapping>
                     <filter-name>MyFacesExtensionsFilter</filter-name>
                     <url-pattern>/faces/myFacesExtensionResource/*</url-pattern>
                     </filter-mapping>
                     <!-- Fin Tomahawk -->
                     <!-- FIN MAPEOS DE FILTROS -->
                    
                     <listener>
                     <listener-class>
                     org.springframework.web.context.ContextLoaderListener
                     </listener-class>
                     </listener>
                    
                     <!-- SERVLETS -->
                     <!-- Acegi Servlet -->
                     <servlet>
                     <servlet-name>casproxy</servlet-name>
                     <servlet-class>
                     edu.yale.its.tp.cas.proxy.ProxyTicketReceptor
                     </servlet-class>
                     </servlet>
                    
                     <!-- Faces Servlet -->
                     <servlet>
                     <servlet-name>Faces Servlet</servlet-name>
                     <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
                     <load-on-startup>1</load-on-startup>
                     </servlet>
                    
                     <!-- MAPEOS DE SERVLETS -->
                     <servlet-mapping>
                     <servlet-name>casproxy</servlet-name>
                     <url-pattern>/casProxy/*</url-pattern>
                     </servlet-mapping>
                     <!-- Faces Servlet Mapping -->
                     <servlet-mapping>
                     <servlet-name>Faces Servlet</servlet-name>
                     <url-pattern>/faces/*</url-pattern>
                     </servlet-mapping>
                     <servlet-mapping>
                     <servlet-name>Faces Servlet</servlet-name>
                     <url-pattern>*.jsf</url-pattern>
                     </servlet-mapping>
                    </web-app>
                    


                    • 7. Re: MyFaces 1.5 and richfaces 3.1.0
                      ilya_shaikovsky

                      What server did you use? Under tomcat - rendering your page - causes no error.

                      • 8. Re: MyFaces 1.5 and richfaces 3.1.0

                        Hi ilya_shaikovsky,

                        I am using tomcat 6.0.

                        I am able to solve the problem.problem is I have to put that code in f:view otherwise it won't work.And one more important thing is the included files should not be in f:view.

                        I don't know Is this a problem or not.Because If I remove the f:view tag for the included page Those don't work indidually.

                        Venkat.

                        • 9. Re: MyFaces 1.5 and richfaces 3.1.0

                          Hi juanignaciosl,

                          I am using the filter order correctly.
                          When I used with facelets and JSF 1.2 it works like a champ.

                          But when I am using with MyFaces 1.5 without facelets It has given me the problem.

                          I think I found the workaround which I posted already.But I don't know is it the only way it works or Is there any alternative without removing f:view tag from the included page.

                          Venkat

                          • 10. Re: MyFaces 1.5 and richfaces 3.1.0
                            juanignaciosl

                            I remember also having issues with f:view, due to my inexperience with JSF. After struggling with many JSF stuff, the moral is clear: use Facelets :)