2 Replies Latest reply on Nov 30, 2007 6:11 PM by John Gilbert

    org.w3c.dom.DOMException: NAMESPACE_ERR

    John Gilbert Apprentice

      I get the exception below on any page that has a Richfaces Tree on it.

      Does anyone have any ideas on what is happening here?

      I assume this html line is the culprit, but I have no idea what to do about it.

      xmlns:rich="http://richfaces.ajax4jsf.org/rich"


      java.lang.RuntimeException: javax.xml.transform.TransformerException: org.w3c.dom.DOMException: NAMESPACE_ERR: An attempt is made to create or change an object in a way which is incorrect with regard to namespaces.
       at org.jboss.jsfunit.facade.JSFClientSession.doWebRequest(JSFClientSession.java:194)
       at org.jboss.jsfunit.facade.JSFClientSession.clickCommandLink(JSFClientSession.java:445)
       at com.comcast.catalog.entity.offer.CatalogPublicationNavTestCase.testView(CatalogPublicationNavTestCase.java:165)
       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
       at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
       at java.lang.reflect.Method.invoke(Method.java:585)
       at junit.framework.TestCase.runTest(TestCase.java:154)
       at junit.framework.TestCase.runBare(TestCase.java:127)
       at org.apache.cactus.internal.AbstractCactusTestCase.runBareServer(AbstractCactusTestCase.java:153)
       at org.apache.cactus.internal.server.AbstractWebTestCaller.doTest(AbstractWebTestCaller.java:119)
       at org.apache.cactus.internal.server.AbstractWebTestController.handleRequest_aroundBody0(AbstractWebTestController.java:93)
       at org.apache.cactus.internal.server.AbstractWebTestController.handleRequest_aroundBody1$advice(AbstractWebTestController.java:224)
       at org.apache.cactus.internal.server.AbstractWebTestController.handleRequest(AbstractWebTestController.java)
       at org.apache.cactus.server.ServletTestRedirector.doPost_aroundBody2(ServletTestRedirector.java:101)
       at org.apache.cactus.server.ServletTestRedirector.doPost_aroundBody3$advice(ServletTestRedirector.java:224)
       at org.apache.cactus.server.ServletTestRedirector.doPost(ServletTestRedirector.java)
       at org.apache.cactus.server.ServletTestRedirector.doGet_aroundBody0(ServletTestRedirector.java:72)
       at org.apache.cactus.server.ServletTestRedirector.doGet_aroundBody1$advice(ServletTestRedirector.java:224)
       at org.apache.cactus.server.ServletTestRedirector.doGet(ServletTestRedirector.java)
       at javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
       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.jsfunit.framework.JSFUnitFilter.doFilter(JSFUnitFilter.java:123)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
       at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:63)
       at org.jboss.seam.debug.hot.HotDeployFilter.doFilter(HotDeployFilter.java:60)
       at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:49)
       at org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:45)
       at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:49)
       at org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:57)
       at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:49)
       at org.jboss.seam.web.MultipartServletFilter.doFilter(MultipartServletFilter.java:79)
       at org.jboss.seam.web.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:49)
       at org.jboss.seam.web.SeamFilter.doFilter(SeamFilter.java:84)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
       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.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:433)
       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.authenticator.SingleSignOn.invoke(SingleSignOn.java:393)
       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: javax.xml.transform.TransformerException: org.w3c.dom.DOMException: NAMESPACE_ERR: An attempt is made to create or change an object in a way which is incorrect with regard to namespaces.
       at org.apache.xalan.transformer.TransformerIdentityImpl.transform(TransformerIdentityImpl.java:400)
       at org.jboss.jsfunit.facade.DOMUtil.convertToDomLevel2(DOMUtil.java:143)
       at org.jboss.jsfunit.facade.JSFClientSession.doWebRequest(JSFClientSession.java:190)
       ... 56 more
      Caused by: org.w3c.dom.DOMException: NAMESPACE_ERR: An attempt is made to create or change an object in a way which is incorrect with regard to namespaces.
       at org.apache.xml.utils.DOMBuilder.startElement(DOMBuilder.java:374)
       at org.apache.xalan.transformer.TransformerIdentityImpl.startElement(TransformerIdentityImpl.java:1072)
       at org.apache.xml.serializer.TreeWalker.startNode(TreeWalker.java:357)
       at org.apache.xml.serializer.TreeWalker.traverse(TreeWalker.java:143)
       at org.apache.xalan.transformer.TransformerIdentityImpl.transform(TransformerIdentityImpl.java:389)
       ... 58 more
      
      


      Here is a very simple xhtml file:

      <ui:composition xmlns="http://www.w3.org/1999/xhtml"
       xmlns:ui="http://java.sun.com/jsf/facelets"
       xmlns:h="http://java.sun.com/jsf/html"
       xmlns:f="http://java.sun.com/jsf/core"
       xmlns:rich="http://richfaces.ajax4jsf.org/rich"
       xmlns:a4j="https://ajax4jsf.dev.java.net/ajax">
       <f:view>
       <a4j:form id="treeForm">
       <rich:tree id="tree" value="#{tree}" var="item"
       nodeFace="#{item.type}" immediate="true"
       eventsQueue="treeQueue"
       ajaxSubmitSelection="true" reRender="detail">
       </rich:tree>
       </a4j:form>
       </f:view>
      </ui:composition>
      


      Here is the html that is produced:
      <html>
       <head>
       <link rel='stylesheet' type='text/css'
       href='/catalog/a4j.res/org/richfaces/renderkit/html/css/dragIndicator.xcss/DATA/eAHbGcx7DQAE0QHw.seam'/>
       <link rel='stylesheet' type='text/css'
       href='/catalog/a4j.res/css/tree.xcss/DATA/eAHbGcx7DQAE0QHw.seam'/>
       <script type='text/javascript'
       src='/catalog/a4j.res/org.ajax4jsf.framework.ajax.AjaxScript.seam'>
       </script>
       <script type='text/javascript'
       src='/catalog/a4j.res/org/ajax4jsf/renderkit/html/scripts/form.js.seam'>
       </script>
       <script type='text/javascript'
       src='/catalog/a4j.res/org.ajax4jsf.framework.resource.PrototypeScript.seam'>
       </script>
       <script type='text/javascript'
       src='/catalog/a4j.res/org/richfaces/renderkit/html/scripts/json/json.js.seam'>
       </script>
       <script type='text/javascript'
       src='/catalog/a4j.res/org.ajax4jsf.dnd.DnDScript.seam'></script>
       <script type='text/javascript'
       src='/catalog/a4j.res/org/richfaces/renderkit/html/scripts/utils.js.seam'>
       </script>
       <script type='text/javascript'
       src='/catalog/a4j.res/org/richfaces/renderkit/html/scripts/dnd/dnd-common.js.seam'>
       </script>
       <script type='text/javascript'
       src='/catalog/a4j.res/org/richfaces/renderkit/html/scripts/dnd/dnd-draggable.js.seam'>
       </script>
       <script type='text/javascript'
       src='/catalog/a4j.res/org/richfaces/renderkit/html/scripts/dnd/dnd-dropzone.js.seam'>
       </script>
       <script type='text/javascript'
       src='/catalog/a4j.res/org/ajax4jsf/framework/ajax/scripts/AJAX.js.seam'>
       </script>
       <script type='text/javascript'
       src='/catalog/a4j.res/org/richfaces/renderkit/html/scripts/events.js.seam'>
       </script>
       <script type='text/javascript'
       src='/catalog/a4j.res/org/richfaces/renderkit/html/scripts/tree.js.seam'>
       </script>
       <script type='text/javascript'
       src='/catalog/a4j.res/org/richfaces/renderkit/html/scripts/tree-selection.js.seam'>
       </script>
       <script type='text/javascript'
       src='/catalog/a4j.res/org/richfaces/renderkit/html/scripts/tree-item.js.seam'>
       </script>
       <script type='text/javascript'
       src='/catalog/a4j.res/org/richfaces/renderkit/html/scripts/tree-item-dnd.js.seam'>
       </script>
       <script type='text/javascript'
       src='/catalog/a4j.res/org/richfaces/renderkit/html/scripts/drag-indicator.js.seam'>
       </script>
       </head>
       <form id="treeForm" name="treeForm" method="post"
       action="/catalog/jsf/CatalogPublication/View.seam">
       <div class="dr-tree rich-tree " id="treeForm:tree"
       xmlns:rich="http://richfaces.ajax4jsf.org/rich">
       <table cellpadding="0" width="100%">
       <tbody>
       <tr id="treeForm:tree:childs">
       <td colspan="2" id="treeForm:tree:childs:td" valign="top">
       <table border="0" cellpadding="0" cellspacing="0"
       id="treeForm:tree:-1:_defaultNodeFace"
       style="width: 100%;"
       rich:nodeId="_defaultNodeFace">
       <tbody>
       <tr
       id="treeForm:tree:-1:_defaultNodeFace:mainRow"
       onclick=" return false;">
       <td
       class="dr-tree-h-ic dr-tree-h-ic-line-last">
       <div><a href="#"
       id="treeForm:tree:-1:_defaultNodeFace:handle"
       onclick="A4J.AJAX.Submit('_viewRoot','treeForm',event,{'eventsQueue':'treeQueue','parameters':{'treeForm:tree:expanded':'false','treeForm:tree:lastElement':true,'treeForm:tree:-1:_defaultNodeFace:_toggleLink':'treeForm:tree:-1:_defaultNodeFace:_toggleLink'} ,'actionUrl':'/catalog/jsf/CatalogPublication/View.seam'} ); return false;">
       <img border="0"
       class="dr-tree-pointer-cursor dr-tree-h-ic-img"
       id="treeForm:tree:-1:_defaultNodeFace:handle:img:collapsed"
       src="/catalog/a4j.res/org.richfaces.renderkit.html.images.TreePlusImage/DATA/eAFb85aBtbiIwT6.KF2vKDM5Iy0xObVYryg1LyW1KDuzRC-jJDdHLzM3MR0oGlKUmuoJYjolFqeqwHkuiSWJEtwn39-.9o2ZiYHZh4EnOT-vpCg.xzk.J7-ohEHYJyuxLFE.JzEvXd8zryQ1PbXIGqgoPTUvtSgRoqiQoY6B0YeBs6QoMxesCyxQUQB0mSBIsx5Isx5Us9CjBUu-N7ZbMDEwejKwliXmlKZWFDEIINT5leYmpRa1rZkqyz3lQTcTA0NFwX8gKAYZyvzf2NgYyrr27DcAHr9eLA__.seam"/>
       <img border="0"
       class="dr-tree-pointer-cursor dr-tree-h-ic-img"
       id="treeForm:tree:-1:_defaultNodeFace:handle:img:expanded"
       src="/catalog/a4j.res/org.richfaces.renderkit.html.images.TreeMinusImage/DATA/eAFb85aBtbiIwT6.KF2vKDM5Iy0xObVYryg1LyW1KDuzRC-jJDdHLzM3MR0oGlKUmuoJYjolFqeqwHkuiSWJEtwn39-.9o2ZiYHZh4EnOT-vpCg.xzk.J7-ohEHYJyuxLFE.JzEvXd8zryQ1PbXIGqgoPTUvtSgRoqiQoY6B0YeBs6QoMxesCyxQUQB0mSBIsx5Isx5Us9CjBUu-N7ZbMDEwejKwliXmlKZWFDEIINT5leYmpRa1rZkqyz3lQTcTA0NFwX8gKAYZyvzf2NgYyrr27DcAHr9eLA__.seam"
       style="display: none;"/></a>
       </div>
       </td>
       <td
       class="dr-tree-h-ic dr-tree-h-ic-line-clp"
       id="treeForm:tree:-1:_defaultNodeFace:icon"
       rich:ajaxselectedlistener="ajax_selected_listener_flag"
       rich:draggableoptions="{'parameters':{'dragSourceId':'treeForm:tree:-1:_defaultNodeFace','treeForm:tree:-1:_defaultNodeFace':'treeForm:tree:-1:_defaultNodeFace','treeForm:tree:lastElement':true} } "
       rich:dropzoneoptions="{'parameters':{'treeForm:tree:lastElement':true} } ">
       <img class="dr-tree-h-ic-img"
       src="/catalog/a4j.res/images/iconFolder.gif.seam"/>
       </td>
       <td
       class="dr-tree-h-text rich-tree-node "
       id="treeForm:tree:-1:_defaultNodeFace:text"
       nowrap="nowrap"
       rich:highlightedclass="dr-tree-i-hl rich-tree-node-highlighted"
       rich:selectedclass="dr-tree-i-sel rich-tree-node-selected">
       <span
       id="treeForm:tree:-1:_defaultNodeFaceOutput">
       com.comcast.catalog.entity.offer.editor.CatalogPublicationTreeNode@1dcfa20</span>
       </td>
       </tr>
       </tbody>
       </table>
       </td>
       </tr>
       </tbody>
       </table>
       <input type="hidden" id="treeForm:tree:input"
       name="treeForm:tree:input" value=""/>
       <script type="text/javascript">
       <!--\nvar Richfaces_Tree_treeForm_tree =\n\t\tnew Tree("treeForm:tree", "treeForm:tree:input", "ajax",\n\t\t{\n\t\t\tonselect: "", \n\t\t\tonexpand: "", \n\t\t\toncollapse: "" \n\t\t},\n\t\tfunction(event) {\n\t\t\tA4J.AJAX.Submit('_viewRoot','treeForm',event,{'eventsQueue':'treeQueue','parameters':{'treeForm:tree:selectedNode':event.selectedNode} ,'actionUrl':'/catalog/jsf/CatalogPublication/View.seam'} ); return false;\n\t\t},\n\t\t"",\n\t\tfalse\n\t\t);\n\t\tRichfaces_Tree_treeForm_tree.drop = function(event,drag){var options = {'eventsQueue':'treeQueue','parameters':{'treeForm:tree':'treeForm:tree'} ,'actionUrl':'/catalog/jsf/CatalogPublication/View.seam'} ;options.parameters['dropTargetId'] = 'treeForm:tree';Object.extend(options.parameters,drag.getParameters());if (this.options.ondrop) { if (!this.options.ondrop.call(this, event)) return; };A4J.AJAX.Submit('_viewRoot','treeForm',event,options);};\n//--></script>
       <div id="treeForm:tree:script">
       <script type="text/javascript"><!--\n\n//--></script>
       </div>
       </div>
       <input type="hidden" name="treeForm" value="treeForm"/>
       <input type="hidden" name="autoScroll" value=""/>
       <input type="hidden" name="treeForm:_idcl" value=""/>
       <input type="hidden" name="treeForm:_link_hidden_" value=""/>
       <script type="text/javascript">
       <!--\nfunction clear_treeForm() {\n_clearJSFFormParameters('treeForm','',['treeForm:_idcl','treeForm:_link_hidden_']);\n}\nfunction clearFormHiddenParams_treeForm(){clear_treeForm();}\nfunction clearFormHiddenParams_treeForm(){clear_treeForm();}\nclear_treeForm();\n//--></script>
       <input type="hidden" name="jsf_sequence" value="2"/>
       </form>
      </html>
      


        • 1. Re: org.w3c.dom.DOMException: NAMESPACE_ERR
          Stan Silvert Master

          I don't know exactly what the cause is, but maybe I can provide a few clues. First, I'll let you know that I've put off RichFaces tree support until after beta 1. So I haven't tried this yet myself.

          The error is happening at the point where JSFUnit is converting the level 1 DOM provided by HttpUnit/JTidy. It's doing a simple transform to make it into a level 2 DOM. For whatever reason, the transformer is choking on this particular level 1 DOM representation of the HTML.

          I've seen some strange things happen if you have certain extra jars in your WEB-INF/lib. This would cause the RichFaces trees to stop working from the browser in the JSFUnit/RichFaces demo. Check to make sure that the rhino jar is not in your project. Also make sure that you don't have two versions of nekohtml in WEB-INF/lib. RichFaces needs one version and HttpUnit will get an older version by default. They will clash with each other.

          All this should be cleared up in the next several weeks as we finish the RichFaces support.

          Stan

          • 2. Re: org.w3c.dom.DOMException: NAMESPACE_ERR
            John Gilbert Apprentice

            Hmmm...

            I do not have rhino or nekohtml anywhere on my server. The jsfunit pom excludes them.

            I have verified that the dom that is returned from the webresponse is a jtidy document.

            Here is something interesting that I found in the javadoc for DOMSource:

            Note that XSLT requires namespace support. Attempting to transform a DOM that was not contructed with a namespace-aware parser may result in errors. Parsers can be made namespace aware by calling DocumentBuilderFactory.setNamespaceAware(boolean awareness).
            


            I don't know if this is relevant, but I couldn't find anything to indicate that the jtidy document is namespace aware.