11 Replies Latest reply on Feb 19, 2007 6:24 PM by Chris Lowe

    Seam, Trinidad, Ajax4Jsf and Facelets

    Chris Lowe Apprentice

      I can't for the life of me get these libraries to play together. There are no exceptions - just the Ajax4Jsf components do not render. Without Trinidad, I have been able use the Ajax4Jsf poller just fine.

      I've added a simple poller to my page as follows:

      <!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:tr="http://myfaces.apache.org/trinidad"
       xmlns:a4j="https://ajax4jsf.dev.java.net/ajax">
      
      <ui:composition template="../public/common.xhtml">
       <ui:define name="body">
      
      <form jsfc="tr:form">
       <a4j:poll interval="1000" action="#{paymentBean.pollPaymentStatus }" />
      </form>
      
       ...
       </ui:define>
      </ui:composition>
      </html>


      At render time, the poller is ignored and nothing is added to my page, hence no polling. I get output like this repeated about 12 times despite there only being one instance of the poller:

      14:04:26,453 ERROR [STDERR] 29-Jan-2007 14:04:26 org.apache.myfaces.trinidadinternal.renderkit.RenderKitBase getRenderer
      WARNING: Renderer 'javax.faces.ViewRoot' not found for component family 'javax.faces.ViewRoot'
      14:04:26,453 INFO [[/ripuk]] No Renderer found for component {Component-Path : [Class: org.ajax4jsf.framework.ajax.AjaxViewRoot,ViewId: /view/secure/payment-processing.xhtml]} (component-family=javax.faces.ViewRoot, renderer-type= javax.faces.ViewRoot)
      14:04:26,453 WARN [UIComponentBase] No Renderer found for component {Component-Path : [Class: org.ajax4jsf.framework.ajax.AjaxViewRoot,ViewId: /view/secure/payment-processing.xhtml]} (component-family=javax.faces.ViewRoot, renderer-type=javax.faces.ViewRoot)


      Is there anything special that I need to do in order to make these libraries play together?

      I have seen the wiki http://wiki.apache.org/myfaces/TrinidadSeamAjax4Jsf
      and the forum posting http://jboss.com/index.html?module=bb&op=viewtopic&p=3994880

      I tried their recommendations but no luck.

      My web.xml and faces-config.xml are below.

      Any help will be greatly appreciated - I'm starting to lose hair over this.

      Best Regards,

      Chris.


      web.xml
      
      <?xml version="1.0"?>
      <web-app version="2.4"
       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_4.xsd ">
      
       <!-- MyFaces ******************************************************************************** -->
      
       <context-param>
       <param-name>javax.faces.CONFIG_FILES</param-name>
       <param-value>/WEB-INF/navigation.xml, /WEB-INF/managed-beans.xml,/WEB-INF/con-val.xml</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>javax.faces.STATE_SAVING_METHOD</param-name>
       <param-value>client</param-value>
       </context-param>
      
      
       <!-- Trinidad ******************************************************************************* -->
      
       <context-param>
       <param-name>org.apache.myfaces.trinidad.ALTERNATE_VIEW_HANDLER</param-name>
       <param-value>com.sun.facelets.FaceletViewHandler</param-value>
       </context-param>
      
      
       <!-- Facelets ******************************************************************************* -->
      
       <context-param>
       <param-name>facelets.LIBRARIES</param-name>
       <param-value>/WEB-INF/facelets/ripuk.taglib.xml</param-value>
       </context-param>
      
       <context-param>
       <param-name>facelets.DEVELOPMENT</param-name>
       <param-value>true</param-value>
       </context-param>
      
       <context-param>
       <param-name>facelets.SKIP_COMMENTS</param-name>
       <param-value>false</param-value>
       </context-param>
      
      
       <!-- Filters ******************************************************************************** -->
      
       <!-- ajax4jsf filter - must be before any other filter -->
       <filter>
       <display-name>Ajax4jsf Filter</display-name>
       <filter-name>ajax4jsf</filter-name>
       <filter-class> org.ajax4jsf.Filter</filter-class>
       </filter>
      
       <filter-mapping>
       <filter-name>ajax4jsf</filter-name>
       <servlet-name>Faces Servlet</servlet-name>
       </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>
      
      
       <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>trinidad</filter-name>
       <filter-class>org.apache.myfaces.trinidad.webapp.TrinidadFilter </filter-class>
       </filter>
      
       <filter-mapping>
       <filter-name>trinidad</filter-name>
       <servlet-name>Faces Servlet</servlet-name>
       </filter-mapping>
      
      
       <!-- Listeners ****************************************************************************** -->
      
       <listener>
       <listener-class>org.jboss.seam.servlet.SeamListener</listener-class>
       </listener>
      
       <listener>
       <listener-class>org.apache.myfaces.webapp.StartupServletContextListener </listener-class>
       </listener>
      
      
       <!-- Servlets ******************************************************************************* -->
      
       <servlet>
       <servlet-name>Faces Servlet</servlet-name>
       <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
       <load-on-startup>1</load-on-startup>
       </servlet>
      
       <servlet-mapping>
       <servlet-name>Faces Servlet</servlet-name>
       <url-pattern>*.seam</url-pattern>
       </servlet-mapping>
      
      
       <servlet>
       <servlet-name>resources</servlet-name>
       <servlet-class>org.apache.myfaces.trinidad.webapp.ResourceServlet </servlet-class>
       </servlet>
      
       <servlet-mapping>
       <servlet-name>resources</servlet-name>
       <url-pattern>/adf/*</url-pattern>
       </servlet-mapping>
      
      
       <!-- Misc *********************************************************************************** -->
      
       <login-config>
       <auth-method>BASIC</auth-method>
       </login-config>
      
       <error-page>
       <error-code>404</error-code>
       <location>/view/public/home.seam</location>
       </error-page>
      
       <session-config>
       <session-timeout>30</session-timeout>
       </session-config>
      </web-app>
      
      
      
      faces-config.xml
      
      <faces-config>
      
       <application>
       <default-render-kit-id>org.apache.myfaces.trinidad.core</default-render-kit-id>
       </application>
      
       <lifecycle>
       <phase-listener>org.jboss.seam.jsf.SeamExtendedManagedPersistencePhaseListener</phase-listener>
       </lifecycle>
      
       <application>
       <message-bundle>messages</message-bundle>
       <locale-config>
       <default-locale>en</default-locale>
       <supported-locale>en</supported-locale>
       </locale-config>
       </application>
      
      </faces-config>


        • 1. Re: Seam, Trinidad, Ajax4Jsf and Facelets
          Sergey Smirnov Master

          What are the jar files for ajax4jsf you have in the classpath. It should be three of them. The filter-mapping you have does not cover them whole use cases. Please, sync it with what is mentioned at:
          https://ajax4jsf.dev.java.net/nonav/ajax/ajax-jsf/download.html

          • 2. Re: Seam, Trinidad, Ajax4Jsf and Facelets
            Chris Lowe Apprentice

            Hi Sergey,

            I took an update as of last night, so my jars are:

            ajax4jsf.jar (1.0.6)
            a4j-trinidad.jar (1.0.5)
            oscache-2.3.2.jar

            Same for the Trinidad jars too - they are taken from the nightly build 13th Feb 2007.

            Cheers,

            Chris.

            • 3. Re: Seam, Trinidad, Ajax4Jsf and Facelets
              Chris Lowe Apprentice

              I have aligned my filter mapping to that on the link you gave:

              <filter>
               <display-name>Ajax4jsf Filter</display-name>
               <filter-name>ajax4jsf</filter-name>
               <filter-class>org.ajax4jsf.Filter</filter-class>
               <init-param>
               <param-name>forceparser</param-name>
               <param-value>false</param-value>
               </init-param>
              </filter>
              <filter-mapping>
               <filter-name>ajax4jsf</filter-name>
               <servlet-name>Faces Servlet</servlet-name>
               <dispatcher>REQUEST</dispatcher>
               <dispatcher>FORWARD</dispatcher>
               <dispatcher>INCLUDE</dispatcher>
              </filter-mapping>


              But still no ajax4jsf components are rendered.

              Cheers,

              Chris.

              • 4. Re: Seam, Trinidad, Ajax4Jsf and Facelets
                Chris Lowe Apprentice

                Sergey,

                I'm still having problems with getting ajax4jsf to render in my environment, are there any pointers you could give me on where I might look in the code?

                Cheers,

                Chris.

                • 5. Re: Seam, Trinidad, Ajax4Jsf and Facelets
                  Tomas Wahlgren Newbie

                  I have a problem with the same components as you, however I get a significant stack-trace...
                  2007-feb-19 13:58:37 com.sun.facelets.FaceletViewHandler handleRenderException
                  ALLVARLIG: Error Rendering View[/start.jspx]
                  com.sun.facelets.tag.TagAttributeException: /menu.jspx @34,173 action="#{mainBean.setCurrentObject(listItem)}" Error Parsing: #{mainBean.setCurrentObject(listItem)}
                  at com.sun.facelets.tag.TagAttribute.getMethodExpression(TagAttribute.java:144)
                  at com.sun.facelets.tag.jsf.ActionSourceRule$ActionMapper.applyMetadata(ActionSourceRule.java:50)
                  at com.sun.facelets.tag.MetadataImpl.applyMetadata(MetadataImpl.java:36)
                  at com.sun.facelets.tag.MetaTagHandler.setAttributes(MetaTagHandler.java:62)
                  at com.sun.facelets.tag.jsf.ComponentHandler.apply(ComponentHandler.java:144)
                  at com.sun.facelets.tag.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:47)
                  at com.sun.facelets.tag.jsf.ComponentHandler.applyNextHandler(ComponentHandler.java:314)
                  at com.sun.facelets.tag.jsf.ComponentHandler.apply(ComponentHandler.java:169)
                  at com.sun.facelets.tag.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:47)
                  at com.sun.facelets.tag.jsf.ComponentHandler.applyNextHandler(ComponentHandler.java:314)
                  at com.sun.facelets.tag.jsf.ComponentHandler.apply(ComponentHandler.java:169)
                  at com.sun.facelets.tag.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:47)
                  at com.sun.facelets.tag.jsf.ComponentHandler.applyNextHandler(ComponentHandler.java:314)
                  at com.sun.facelets.tag.jsf.ComponentHandler.apply(ComponentHandler.java:169)
                  at com.sun.facelets.tag.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:47)
                  at com.sun.facelets.tag.ui.CompositionHandler.apply(CompositionHandler.java:119)
                  at com.sun.facelets.compiler.NamespaceHandler.apply(NamespaceHandler.java:49)
                  at com.sun.facelets.compiler.EncodingHandler.apply(EncodingHandler.java:25)
                  at com.sun.facelets.impl.DefaultFacelet.include(DefaultFacelet.java:248)
                  at com.sun.facelets.impl.DefaultFacelet.include(DefaultFacelet.java:294)
                  at com.sun.facelets.impl.DefaultFacelet.include(DefaultFacelet.java:273)
                  at com.sun.facelets.impl.DefaultFaceletContext.includeFacelet(DefaultFaceletContext.java:143)
                  at com.sun.facelets.tag.ui.IncludeHandler.apply(IncludeHandler.java:60)
                  at com.sun.facelets.tag.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:47)
                  at com.sun.facelets.tag.jsf.ComponentHandler.applyNextHandler(ComponentHandler.java:314)
                  at com.sun.facelets.tag.jsf.ComponentHandler.apply(ComponentHandler.java:169)
                  at com.sun.facelets.tag.jsf.core.ViewHandler.apply(ViewHandler.java:109)
                  at com.sun.facelets.tag.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:47)
                  at com.sun.facelets.compiler.NamespaceHandler.apply(NamespaceHandler.java:49)
                  at com.sun.facelets.tag.ui.CompositionHandler.apply(CompositionHandler.java:119)
                  at com.sun.facelets.compiler.NamespaceHandler.apply(NamespaceHandler.java:49)
                  at com.sun.facelets.compiler.EncodingHandler.apply(EncodingHandler.java:25)
                  at com.sun.facelets.impl.DefaultFacelet.include(DefaultFacelet.java:248)
                  at com.sun.facelets.impl.DefaultFacelet.include(DefaultFacelet.java:294)
                  at com.sun.facelets.impl.DefaultFacelet.include(DefaultFacelet.java:273)
                  at com.sun.facelets.impl.DefaultFaceletContext.includeFacelet(DefaultFaceletContext.java:143)
                  at com.sun.facelets.tag.ui.CompositionHandler.apply(CompositionHandler.java:113)
                  at com.sun.facelets.compiler.NamespaceHandler.apply(NamespaceHandler.java:49)
                  at com.sun.facelets.compiler.EncodingHandler.apply(EncodingHandler.java:25)
                  at com.sun.facelets.impl.DefaultFacelet.apply(DefaultFacelet.java:95)
                  at com.sun.facelets.FaceletViewHandler.buildView(FaceletViewHandler.java:503)
                  at com.sun.facelets.FaceletViewHandler.renderView(FaceletViewHandler.java:546)
                  at org.apache.myfaces.trinidadinternal.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:182)
                  at org.ajax4jsf.framework.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:101)
                  at org.ajax4jsf.framework.ajax.AjaxViewHandler.renderView(AjaxViewHandler.java:221)
                  at org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:384)
                  at javax.faces.webapp.FacesServlet.service(FacesServlet.java:138)
                  at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
                  at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
                  at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl._invokeDoFilter(TrinidadFilterImpl.java:210)
                  at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl._doFilterImpl(TrinidadFilterImpl.java:167)
                  at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl.doFilter(TrinidadFilterImpl.java:140)
                  at org.apache.myfaces.trinidad.webapp.TrinidadFilter.doFilter(TrinidadFilter.java:93)
                  at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
                  at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
                  at org.jboss.seam.servlet.SeamRedirectFilter.doFilter(SeamRedirectFilter.java:29)
                  at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
                  at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
                  at org.ajax4jsf.framework.ajax.xmlfilter.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:75)
                  at org.ajax4jsf.framework.ajax.xmlfilter.BaseFilter.doFilter(BaseFilter.java:213)
                  at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
                  at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
                  at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
                  at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
                  at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
                  at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
                  at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
                  at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
                  at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
                  at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
                  at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
                  at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
                  at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
                  at java.lang.Thread.run(Unknown Source)
                  Caused by: javax.el.ELException: Error Parsing: #{mainBean.setCurrentObject(listItem)}
                  at com.sun.el.lang.ExpressionBuilder.createNodeInternal(ExpressionBuilder.java:140)
                  at com.sun.el.lang.ExpressionBuilder.build(ExpressionBuilder.java:157)
                  at com.sun.el.lang.ExpressionBuilder.createMethodExpression(ExpressionBuilder.java:208)
                  at com.sun.el.ExpressionFactoryImpl.createMethodExpression(ExpressionFactoryImpl.java:63)
                  at com.sun.facelets.tag.TagAttribute.getMethodExpression(TagAttribute.java:141)
                  ... 73 more
                  Caused by: com.sun.el.parser.ParseException: Encountered "(" at line 1, column 28.
                  Was expecting one of:
                  "}" ...
                  "." ...
                  "[" ...
                  ">" ...
                  "gt" ...
                  "<" ...
                  "lt" ...
                  ">=" ...
                  "ge" ...
                  "<=" ...
                  "le" ...
                  "==" ...
                  "eq" ...
                  "!=" ...
                  "ne" ...
                  "&&" ...
                  "and" ...
                  "||" ...
                  "or" ...
                  "*" ...
                  "+" ...
                  "-" ...
                  "?" ...
                  "/" ...
                  "div" ...
                  "%" ...
                  "mod" ...

                  at com.sun.el.parser.ELParser.generateParseException(ELParser.java:1651)
                  at com.sun.el.parser.ELParser.jj_consume_token(ELParser.java:1531)
                  at com.sun.el.parser.ELParser.DeferredExpression(ELParser.java:134)
                  at com.sun.el.parser.ELParser.CompositeExpression(ELParser.java:61)
                  at com.sun.el.lang.ExpressionBuilder.createNodeInternal(ExpressionBuilder.java:103)
                  ... 77 more
                  13:58:37,609 DEBUG [org.jboss.seam.contexts.Lifecycle] After render response, destroying contexts
                  13:58:37,609 DEBUG [org.jboss.seam.contexts.Lifecycle] destroying business process context
                  13:58:37,609 DEBUG [org.jboss.seam.contexts.Lifecycle] destroying conversation context
                  13:58:37,609 DEBUG [org.jboss.seam.contexts.Lifecycle] flushing server-side conversation context
                  13:58:37,609 DEBUG [org.jboss.seam.contexts.Lifecycle] flushing session context
                  13:58:37,609 DEBUG [org.jboss.seam.contexts.Lifecycle] destroying event context
                  13:58:37,609 DEBUG [org.jboss.seam.contexts.Lifecycle] <<< End web request

                  Anyone seen this before?

                  • 6. Re: Seam, Trinidad, Ajax4Jsf and Facelets
                    Danijel Jevtic Novice

                    Use the SeamFaceletViewHandler instead of sun's as the alternate view handler. Parameters for method bindings are seam specific. the sun facelet view handler does not know how to handle those.

                    • 7. Re: Seam, Trinidad, Ajax4Jsf and Facelets
                      Lawrie Gallardo Newbie

                      @ehstowa

                      I believe that in order to pass parameters to your EL action listener method you need to be using Seam's enhanced expression language (and from your stack trace it doesn't look like you've got this configured).

                      From the Seam reference manual (Chapter 23):

                      To use this feature in Facelets, you will need to declare a special view handler, SeamFaceletViewHandler in
                      faces-config.xml.

                      <faces-config>
                       <application>
                       <view-handler>org.jboss.seam.ui.facelet.SeamFaceletViewHandler</view-handler>
                       </application>
                      </faces-config>


                      Hope this helps,

                      Lawrie

                      • 8. Re: Seam, Trinidad, Ajax4Jsf and Facelets
                        Chris Lowe Apprentice

                        ehstowa,

                        From your stack trace I agree with lawieg so give his suggestion a go, however please be aware that the Trinidad Wiki specifies that *no* view handlers should be defined in faces-config.xml

                        http://wiki.apache.org/myfaces/TrinidadSeamAjax4Jsf

                        If you do get past your current issue, could you comment on this topic as to whether your Ajax4Jsf components are actually being rendered or not?

                        Regards,

                        Chris

                        • 9. Re: Seam, Trinidad, Ajax4Jsf and Facelets
                          Pete Muir Master

                          I never managed to get the EL extension working with Trinidad (no Ajax4JSF in there) - have others?

                          • 10. Re: Seam, Trinidad, Ajax4Jsf and Facelets
                            Chris Lowe Apprentice

                            Pete,

                            Nope - I have had no success, but would very much like to have this functionality.

                            Cheers,

                            Chris.

                            • 11. Re: Seam, Trinidad, Ajax4Jsf and Facelets
                              Chris Lowe Apprentice

                              I've just upgraded my faces core from 1.1.4 to 1.1.5 and this has resolved my issue - Ajax4Jsf components are now rendering.