cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "SANSONE, AARON M [Non-Pharmacia/1000]" <aaron.m.sans...@monsanto.com>
Subject Cocoon 2 generated SAX Exception
Date Mon, 11 Feb 2002 22:51:57 GMT
All,

I'm running into a reoccurring problem in pipeline processing where I get a
SAX Exception.  It seems to happen when I place a DOM based transformer in
the pipeline after a series of SAX Transformations.  However, if a manually
serialize the file and create a test pipeline that reads the file in as a
generator, the test pipeline works.

>From the sitemap:

<map:match pattern="showTree">
		<map:generate type="file" src="sql/getMatrix.xml"/>
		<map:act type="request">
				<map:parameter name="parameters"
value="true"/>
				<map:transform type="sql">
						<map:parameter
name="use-connection" value="fp"/>
						<map:parameter
name="show-nr-of-rows" value="false"/>
						<map:parameter name="crop"
value="{cropCode}"/>
						<map:parameter
name="username" value="{../../username}"/>
				</map:transform>
				<map:transform type="xslt"
src="stylesheets/matrixSQLToXML.xsl"/>
				<map:transform type="xslt"
src="stylesheets/matrixAddSelf.xsl"/>
				<map:transform
type="matrixTransformer"/><!--This is where SAX Exception occurs-->
				<map:select type="parameter">
						<map:parameter
name="parameter-selector-test" value="{exportType}"/>
								<map:when
test="xml">
	
<map:serialize type="xml"/>
								</map:when>
	
<map:otherwise>
	
<map:serialize type="svg2jpeg"/>
	
</map:otherwise>
				</map:select>
				<map:serialize type="xml"/>
		</map:act>
</map:match>


Here is the stub for the matrixTransformer.  TreeAnalysis returns an SVG-XML
Document.  The entire document must be available for the runAnalysis method
to work properly:


import org.apache.cocoon.transformation.AbstractDOMTransformer;
import org.w3c.dom.Document;
import TreeAnalysis;

public class MatrixTransformer extends AbstractDOMTransformer {

    TreeAnalysis treeAnalysis;

    protected Document transform(Document doc) {
        treeAnalysis = new TreeAnalysis();

        log.debug("matrixTransformer START");
        Document svgDocument = treeAnalysis.runAnalysis(doc);
        log.debug("matrixTransformer END");
        return svgDocument;
    }
}


Here is the exception from the cocoon log.  The debug logs from the
MatrixTransformer class are never written.


org.apache.cocoon.ProcessingException: Could not read resource file:
/C:/Source/web/sql/getMatrix.xml: java.lang.RuntimeException:
org.xml.sax.SAXException: Invalid state 
	at
org.apache.cocoon.generation.FileGenerator.generate(FileGenerator.java:115)
	at
org.apache.cocoon.components.pipeline.AbstractEventPipeline.process(Abstract
EventPipeline.java:106)
	at
org.apache.cocoon.components.pipeline.AbstractStreamPipeline.process(Abstrac
tStreamPipeline.java:140)
	at
org.apache.cocoon.www.sitemap_xmap.wildcardMatchN40021F(sitemap_xmap.java:36
71)
	at
org.apache.cocoon.www.sitemap_xmap.process(sitemap_xmap.java:1602)
	at
org.apache.cocoon.www.sitemap_xmap.process(sitemap_xmap.java:1530)
	at org.apache.cocoon.sitemap.Handler.process(Handler.java:163)
	at org.apache.cocoon.sitemap.Manager.invoke(Manager.java:114)
	at org.apache.cocoon.Cocoon.process(Cocoon.java:514)
	at
org.apache.cocoon.servlet.CocoonServlet.service(CocoonServlet.java:647)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
	at allaire.jrun.servlet.JRunSE.service(../servlet/JRunSE.java:1416)
	at
allaire.jrun.session.JRunSessionService.service(../session/JRunSessionServic
e.java:1082)
	at
allaire.jrun.servlet.JRunSE.runServlet(../servlet/JRunSE.java:1270)
	at
allaire.jrun.servlet.JRunRequestDispatcher.forward(../servlet/JRunRequestDis
patcher.java:89)
	at allaire.jrun.servlet.JRunSE.service(../servlet/JRunSE.java:1552)
	at allaire.jrun.servlet.JRunSE.service(../servlet/JRunSE.java:1542)
	at
allaire.jrun.servlet.JvmContext.dispatch(../servlet/JvmContext.java:364)
	at allaire.jrun.http.WebEndpoint.run(../http/WebEndpoint.java:115)
	at allaire.jrun.ThreadPool.run(../ThreadPool.java:272)
	at allaire.jrun.WorkerThread.run(../WorkerThread.java:75)
java.lang.RuntimeException: org.xml.sax.SAXException: Invalid state 
	at org.apache.xerces.framework.XMLParser.parse(XMLParser.java:1111)
	at
org.apache.cocoon.components.parser.XercesParser.parse(XercesParser.java:78)
	at
org.apache.cocoon.components.source.URLSource.toSAX(URLSource.java:327)
	at
org.apache.cocoon.generation.FileGenerator.generate(FileGenerator.java:109)
	at
org.apache.cocoon.components.pipeline.AbstractEventPipeline.process(Abstract
EventPipeline.java:106)
	at
org.apache.cocoon.components.pipeline.AbstractStreamPipeline.process(Abstrac
tStreamPipeline.java:140)
	at
