voyent
Problem with com.icesoft.faces.async.render.RenderManager  XML
Forum Index -> General Help
Author Message
legalama

Joined: 07/Sep/2006 00:00:00
Messages: 16
Offline


Hi,

We have a problem in ICEfaces 1.6 with server side rendering and page navigation:

In fact, we have a first page "P01.jspx" from wich we have displayed the current time (with class com.icesoft.faces.async.render.IntervalRenderer). This displaying is upgraded across a backend bean that implements "com.icesoft.faces.async.render.Renderable" interface on each second and on this page we have a button that simulate a treatment that takes 10 seconds (simulated across a bachend bean method with a "for" loop) that bring to another page called "P02.jspx".

If we push on this button while the treatment occur then the ICEfaces framework send an error (see at the bottom of message) and the page "P02.jspx" is rendered with mismatch presentation (for example this page has one button and with this error the page has two, three, ... same buttons ?!?). Sometimes we have this exception in the browser.

In fact we think that while the RenderManager works the DOM response can't render correctly the second page.

Perhaps it's our configurations files that are not correct but we don't see from wich the problem occur. Or perhaps it's our comprehension of Renderable and IntervalRenderer that's wrong ?


Environment of the test :

  • JBOSS 4.2.0 GA with no change on its configurations
  • ICEfaces JSF1.2 Run-Time Support
  • ICEfaces Run-Time 1.6

    This is the printStackTrace in our WEB application server JBOSS :

    15:58:38,300 WARN [lifecycle] executePhase(RENDER_RESPONSE 6,com.icesoft.faces.context.BridgeFacesContext@159c41f) threw exception
    java.lang.NullPointerException
    at com.icesoft.faces.context.DOMResponseWriter.enhanceAndFixDocument(DOMResponseWriter.java:298)
    at com.icesoft.faces.context.DOMResponseWriter.endDocument(DOMResponseWriter.java:175)
    at com.icesoft.faces.application.D2DViewHandler.renderResponse(D2DViewHandler.java:580)
    at com.icesoft.faces.application.D2DViewHandler.renderView(D2DViewHandler.java:154)
    at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:106)
    at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:251)
    at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:144)
    at com.icesoft.faces.webapp.xmlhttp.PersistentFacesState.render(PersistentFacesState.java:146)
    at com.icesoft.faces.async.render.RunnableRender.run(RunnableRender.java:142)
    at edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:643)
    at edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:668)
    at java.lang.Thread.run(Thread.java:595)
    15:58:38,362 WARN [lifecycle] executePhase(RENDER_RESPONSE 6,com.icesoft.faces.context.BridgeFacesContext@159c41f) threw exception
    java.lang.NullPointerException
    at com.icesoft.faces.context.DOMResponseWriter.enhanceAndFixDocument(DOMResponseWriter.java:298)
    at com.icesoft.faces.context.DOMResponseWriter.endDocument(DOMResponseWriter.java:175)
    at com.icesoft.faces.application.D2DViewHandler.renderResponse(D2DViewHandler.java:580)
    at com.icesoft.faces.application.D2DViewHandler.renderView(D2DViewHandler.java:154)
    at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:106)
    at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:251)
    at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:144)
    at com.icesoft.faces.webapp.xmlhttp.PersistentFacesState.render(PersistentFacesState.java:146)
    at com.icesoft.faces.async.render.RunnableRender.run(RunnableRender.java:142)
    at edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:643)
    at edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:668)
    at java.lang.Thread.run(Thread.java:595)
    15:58:38,581 WARN [lifecycle] executePhase(RENDER_RESPONSE 6,com.icesoft.faces.context.BridgeFacesContext@159c41f) threw exception
    org.w3c.dom.DOMException: HIERARCHY_REQUEST_ERR: An attempt was made to insert a node where it is not permitted.
    at org.apache.xerces.dom.CoreDocumentImpl.insertBefore(Unknown Source)
    at org.apache.xerces.dom.NodeImpl.appendChild(Unknown Source)
    at com.icesoft.faces.context.DOMResponseWriter.startElement(DOMResponseWriter.java:187)
    at com.icesoft.faces.renderkit.dom_html_basic.XMLRenderer.encodeBegin(XMLRenderer.java:51)
    at javax.faces.component.UIComponentBase.encodeBegin(UIComponentBase.java:785)
    at com.icesoft.faces.application.D2DViewHandler.renderResponse(D2DViewHandler.java:596)
    at com.icesoft.faces.application.D2DViewHandler.renderResponse(D2DViewHandler.java:603)
    at com.icesoft.faces.application.D2DViewHandler.renderResponse(D2DViewHandler.java:573)
    at com.icesoft.faces.application.D2DViewHandler.renderView(D2DViewHandler.java:154)
    at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:106)
    at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:251)
    at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:144)
    at com.icesoft.faces.webapp.http.core.PageServer$1.respond(PageServer.java:26)
    at com.icesoft.faces.webapp.http.servlet.ServletRequestResponse.respondWith(ServletRequestResponse.java:125)
    at com.icesoft.faces.webapp.http.core.PageServer.service(PageServer.java:31)
    at com.icesoft.faces.webapp.http.servlet.BasicAdaptingServlet.service(BasicAdaptingServlet.java:16)
    at com.icesoft.faces.webapp.http.servlet.SingleViewServlet.service(SingleViewServlet.java:45)
    at com.icesoft.faces.webapp.http.servlet.PathDispatcher$Matcher.serviceOnMatch(PathDispatcher.java:52)
    at com.icesoft.faces.webapp.http.servlet.PathDispatcher.service(PathDispatcher.java:29)
    at com.icesoft.faces.webapp.http.servlet.MainSessionBoundServlet.service(MainSessionBoundServlet.java:97)
    at com.icesoft.faces.webapp.http.servlet.SessionDispatcher.service(SessionDispatcher.java:35)
    at com.icesoft.faces.webapp.http.servlet.PathDispatcher$Matcher.serviceOnMatch(PathDispatcher.java:52)
    at com.icesoft.faces.webapp.http.servlet.PathDispatcher.service(PathDispatcher.java:29)
    at com.icesoft.faces.webapp.http.servlet.MainServlet.service(MainServlet.java:85)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
    at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:179)
    at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
    at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:156)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:241)
    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
    at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:580)
    at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
    at java.lang.Thread.run(Thread.java:595)
    15:58:38,753 ERROR [[Persistent Faces Servlet]] "Servlet.service()" pour la servlet Persistent Faces Servlet a gÚnÚrÚ une exception
    javax.faces.FacesException: org.w3c.dom.DOMException: HIERARCHY_REQUEST_ERR: An attempt was made to insert a node where it is not permitted.
    at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:306)
    at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:144)
    at com.icesoft.faces.webapp.http.core.PageServer$1.respond(PageServer.java:26)
    at com.icesoft.faces.webapp.http.servlet.ServletRequestResponse.respondWith(ServletRequestResponse.java:125)
    at com.icesoft.faces.webapp.http.core.PageServer.service(PageServer.java:31)
    at com.icesoft.faces.webapp.http.servlet.BasicAdaptingServlet.service(BasicAdaptingServlet.java:16)
    at com.icesoft.faces.webapp.http.servlet.SingleViewServlet.service(SingleViewServlet.java:45)
    at com.icesoft.faces.webapp.http.servlet.PathDispatcher$Matcher.serviceOnMatch(PathDispatcher.java:52)
    at com.icesoft.faces.webapp.http.servlet.PathDispatcher.service(PathDispatcher.java:29)
    at com.icesoft.faces.webapp.http.servlet.MainSessionBoundServlet.service(MainSessionBoundServlet.java:97)
    at com.icesoft.faces.webapp.http.servlet.SessionDispatcher.service(SessionDispatcher.java:35)
    at com.icesoft.faces.webapp.http.servlet.PathDispatcher$Matcher.serviceOnMatch(PathDispatcher.java:52)
    at com.icesoft.faces.webapp.http.servlet.PathDispatcher.service(PathDispatcher.java:29)
    at com.icesoft.faces.webapp.http.servlet.MainServlet.service(MainServlet.java:85)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
    at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:179)
    at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
    at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:156)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:241)
    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
    at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:580)
    at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
    at java.lang.Thread.run(Thread.java:595)
    Caused by: org.w3c.dom.DOMException: HIERARCHY_REQUEST_ERR: An attempt was made to insert a node where it is not permitted.
    at org.apache.xerces.dom.CoreDocumentImpl.insertBefore(Unknown Source)
    at org.apache.xerces.dom.NodeImpl.appendChild(Unknown Source)
    at com.icesoft.faces.context.DOMResponseWriter.startElement(DOMResponseWriter.java:187)
    at com.icesoft.faces.renderkit.dom_html_basic.XMLRenderer.encodeBegin(XMLRenderer.java:51)
    at javax.faces.component.UIComponentBase.encodeBegin(UIComponentBase.java:785)
    at com.icesoft.faces.application.D2DViewHandler.renderResponse(D2DViewHandler.java:596)
    at com.icesoft.faces.application.D2DViewHandler.renderResponse(D2DViewHandler.java:603)
    at com.icesoft.faces.application.D2DViewHandler.renderResponse(D2DViewHandler.java:573)
    at com.icesoft.faces.application.D2DViewHandler.renderView(D2DViewHandler.java:154)
    at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:106)
    at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:251)
    ... 32 more
     Filename W1.rar [Disk] Download
     Description Simple WAR Application to explain our problem. This sample use NetBeans 5.5.1.
     Filesize 3263 Kbytes
     Downloaded:  79 time(s)

  • deryk.sinotte


    Joined: 26/Oct/2004 00:00:00
    Messages: 1008
    Offline


    I want to take a look at your source code and try running your project on JBoss but I'm having trouble extracting it. Could you try re-attaching? Maybe just as a simple .zip file.

    Deryk Sinotte
    Team Lead
    ICEsoft Technologies, Inc.
    legalama

    Joined: 07/Sep/2006 00:00:00
    Messages: 16
    Offline


    Hi deryk,


    This is the new archive asked with ZIP extension, I hope that you could open this.

    I'm waiting for you...


    Thank's a lot,

    L.
     Filename W1.zip [Disk] Download
     Description New archive in ZIP format.
     Filesize 16 Kbytes
     Downloaded:  179 time(s)

    deryk.sinotte


    Joined: 26/Oct/2004 00:00:00
    Messages: 1008
    Offline


    You'll probably want to do a couple of things differently:

    1) If you're going to start a thread to simulate a long-running server behaviour, you probably don't want to lock up the request thread in the action method. Create and start a new thread. This isn't considered good practice in web containers for production use but for the purposes of simulation and education, it's acceptable. If you block the request thread, you're effectively blocking the UI thread which makes the whole thing unresponsive.

    2) In order to automatically navigate after this long-running task, you'll likely want to use the state reference you already have and the navigateTo() method.

    I've attached a reworked copy of your IntervalBean. I was able to get this to work the way you want (I think).
     Filename IntervalBean.java [Disk] Download
     Description Revised version of IntervalBean
     Filesize 3 Kbytes
     Downloaded:  241 time(s)


    Deryk Sinotte
    Team Lead
    ICEsoft Technologies, Inc.
    legalama

    Joined: 07/Sep/2006 00:00:00
    Messages: 16
    Offline


    Hi Derick,

    First of all, thank's for your sample application based on mine...

    I agree with you concerning treatments that take a lot of time but my problem is not there, in fact my problem result when I want navigate to a page from another page that contains IntervalRender functionnality.

    I send you another ZIP file containing this demonstration :

  • 1) I have a page P01 (classic page with classic backend bean that simulate treatment before navigation) that contain a button to navigate to P02 (intermediate page). Up to there, there is no problem, the action that initiate navigation is a method called "goNext" in backend bean "ServerTaskBean" and after this, the page P02 is displayed.

  • 2) From P02 I have a button that initiate a navigation to the page P03 (this page is the same that P01 with an outputText that display current time with IntervalRenderer).

  • 3) At least, we push in this page on a button to navigate to P01 that call the same method than in the P01 ("goNext"). At this point the page P01 does not appear or it's displaying is broken and/or we have an exception in console ???


    => We found a workaround that consist to call "requestStop" on the IntervalRenderer before execution of the "long task" and "requestRender" after so we don't have any error message and P01 is displayed correctly.


    This solution is better than create a thread for each method called from many backend beans, but it's not an elegant solution, is there a better solution to resolve this problem ? Is there a bad use from us or there is a bug with IceFaces or it's an oblivion in the documentation ("you must use requestStop on IntervaleRenderer before navigation rule...") ?



    Thank's in advance,

    L.
     Filename IntervalRenderer.zip [Disk] Download
     Description
     Filesize 18 Kbytes
     Downloaded:  170 time(s)

  • deryk.sinotte


    Joined: 26/Oct/2004 00:00:00
    Messages: 1008
    Offline


    I don't necessarily think it's "bad use" on your part to stop the group renderer when you switch pages. If the group renderer is trying to render a view that is no longer valid, it will throw an exception. You may want to try simply adding and removing the Renderables from the group renderer as you navigate rather than stopping and starting but if it works...

    Since I don't know the whole scope of your application and it's requirements it's difficult to critique but things I would recommend:

    1) Don't block the thread in the middle of a request. I know that you're attempting to simulate something but it makes the UI completely unresponsive which may not be simulating the real use case.

    2) The re-worked example also shows the use of state.navigateTo() rather than waiting for the action to return the outcome String. This is likely a better way to do what you are attempting (but again, I'm not sure what the real requirement is).

    3) ICEfaces applications generally work better when designed with less pages. Not to say that navigation isn't necessary, just that there may be "richer" ways to tell the user that a long-running task has completed. We have progress bar and dialog components that could be rendered on the same page and provide the same information without forcing a page change. Although, again, I'm not sure of the actual use case.

    Bottom line, I'm glad you found a work-around and hopefully this forum thread can help others that may run into the same thing. I'll make a note to enhance the documentation regarding AJAX push and navigation.

    Deryk Sinotte
    Team Lead
    ICEsoft Technologies, Inc.
    legalama

    Joined: 07/Sep/2006 00:00:00
    Messages: 16
    Offline


    Thank's again...

    Just a precision concerning my problem, this one does not appear in ICEfaces 1.5.3 and so I think that's really a mistake with this current release.

    I've seen in issue traker section on this web site and I think that my problem is the same that issue ICE2006 !

    I'll wait the next release to do the same test...


    By

    L.
     
    Forum Index -> General Help
    Go to:   
    Powered by JForum 2.1.7ice © JForum Team