1 Reply Latest reply on Apr 18, 2007 2:19 AM by Fabrizio Boco

    a4j - trinidad - seam integration

    Fabrizio Boco Newbie

      Hi,

      I am using trinidad (incubating-SNAPSHOT 04.04.2007) & seam (1.2.1.GA) and I am trying a very simple experiment with a4j.

      This is my web.xml file

      <?xml version="1.0" encoding="UTF-8"?>
      <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">
      
      
       <listener>
       <listener-class>org.apache.myfaces.webapp.StartupServletContextListener</listener-class>
       </listener>
      
       <!-- ************************ SEAM Listener **************************** -->
       <listener>
       <listener-class>org.jboss.seam.servlet.SeamListener</listener-class>
       </listener>
      
       <!-- ************************ JSF Config **************************** -->
       <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>
      
       <context-param>
       <param-name>com.sun.faces.validateXml</param-name>
       <param-value>true</param-value>
       </context-param>
      
       <context-param>
       <param-name>com.sun.faces.verifyObjects</param-name>
       <param-value>true</param-value>
       </context-param>
      
       <!-- ************************ FACELETS Config **************************** -->
      
       <context-param>
       <param-name>facelets.DEVELOPMENT</param-name>
       <param-value>true</param-value>
       </context-param>
      
       <context-param>
       <param-name>facelets.REFRESH_PERIOD</param-name>
       <param-value>2</param-value>
       </context-param>
      
       <context-param>
       <description>Prevents HTML-Comments from beeing rendered</description>
       <param-name>facelets.SKIP_COMMENTS</param-name>
       <param-value>true</param-value>
       </context-param>
      
      
       <!-- ************************ AJAX4JSF Config **************************** -->
      
       <!-- Do not use with Trinidad.
       <context-param>
       <param-name>org.ajax4jsf.SKIN</param-name>
       <param-value>DEFAULT</param-value>
       </context-param>-->
      
      
       <!-- ************************ Trinidad Config **************************** -->
       <context-param>
       <param-name>org.apache.myfaces.trinidad.USE_APPLICATION_VIEW_CACHE</param-name>
       <param-value>false</param-value>
       </context-param>
      
       <context-param>
       <param-name>org.apache.myfaces.trinidad.ALTERNATE_VIEW_HANDLER</param-name>
       <param-value>org.jboss.seam.ui.facelet.SeamFaceletViewHandler</param-value>
       <!--<param-value>com.sun.facelets.FaceletViewHandler</param-value>-->
       </context-param>
      
       <context-param>
       <param-name>org.apache.myfaces.trinidadinternal.DISABLE_CONTENT_COMPRESSION</param-name>
       <param-value>true</param-value>
       </context-param>
      
       <!-- If this parameter is enabled, Trinidad will automatically
       check the modification date of your JSPs, and discard saved
       state when they change; this makes development easier,
       but adds overhead that should be avoided when your application
       is deployed -->
       <context-param>
       <param-name>org.apache.myfaces.trinidad.CHECK_FILE_MODIFICATION</param-name>
       <param-value>true</param-value>
       </context-param>
      
      
       <!-- ************************ AJAX4JSF Filter **************************** -->
       <!-- If you have other filters declared in the web.xml, be sure that Ajax4jsf Filter is declared before the others. -->
      
       <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>
       <url-pattern>*.seam</url-pattern>
       </filter-mapping>
      
       <!--
       <filter-mapping>
       <filter-name>ajax4jsf</filter-name>
       <url-pattern>/*</url-pattern>
       </filter-mapping>
       -->
      
       <!-- ************************ Trinidad Filter **************************** -->
       <filter>
       <filter-name>Trinidad</filter-name>
       <filter-class>org.apache.myfaces.trinidad.webapp.TrinidadFilter</filter-class>
       </filter>
      
       <filter-mapping>
       <filter-name>Trinidad</filter-name>
       <url-pattern>*.seam</url-pattern>
       </filter-mapping>
      
      
       <!-- ************************ Seam Filter **************************** -->
       <!--
       <filter>
       <filter-name>Seam Filter</filter-name>
       <filter-class>org.jboss.seam.web.SeamFilter</filter-class>
       </filter>
      
       <filter-mapping>
       <filter-name>Seam Filter</filter-name>
       <url-pattern>/*</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>
      
      
       <!-- ************************ SEAM Servlet Mapping ************************ -->
       <servlet>
       <servlet-name>Seam Resource Servlet</servlet-name>
       <servlet-class>org.jboss.seam.servlet.ResourceServlet</servlet-class>
       </servlet>
      
       <servlet-mapping>
       <servlet-name>Seam Resource Servlet</servlet-name>
       <url-pattern>/seam/resource/*</url-pattern>
       </servlet-mapping>
      
      
       <!-- ************************ Faces Servlet Mapping **************************** -->
       <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>
      
      
       <!-- ************************ Trinidad resources servlet **************************** -->
       <servlet>
       <servlet-name>Trinidad Resources</servlet-name>
       <servlet-class>org.apache.myfaces.trinidad.webapp.ResourceServlet</servlet-class>
       </servlet>
      
       <!-- This cannot be configured currently -->
       <servlet-mapping>
       <servlet-name>Trinidad Resources</servlet-name>
       <url-pattern>/adf/*</url-pattern>
       </servlet-mapping>
      
      
       <!-- ************************ Misc **************************** -->
       <session-config>
       <session-timeout>30</session-timeout>
       </session-config>
      
       <welcome-file-list>
       <welcome-file>index.html</welcome-file>
       </welcome-file-list>
      
      </web-app>
      


      This is my form that works fine

      
      .......
       <tr:inputText id="p1" value="#{bean.p1}" required="false" >
       <a4j:support event="onchange" reRender="p1_1" action="#{BeanManager.newP2Value}" />
       </tr:inputText>
       <tr:outputText id="p1_1" value="#{bean.p1}" />
       <tr:inputText id="p2" value="#{bean.p2}" required="false" />
      
      ........
      
      


      In this case the behavior is:

      * no page submit
      * p1_1 updated

      Then I changed the code to rerender the p2 field too:

      
      .......
       <tr:inputText id="p1" value="#{bean.p1}" required="false" >
       <a4j:support event="onchange" reRender="p1_1,p2" action="#{BeanManager.newP2Value}" />
       </tr:inputText>
       <tr:outputText id="p1_1" value="#{bean.p1}" />
       <tr:inputText id="p2" value="#{bean.p2}" required="false" />
      
      ........
      
      


      When I change the value of p1 the page is submitted and then I am redirected to the seam debug page with this error:

      java.lang.NullPointerException:
       at org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.EditableValueRenderer.addOnSubmitConverterValidators(EditableValueRenderer.java:203)
       at org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.SimpleInputTextRenderer.encodeAllAsElement(SimpleInputTextRenderer.java:104)
       at org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.FormElementRenderer.encodeAll(FormElementRenderer.java:69)
       at org.apache.myfaces.trinidad.render.CoreRenderer.delegateRenderer(CoreRenderer.java:316)
       at org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.InputLabelAndMessageRenderer.renderFieldCellContents(InputLabelAndMessageRenderer.java:142)
       at org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.LabelAndMessageRenderer._renderFieldCell(LabelAndMessageRenderer.java:370)
       at org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.LabelAndMessageRenderer.encodeAll(LabelAndMessageRenderer.java:266)
       at org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.InputLabelAndMessageRenderer.encodeAll(InputLabelAndMessageRenderer.java:120)
       at org.apache.myfaces.trinidad.render.CoreRenderer.encodeEnd(CoreRenderer.java:203)
       at org.apache.myfaces.trinidad.component.UIXComponentBase.encodeEnd(UIXComponentBase.java:703)
       at org.ajax4jsf.framework.renderer.RendererBase.renderChild(RendererBase.java:286)
       at org.ajax4jsf.framework.renderer.AjaxChildrenRenderer.encodeAjaxChild(AjaxChildrenRenderer.java:127)
       at org.ajax4jsf.framework.renderer.AjaxChildrenRenderer.encodeAjaxChild(AjaxChildrenRenderer.java:118)
       at org.ajax4jsf.framework.renderer.AjaxChildrenRenderer.encodeAjaxChild(AjaxChildrenRenderer.java:118)
       at org.ajax4jsf.framework.renderer.AjaxChildrenRenderer.encodeAjaxChild(AjaxChildrenRenderer.java:118)
       at org.ajax4jsf.framework.renderer.AjaxContainerRenderer.encodeAjax(AjaxContainerRenderer.java:125)
       at org.ajax4jsf.framework.ajax.AjaxViewRoot.encodeAjax(AjaxViewRoot.java:536)
       at org.ajax4jsf.framework.ajax.AjaxViewRoot$4.invokeRoot(AjaxViewRoot.java:367)
       at org.ajax4jsf.framework.ajax.JsfOneOneInvoker.invokeOnRegionOrRoot(JsfOneOneInvoker.java:54)
       at org.ajax4jsf.framework.ajax.AjaxContext.invokeOnRegionOrRoot(AjaxContext.java:176)
       at org.ajax4jsf.framework.ajax.AjaxViewRoot.encodeChildren(AjaxViewRoot.java:382)
       at com.sun.facelets.tag.jsf.ComponentSupport.encodeRecursive(ComponentSupport.java:244)
       at com.sun.facelets.FaceletViewHandler.renderView(FaceletViewHandler.java:573)
       at org.apache.myfaces.trinidadinternal.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:181)
       at org.ajax4jsf.framework.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:108)
       at org.ajax4jsf.framework.ajax.AjaxViewHandler.renderView(AjaxViewHandler.java:229)
       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.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:57)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
      09:32:43,221 ERROR [ExceptionFilter] uncaught exception
      javax.servlet.ServletException: No RenderingContext
       at javax.faces.webapp.FacesServlet.service(FacesServlet.java:152)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
       at org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:57)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
       at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl._invokeDoFilter(TrinidadFilterImpl.java:209)
       at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl._doFilterImpl(TrinidadFilterImpl.java:166)
       at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl.doFilter(TrinidadFilterImpl.java:139)
       at org.apache.myfaces.trinidad.webapp.TrinidadFilter.doFilter(TrinidadFilter.java:92)
       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:96)
       at org.ajax4jsf.framework.ajax.xmlfilter.BaseFilter.doFilter(BaseFilter.java:220)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
       at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
       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.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:175)
       at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)
       at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
       at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
       at org.jboss.web.tomcat.tc5.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:156)
       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.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
      09:32:43,295 ERROR [ExceptionFilter] exception root cause
      java.lang.IllegalStateException: No RenderingContext
       at org.apache.myfaces.trinidad.render.CoreRenderer.encodeBegin(CoreRenderer.java:178)
       at org.apache.myfaces.trinidad.component.UIXComponentBase.encodeBegin(UIXComponentBase.java:670)
       at org.ajax4jsf.framework.renderer.RendererBase.renderChild(RendererBase.java:280)
       at org.ajax4jsf.framework.renderer.AjaxChildrenRenderer.encodeAjaxChild(AjaxChildrenRenderer.java:127)
       at org.ajax4jsf.framework.renderer.AjaxChildrenRenderer.encodeAjaxChild(AjaxChildrenRenderer.java:118)
       at org.ajax4jsf.framework.renderer.AjaxChildrenRenderer.encodeAjaxChild(AjaxChildrenRenderer.java:118)
       at org.ajax4jsf.framework.renderer.AjaxChildrenRenderer.encodeAjaxChild(AjaxChildrenRenderer.java:118)
       at org.ajax4jsf.framework.renderer.AjaxContainerRenderer.encodeAjax(AjaxContainerRenderer.java:125)
       at org.ajax4jsf.framework.ajax.AjaxViewRoot.encodeAjax(AjaxViewRoot.java:536)
       at org.ajax4jsf.framework.ajax.AjaxContext.renderAjaxRegion(AjaxContext.java:289)
       at org.ajax4jsf.framework.ajax.AjaxContext$2.invoke(AjaxContext.java:207)
       at org.ajax4jsf.framework.ajax.JsfOneOneInvoker.invokeOnComponent(JsfOneOneInvoker.java:78)
       at org.ajax4jsf.framework.ajax.AjaxContext.invokeOnComponent(AjaxContext.java:165)
       at org.ajax4jsf.framework.ajax.AjaxContext.renderSubmittedAjaxRegion(AjaxContext.java:219)
       at org.ajax4jsf.framework.ajax.AjaxViewHandler.renderView(AjaxViewHandler.java:252)
       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.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:57)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
       at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl._invokeDoFilter(TrinidadFilterImpl.java:209)
       at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl._doFilterImpl(TrinidadFilterImpl.java:166)
       at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl.doFilter(TrinidadFilterImpl.java:139)
       at org.apache.myfaces.trinidad.webapp.TrinidadFilter.doFilter(TrinidadFilter.java:92)
       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:96)
       at org.ajax4jsf.framework.ajax.xmlfilter.BaseFilter.doFilter(BaseFilter.java:220)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
      09:32:43,345 ERROR [DebugPageHandler] redirecting to debug page
      java.lang.IllegalStateException: No RenderingContext
       at org.apache.myfaces.trinidad.render.CoreRenderer.encodeBegin(CoreRenderer.java:178)
       at org.apache.myfaces.trinidad.component.UIXComponentBase.encodeBegin(UIXComponentBase.java:670)
       at org.ajax4jsf.framework.renderer.RendererBase.renderChild(RendererBase.java:280)
       at org.ajax4jsf.framework.renderer.AjaxChildrenRenderer.encodeAjaxChild(AjaxChildrenRenderer.java:127)
       at org.ajax4jsf.framework.renderer.AjaxChildrenRenderer.encodeAjaxChild(AjaxChildrenRenderer.java:118)
       at org.ajax4jsf.framework.renderer.AjaxChildrenRenderer.encodeAjaxChild(AjaxChildrenRenderer.java:118)
       at org.ajax4jsf.framework.renderer.AjaxChildrenRenderer.encodeAjaxChild(AjaxChildrenRenderer.java:118)
       at org.ajax4jsf.framework.renderer.AjaxContainerRenderer.encodeAjax(AjaxContainerRenderer.java:125)
       at org.ajax4jsf.framework.ajax.AjaxViewRoot.encodeAjax(AjaxViewRoot.java:536)
       at org.ajax4jsf.framework.ajax.AjaxContext.renderAjaxRegion(AjaxContext.java:289)
       at org.ajax4jsf.framework.ajax.AjaxContext$2.invoke(AjaxContext.java:207)
       at org.ajax4jsf.framework.ajax.JsfOneOneInvoker.invokeOnComponent(JsfOneOneInvoker.java:78)
       at org.ajax4jsf.framework.ajax.AjaxContext.invokeOnComponent(AjaxContext.java:165)
       at org.ajax4jsf.framework.ajax.AjaxContext.renderSubmittedAjaxRegion(AjaxContext.java:219)
       at org.ajax4jsf.framework.ajax.AjaxViewHandler.renderView(AjaxViewHandler.java:252)
       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.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:57)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
       at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl._invokeDoFilter(TrinidadFilterImpl.java:209)
       at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl._doFilterImpl(TrinidadFilterImpl.java:166)
       at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl.doFilter(TrinidadFilterImpl.java:139)
       at org.apache.myfaces.trinidad.webapp.TrinidadFilter.doFilter(TrinidadFilter.java:92)
       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:96)
       at org.ajax4jsf.framework.ajax.xmlfilter.BaseFilter.doFilter(BaseFilter.java:220)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
      
      


      Probably I have something misconfigured.

      Can anyone help me ?

      Regards

      Fabrizio