ICEfaces
  1. ICEfaces
  2. ICE-4264

DOMException with MyFaces 1.1.5, Jboss 4.2 and ICEfaces

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.7.2 SP1b, 1.8RC2
    • Fix Version/s: 1.8.1
    • Component/s: Framework
    • Labels:
      None
    • Environment:
      MyFaces 1.1.5, Jboss 4.2.x

      Description

      When attempting to bring up the main page of the attached test app, an exception is thrown in the server logs:

      09:08:25,254 ERROR [[Persistent Faces Servlet]] Servlet.service() for servlet Persistent Faces Servlet threw exception
      java.lang.RuntimeException: Failed to append element[tag: html; attributes: ] into #document
      at com.icesoft.faces.context.DOMResponseWriter.appendToCursor(DOMResponseWriter.java:528)
      at com.icesoft.faces.context.DOMResponseWriter.startElement(DOMResponseWriter.java:169)
      ..............
      Caused by: org.w3c.dom.DOMException: HIERARCHY_REQUEST_ERR: An attempt was made to insert a node where it is not permitted.
      at com.sun.org.apache.xerces.internal.dom.CoreDocumentImpl.insertBefore(CoreDocumentImpl.java:419)

      The attached test case is a very basic web app. It has the required ICEfaces jar and myFaces jars along with this context param which tells jboss that the war bundles the JSF implementation:

      <context-param>
              <param-name>org.jboss.jbossfaces.WAR_BUNDLES_JSF_IMPL</param-name>
              <param-value>true</param-value>
      </context-param>



        Activity

        Hide
        Tyler Johnson added a comment -

        The DOMException is with 1.7.2 SP1. Here is the beginning of the exception when using 1.8 RC2:

        23:38:44,356 INFO [MainServlet] Adapting to Push environment.
        23:38:46,184 ERROR [[Persistent Faces Servlet]] Servlet.service() for servlet Pe
        rsistent Faces Servlet threw exception
        java.lang.NullPointerException
        at com.icesoft.faces.context.DOMResponseWriter.startElement(DOMResponseW
        riter.java:199)
        at com.icesoft.faces.renderkit.dom_html_basic.XMLRenderer.encodeBegin(XM
        LRenderer.java:51)
        at javax.faces.component.UIComponentBase.encodeBegin(UIComponentBase.jav
        a:515)
        at com.icesoft.faces.application.D2DViewHandler.renderResponse(D2DViewHa
        ndler.java:514)

        Show
        Tyler Johnson added a comment - The DOMException is with 1.7.2 SP1. Here is the beginning of the exception when using 1.8 RC2: 23:38:44,356 INFO [MainServlet] Adapting to Push environment. 23:38:46,184 ERROR [ [Persistent Faces Servlet] ] Servlet.service() for servlet Pe rsistent Faces Servlet threw exception java.lang.NullPointerException at com.icesoft.faces.context.DOMResponseWriter.startElement(DOMResponseW riter.java:199) at com.icesoft.faces.renderkit.dom_html_basic.XMLRenderer.encodeBegin(XM LRenderer.java:51) at javax.faces.component.UIComponentBase.encodeBegin(UIComponentBase.jav a:515) at com.icesoft.faces.application.D2DViewHandler.renderResponse(D2DViewHa ndler.java:514)
        Hide
        Tyler Johnson added a comment - - edited

        Sample app demonstrating issue. Uses 1.8 RC2 jars.

        http://localhost:8080/TestIcefacesMyfaces/test.jsp

        The page renders correctly but the exception is thrown in the server logs. I've attempted to add xercesImpl and xml-api but no luck.

        Ty

        Show
        Tyler Johnson added a comment - - edited Sample app demonstrating issue. Uses 1.8 RC2 jars. http://localhost:8080/TestIcefacesMyfaces/test.jsp The page renders correctly but the exception is thrown in the server logs. I've attempted to add xercesImpl and xml-api but no luck. Ty
        Hide
        Ted Goddard added a comment -

        This is caused by the simultaneous presence of both JSF 1.2 and MyFaces 1.1.

        MyFaces has been specified for initialization through the WAR_BUNDLES_JSF_IMPL parameter, but JSF 1.2 is still on the classpath. ICEfaces automatically detects JSF 1.2 and performs certain operations under that assumption. In this case, JSF 1.1 and 1.2 conflict over the role of the View tag: with JSF 1.1, the View tag is responsible for rendering, but with JSF 1.2, the ViewHandler takes this role. When both JSF 1.2 and JSF 1.1 are present, ICEfaces attempts to render the view twice resulting in the exception (the DOMResponseWriter document has been cleared by the termination of the initial render pass, so is null for the redundant pass driven by JSF 1.2 detection).

        Show
        Ted Goddard added a comment - This is caused by the simultaneous presence of both JSF 1.2 and MyFaces 1.1. MyFaces has been specified for initialization through the WAR_BUNDLES_JSF_IMPL parameter, but JSF 1.2 is still on the classpath. ICEfaces automatically detects JSF 1.2 and performs certain operations under that assumption. In this case, JSF 1.1 and 1.2 conflict over the role of the View tag: with JSF 1.1, the View tag is responsible for rendering, but with JSF 1.2, the ViewHandler takes this role. When both JSF 1.2 and JSF 1.1 are present, ICEfaces attempts to render the view twice resulting in the exception (the DOMResponseWriter document has been cleared by the termination of the initial render pass, so is null for the redundant pass driven by JSF 1.2 detection).
        Hide
        Ted Goddard added a comment -

        Candidate fix is to disable JSF12 detection when MyFaces is detected.

        Index: src/com/icesoft/faces/webapp/parser/ImplementationUtil.java
        ===================================================================
        — src/com/icesoft/faces/webapp/parser/ImplementationUtil.java (revision 18814)
        +++ src/com/icesoft/faces/webapp/parser/ImplementationUtil.java (working copy)
        @@ -111,16 +111,6 @@
        } catch (ClassNotFoundException e) {
        }

        • try { - Class.forName(MYFACES_MARKER); - isMyFaces = true; - }

          catch (ClassNotFoundException e)

          { - }

          -

        • if (log.isTraceEnabled()) { - log.trace("JSF-RI: " + isRI + " MyFaces: " + isMyFaces); - }

          -
          //Test for JSF 1.2
          try

          { Class.forName(JSF12_MARKER); @@ -144,6 +134,18 @@ }

        try

        { + Class.forName(MYFACES_MARKER); + isMyFaces = true; + //Disable JSF12 detection in MyFaces environment + isJSF12 = false; + }

        catch (ClassNotFoundException e)

        { + }

        +
        + if (log.isTraceEnabled())

        { + log.trace("JSF-RI: " + isRI + " MyFaces: " + isMyFaces); + }

        +
        + try {
        javax.faces.component.html.HtmlOutputText comp =
        new javax.faces.component.html.HtmlOutputText();
        isStockAttributeTracking = isAttributeTracking(comp);

        Show
        Ted Goddard added a comment - Candidate fix is to disable JSF12 detection when MyFaces is detected. Index: src/com/icesoft/faces/webapp/parser/ImplementationUtil.java =================================================================== — src/com/icesoft/faces/webapp/parser/ImplementationUtil.java (revision 18814) +++ src/com/icesoft/faces/webapp/parser/ImplementationUtil.java (working copy) @@ -111,16 +111,6 @@ } catch (ClassNotFoundException e) { } try { - Class.forName(MYFACES_MARKER); - isMyFaces = true; - } catch (ClassNotFoundException e) { - } - if (log.isTraceEnabled()) { - log.trace("JSF-RI: " + isRI + " MyFaces: " + isMyFaces); - } - //Test for JSF 1.2 try { Class.forName(JSF12_MARKER); @@ -144,6 +134,18 @@ } try { + Class.forName(MYFACES_MARKER); + isMyFaces = true; + //Disable JSF12 detection in MyFaces environment + isJSF12 = false; + } catch (ClassNotFoundException e) { + } + + if (log.isTraceEnabled()) { + log.trace("JSF-RI: " + isRI + " MyFaces: " + isMyFaces); + } + + try { javax.faces.component.html.HtmlOutputText comp = new javax.faces.component.html.HtmlOutputText(); isStockAttributeTracking = isAttributeTracking(comp);

          People

          • Assignee:
            Ted Goddard
            Reporter:
            Tyler Johnson
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: