cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bruno Dumon <br...@outerthought.org>
Subject RE: Error: The Saxon DOM cannot be updated
Date Sat, 31 Jul 2004 22:01:42 GMT
On Sat, 2004-07-31 at 23:37, Lars Huttar wrote:
> I've managed to get Saxon working with Cocoon 2.1.5 under Jetty,
> but for the sake of our development server it would be really nice
> to have it working under 2.1.2 and Tomcat.
> 
> The problem there, as described below, was that if I followed the
> Saxon transform with a source writer transform, an error is declared
> that says the Saxon DOM cannot be updated. This happens even
> though there is an intervening Xalan transform between the
> Saxon transform and the source writer transform:
> 
>       <map:match pattern="test-name-index/*/*/*">
>         <map:generate src="sources/Language-name-index{3}.xml" label="raw" />
>         <map:transform src="transforms/name-index-step1-xsl{2}.xsl"  type="xslt-saxon"
label="raw1"
> />
>         <map:transform src="transforms/add-source-write.xsl" label="raw2" type="xslt">
>           <map:parameter name="output-file" value="Language-name-index{3}-grouped.xml"
/>
>         </map:transform>
>         <map:transform type="write-source" />
>         <map:serialize type="xml" />
>       </map:match>
> 
> I found more illuminating stuff in the error log than what I included
> in my first message on this topic. Note the lines after "Caused by":
> 
> FATAL_E (2004-07-31) 16:14.24:114   [core.xslt-processor]
> (/cvsmount/ethnologue/test-name-index/xslt-saxon/1/Tiny) Thread-10/TraxErrorHandler:
Error in
> TraxTransformer:
> file:/C:/Program%20Files/Apache%20Group/Tomcat%204.1/./../cocoon/./cvsmount/ethnologue/transforms/a
> dd-source-write.xsl; Line 12; Column 24;
> ; SystemID:
> file:/C:/Program%20Files/Apache%20Group/Tomcat%204.1/./../cocoon/./cvsmount/ethnologue/transforms/a
> dd-source-write.xsl; Line#: 12; Column#: 24
> javax.xml.transform.TransformerException: java.lang.UnsupportedOperationException: The
Saxon DOM
> cannot be updated
> 	at org.apache.xalan.transformer.TransformerImpl.executeChildTemplates(TransformerImpl.java:2341)
> 	at org.apache.xalan.templates.ElemLiteralResult.execute(ElemLiteralResult.java:682)
> ...
> ...
> Caused by: java.lang.UnsupportedOperationException: The Saxon DOM cannot be updated
> 	at net.sf.saxon.om.AbstractNode.disallowUpdate(AbstractNode.java:679)
> 	at net.sf.saxon.om.AbstractNode.removeChild(AbstractNode.java:566)
> 	at
> org.apache.cocoon.transformation.AbstractSAXTransformer.endRecording(AbstractSAXTransformer.java:48
> 6)
> 	at
> org.apache.cocoon.transformation.SourceWritingTransformer.endTransformingElement(SourceWritingTrans
> former.java:522)
> 	at
> org.apache.cocoon.transformation.AbstractSAXTransformer.endElement(AbstractSAXTransformer.java:358)
> 	at org.apache.cocoon.components.sax.XMLTeePipe.endElement(XMLTeePipe.java:124)
> 	at org.apache.xml.serializer.ToXMLSAXHandler.endElement(ToXMLSAXHandler.java:262)
> 	at org.apache.xalan.templates.ElemLiteralResult.execute(ElemLiteralResult.java:707)
> 	at org.apache.xalan.transformer.TransformerImpl.executeChildTemplates(TransformerImpl.java:2336)
> 
> It looks like the AbstractSAXTransformer's endRecording method
> is trying to remove a child node from the tree, and Saxon's
> AbstractNode class is crying foul.
> 
> Can anyone suggest an approach for working around this problem?
> I suppose this is a bug in SourceWritingTransformer or
> AbstractSAXTransformer that has been fixed since Cocoon 2.1.2,
> since I'm using the same Saxon .jar file with Cocoon 2.1.5
> and not encountering this error.

I don't think there's a difference between those two cocoon versions to
explain it, rather the classloader which accidentely orders the jars
differently (there is no guarantee that the jars are read in
alphabetical order, this depends on the platform).

As the error message says, the Saxon DOM cannot be updated, meaning that
Saxon builds read-only DOM trees. Cocoon relies on the XSLT processor to
build DOM trees from SAX events. The XSLT processor that gets used for
this is the default one, as determined by information read from the
classpath resource
META-INF/services/javax.xml.transform.TransformerFactory.

A number of solutions that come to mind:
* delete the directory META-INF/services from the saxon jar
* put xalan in the endorsed lib directory, but saxon not (thus in the
normal WEB-INF/lib)

-- 
Bruno Dumon                             http://outerthought.org/
Outerthought - Open Source, Java & XML Competence Support Center
bruno@outerthought.org                          bruno@apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Mime
View raw message