org.apache.cocoon.www.sitemap_xmap.wildcardMatchN40021F(sitemap_xmap.java:36
71)
	at
org.apache.cocoon.www.sitemap_xmap.process(sitemap_xmap.java:1602)
	at
org.apache.cocoon.www.sitemap_xmap.process(sitemap_xmap.java:1530)
	at org.apache.cocoon.sitemap.Handler.process(Handler.java:163)
	at org.apache.cocoon.sitemap.Manager.invoke(Manager.java:114)
	at org.apache.cocoon.Cocoon.process(Cocoon.java:514)
	at
org.apache.cocoon.servlet.CocoonServlet.service(CocoonServlet.java:647)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
	at allaire.jrun.servlet.JRunSE.service(../servlet/JRunSE.java:1416)
	at
allaire.jrun.session.JRunSessionService.service(../session/JRunSessionServic
e.java:1082)
	at
allaire.jrun.servlet.JRunSE.runServlet(../servlet/JRunSE.java:1270)
	at
allaire.jrun.servlet.JRunRequestDispatcher.forward(../servlet/JRunRequestDis
patcher.java:89)
	at allaire.jrun.servlet.JRunSE.service(../servlet/JRunSE.java:1552)
	at allaire.jrun.servlet.JRunSE.service(../servlet/JRunSE.java:1542)
	at
allaire.jrun.servlet.JvmContext.dispatch(../servlet/JvmContext.java:364)
	at allaire.jrun.http.WebEndpoint.run(../http/WebEndpoint.java:115)
	at allaire.jrun.ThreadPool.run(../ThreadPool.java:272)
	at allaire.jrun.WorkerThread.run(../WorkerThread.java:75)
java.lang.RuntimeException: org.xml.sax.SAXException: Invalid state 
	at org.apache.xerces.framework.XMLParser.parse(XMLParser.java:1111)
	at
org.apache.cocoon.components.parser.XercesParser.parse(XercesParser.java:78)
	at
org.apache.cocoon.components.source.URLSource.toSAX(URLSource.java:327)
	at
org.apache.cocoon.generation.FileGenerator.generate(FileGenerator.java:109)
	at
org.apache.cocoon.components.pipeline.AbstractEventPipeline.process(Abstract
EventPipeline.java:106)
	at
org.apache.cocoon.components.pipeline.AbstractStreamPipeline.process(Abstrac
tStreamPipeline.java:140)
	at
org.apache.cocoon.www.sitemap_xmap.wildcardMatchN40021F(sitemap_xmap.java:36
71)
	at
org.apache.cocoon.www.sitemap_xmap.process(sitemap_xmap.java:1602)
	at
org.apache.cocoon.www.sitemap_xmap.process(sitemap_xmap.java:1530)
	at org.apache.cocoon.sitemap.Handler.process(Handler.java:163)
	at org.apache.cocoon.sitemap.Manager.invoke(Manager.java:114)
	at org.apache.cocoon.Cocoon.process(Cocoon.java:514)
	at
org.apache.cocoon.servlet.CocoonServlet.service(CocoonServlet.java:647)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
	at allaire.jrun.servlet.JRunSE.service(../servlet/JRunSE.java:1416)
	at
allaire.jrun.session.JRunSessionService.service(../session/JRunSessionServic
e.java:1082)
	at
allaire.jrun.servlet.JRunSE.runServlet(../servlet/JRunSE.java:1270)
	at
allaire.jrun.servlet.JRunRequestDispatcher.forward(../servlet/JRunRequestDis
patcher.java:89)
	at allaire.jrun.servlet.JRunSE.service(../servlet/JRunSE.java:1552)
	at allaire.jrun.servlet.JRunSE.service(../servlet/JRunSE.java:1542)
	at
allaire.jrun.servlet.JvmContext.dispatch(../servlet/JvmContext.java:364)
	at allaire.jrun.http.WebEndpoint.run(../http/WebEndpoint.java:115)
	at allaire.jrun.ThreadPool.run(../ThreadPool.java:272)
	at allaire.jrun.WorkerThread.run(../WorkerThread.java:75)



When I manually serialize the file as XML and read it as a generator in a
test pipeline, everything works.

<map:match pattern="testShowTree">
		<map:generate type="file" src="sql/getMatrix.xml"/>
		<map:act type="request">
				<map:parameter name="parameters"
value="true"/>
				<map:transform type="sql">
						<map:parameter
name="use-connection" value="fp"/>
						<map:parameter
name="show-nr-of-rows" value="false"/>
						<map:parameter name="crop"
value="{cropCode}"/>
						<map:parameter
name="username" value="{../../username}"/>
				</map:transform>
				<map:transform type="xslt"
src="stylesheets/matrixSQLToXML.xsl"/>
				<map:transform type="xslt"
src="stylesheets/matrixAddSelf.xsl"/>
				<map:serialize type="xml"/>
		</map:act>
</map:match>

I manually save these results to a file (i.e. cache/testTree.xml) then use
this pipeline to read it.

<map:match pattern="testTree">
		<map:act type="request">
				<map:parameter name="parameters"
value="true"/>
				<map:generate type="file"
src="cache/testTree.xml"/>
				<map:transform type="matrixTransformer"/>
				<map:serialize type="svg2jpeg"/>
		</map:act>
</map:match>


So the above works, however when I aggregate these two steps, I get the
aforementioned exception.

Any help or guidance will be greatly appreciated.

Thanks,
-Aaron

---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>

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


Mime
View raw message