We had problems with the XmlFileInputModule when having Saxon in the classpath [4]. The reason for that is that both Xalan and Saxon set the TransformerFactoryImpl via META-INF/services/ javax.xml.transform.TransformerFactory [1] (Java Services API) and Saxon was in the load order before Xalan in Tomcat.

We solved that by setting the javax.xml.transform.TransformerFactory system property explicitly to Xalan. This works because TransformerFactory.newInstance uses the system property before consulting the Java Services API [1].

I have seen two other workarounds
- removing the META-INF folder within the saxon-X.X.jar [2]
- prefixing the saxon-X.X.jar with z-. Then Tomcat loads it after Xalan and the TransformerFactory is set by Xalan via the Services API [3]

The advantage of the system property is that it plays nicely with Maven.

Alex

[1] 
http://java.sun.com/javase/6/docs/api/javax/xml/transform/TransformerFactory.html#newInstance()
[2] http://marc.info/?l=xml-cocoon-dev&m=108015075700034&w=2
[3] http://marc.info/?l=xml-cocoon-users&m=122467833601554&w=2
[4] java.lang.IllegalArgumentException: Unknown type of result: class javax.xml.transform.dom.DOMResult net .sf.saxon.event.SerializerFactory.getReceiver(SerializerFactory.java: 154) net .sf .saxon .IdentityTransformerHandler .startDocument(IdentityTransformerHandler.java:94) org .apache.cocoon.xml.AbstractXMLPipe.startDocument(AbstractXMLPipe.java: 47) org.apache.xerces.parsers.AbstractSAXParser.startDocument(Unknown Source) org.apache.xerces.impl.dtd.XMLDTDValidator.startDocument(Unknown Source) org.apache.xerces.impl.XMLDocumentScannerImpl.startEntity(Unknown Source) org.apache.xerces.impl.XMLVersionDetector.startDocumentParsing(Unknown Source) org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source) org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
        org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source) org.apache.xerces.jaxp.SAXParserImpl $JAXPSAXParser.parse(Unknown Source) org.apache.cocoon.core.xml.impl.JaxpSAXParser.parse(JaxpSAXParser.java: 196) org .apache .cocoon.core.xml.avalon.DefaultSAXParser.parse(DefaultSAXParser.java:47) org.apache.excalibur.xmlizer.DefaultXMLizer.toSAX(DefaultXMLizer.java: 127) org .apache.cocoon.components.source.util.SourceUtil.toSAX(SourceUtil.java: 180) org .apache.cocoon.components.source.util.SourceUtil.toDOM(SourceUtil.java: 318) org.apache.cocoon.components.modules.input.XMLFileModule $DocumentHelper.getDocument(XMLFileModule.java:178) org .apache .cocoon .components .modules.input.XMLFileModule.getContextObject(XMLFileModule.java:380) org .apache .cocoon .components .modules.input.XMLFileModule.getAttribute(XMLFileModule.java:402) org .apache .cocoon .components .modules.input.XMLFileModule.getAttribute(XMLFileModule.java:391)



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to