You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Oliver Powell <Ol...@tvnz.co.nz> on 2004/11/08 23:47:11 UTC

NullPointerException when using Oracle's DBUri as Generator

Hi,

We are using Oracle's new-ish (since 9i I think) XML DB feature called
"DBUri" to directly retrieve an XML representation of our data via HTTP
URLs, for use in our Cocoon pipelines. DBUri provides a servlet located
on the database machine (which is also running a servlet engine, part of
the standard installation procedure) that is able to take a combination
of table references and XPath to query the database and return the
result as XML. Among other things, a big plus is we can avoid having to
use SQL in XSPs.

Unfortunately, when I try to use this DBUri XML as the generator for a
pipeline that outputs HTML, I get a NullPointerException somewhere deep
within Xalan's TransformerImpl class, when handling an "endDocument"
event from the looks of things. If you have any suggestions for fixing
this it would be much appreciated!

Original Exception: java.lang.RuntimeException:
java.lang.RuntimeException: java.lang.NullPointerException
    at
org.apache.xalan.transformer.TransformerImpl.run(TransformerImpl.java:34
18) 
    at
org.apache.xalan.transformer.TransformerHandlerImpl.endDocument(Transfor
merHandlerImpl.java:389) 
    at
org.apache.cocoon.xml.AbstractXMLPipe.endDocument(AbstractXMLPipe.java:5
6)
    ...
(Full stack trace at end of this email...)


For more info on Oracle DBUri, go to
http://download-west.oracle.com/docs/cd/B14117_01/appdev.101/b10790/xdb1
5dbu.htm
<http://download-west.oracle.com/docs/cd/B14117_01/appdev.101/b10790/xdb
15dbu.htm>  - you may need a technet login. We are using Cocoon 2.1.5,
Tomcat 5.0.19, Oracle 10g and Redhat Linux (on Intel)

The simplified pipeline looks like this:

       <map:match pattern="test">
         <map:generate
src="http://scott:tiger@oracle-host:8080/oradb/RELATIONSHIP_XML/ROW[ROOT
_TITLE='index_skin']/XML_RELATIONSHIP
<http://scott:tiger@oracle-host:8080/oradb/RELATIONSHIP_XML/ROW[ROOT_TIT
LE='index_skin']/XML_RELATIONSHIP?contenttype=text/xml> " />
         <map:transform type="cinclude" />
         <map:transform src="to-html.xslt" />
         <map:serialize type="html" />
       </map:match>

In short this pipeline:

1. Retrieves the disk location of an HTML file from the Oracle db using
DBUri, looking up by name 'index_skin'
2. Uses the include transformer to load the actual HTML file from disk
using the path returned from the db
3. Convert the stream into proper HTML, stripping out extraneous XML,
etc
4. Serialise as HTML

It may be useful to know that I can get this pipeline to work by
altering _any one_ of the following aspects of the pipeline:

- Serialise as XHTML rather than HTML (this uses the XMLSerializer)
- Replace the Oracle DBUri generator with a basic http call to a static
XML file (with the exact same content) stored on a web server on a
different machine.
- Load the DBUri XML from within a document() call inside an XSLT
stylesheet, rather than loading it in a generator

This indicates to me that the problem area lies in the combination of
using the XML returned by Oracle's DBUri as the generator and the
HTMLSerializer.

Here is the full stack trace:

Original Exception: java.lang.RuntimeException:
java.lang.RuntimeException: java.lang.NullPointerException
 at
org.apache.xalan.transformer.TransformerImpl.run(TransformerImpl.java:34
18)
 at
org.apache.xalan.transformer.TransformerHandlerImpl.endDocument(Transfor
merHandlerImpl.java:389)
 at
org.apache.cocoon.xml.AbstractXMLPipe.endDocument(AbstractXMLPipe.java:5
6)
 at
org.apache.cocoon.transformation.TraxTransformer.endDocument(TraxTransfo
rmer.java:549)
 at org.apache.xerces.parsers.AbstractSAXParser.endDocument(Unknown
Source)
 at org.apache.xerces.impl.XMLDocumentScannerImpl.endEntity(Unknown
Source)
 at org.apache.xerces.impl.XMLEntityManager.endEntity(Unknown Source)
 at org.apache.xerces.impl.XMLEntityScanner.load(Unknown Source)
 at org.apache.xerces.impl.XMLEntityScanner.skipSpaces(Unknown Source)
 at
org.apache.xerces.impl.XMLDocumentScannerImpl$TrailingMiscDispatcher.dis
patch(Unknown Source)
 at
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unkno
wn Source)
 at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
 at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
 at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
 at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
 at org.apache.excalibur.xml.impl.JaxpParser.parse(JaxpParser.java:296)
 at org.apache.excalibur.xml.impl.JaxpParser.parse(JaxpParser.java:315)
 at
org.apache.cocoon.components.source.SourceUtil.parse(SourceUtil.java:252
)
 at
org.apache.cocoon.generation.FileGenerator.generate(FileGenerator.java:1
16)
 at
org.apache.cocoon.components.pipeline.AbstractProcessingPipeline.process
XMLPipeline(AbstractProcessingPipeline.java:545)
 at
org.apache.cocoon.components.pipeline.impl.AbstractCachingProcessingPipe
line.processXMLPipeline(AbstractCachingProcessingPipeline.java:166)
 at
org.apache.cocoon.components.pipeline.AbstractProcessingPipeline.process
(AbstractProcessingPipeline.java:490)
 at
org.apache.cocoon.components.treeprocessor.sitemap.SerializeNode.invoke(
SerializeNode.java:120)
 at
org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.
invokeNodes(AbstractParentProcessingNode.java:49)
 at
org.apache.cocoon.components.treeprocessor.sitemap.PreparableMatchNode.i
nvoke(PreparableMatchNode.java:130)
 at
org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.
invokeNodes(AbstractParentProcessingNode.java:72)
 at
org.apache.cocoon.components.treeprocessor.sitemap.PipelineNode.invoke(P
ipelineNode.java:126)
 at
org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.
invokeNodes(AbstractParentProcessingNode.java:72)
 at
org.apache.cocoon.components.treeprocessor.sitemap.PipelinesNode.invoke(
PipelinesNode.java:101)
 at
org.apache.cocoon.components.treeprocessor.TreeProcessor.process(TreePro
cessor.java:336)
 at
org.apache.cocoon.components.treeprocessor.TreeProcessor.process(TreePro
cessor.java:277)
 at
org.apache.cocoon.components.treeprocessor.sitemap.MountNode.invoke(Moun
tNode.java:103)
 at
org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.
invokeNodes(AbstractParentProcessingNode.java:49)
 at
org.apache.cocoon.components.treeprocessor.sitemap.PreparableMatchNode.i
nvoke(PreparableMatchNode.java:130)
 at
org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.
invokeNodes(AbstractParentProcessingNode.java:72)
 at
org.apache.cocoon.components.treeprocessor.sitemap.PipelineNode.invoke(P
ipelineNode.java:126)
 at
org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.
invokeNodes(AbstractParentProcessingNode.java:72)
 at
org.apache.cocoon.components.treeprocessor.sitemap.PipelinesNode.invoke(
PipelinesNode.java:101)
 at
org.apache.cocoon.components.treeprocessor.TreeProcessor.process(TreePro
cessor.java:336)
 at
org.apache.cocoon.components.treeprocessor.TreeProcessor.process(TreePro
cessor.java:277)
 at
org.apache.cocoon.components.treeprocessor.sitemap.MountNode.invoke(Moun
tNode.java:103)
 at
org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.
invokeNodes(AbstractParentProcessingNode.java:49)
 at
org.apache.cocoon.components.treeprocessor.sitemap.PreparableMatchNode.i
nvoke(PreparableMatchNode.java:130)
 at
org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.
invokeNodes(AbstractParentProcessingNode.java:72)
 at
org.apache.cocoon.components.treeprocessor.sitemap.PipelineNode.invoke(P
ipelineNode.java:126)
 at
org.apache.cocoon.components.treeprocessor.AbstractParentProcessingNode.
invokeNodes(AbstractParentProcessingNode.java:72)
 at
org.apache.cocoon.components.treeprocessor.sitemap.PipelinesNode.invoke(
PipelinesNode.java:101)
 at
org.apache.cocoon.components.treeprocessor.TreeProcessor.process(TreePro
cessor.java:336)
 at
org.apache.cocoon.components.treeprocessor.TreeProcessor.process(TreePro
cessor.java:277)
 at org.apache.cocoon.Cocoon.process(Cocoon.java:639)
 at
org.apache.cocoon.servlet.CocoonServlet.service(CocoonServlet.java:1098)
 at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
 at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Applica
tionFilterChain.java:284)
 at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilt
erChain.java:204)
 at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValv
e.java:257)
 at
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveCo
ntext.java:151)
 at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:5
67)
 at
org.apache.catalina.core.StandardContextValve.invokeInternal(StandardCon
textValve.java:245)
 at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValv
e.java:191)
 at
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveCo
ntext.java:151)
 at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:5
67)
 at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java
:184)
 at
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveCo
ntext.java:151)
 at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java
:164)
 at
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveCo
ntext.java:149)
 at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:5
67)
 at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.
java:156)
 at
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveCo
ntext.java:151)
 at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:5
67)
 at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:972)
 at
org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:206)
 at
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:83
3)
 at
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processC
onnection(Http11Protocol.java:732)
 at
org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:61
9)
 at
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool
.java:688)
 at java.lang.Thread.run(Thread.java:534)

Thanks for reading,
Oliver


================================================================
CAUTION: This e-mail and any attachment(s) contains information
that is intended to be read only by the named recipient(s). It
may contain information that is confidential, proprietary or the
subject of legal privilege. This information is not to be used by
any other person and/or organisation. If you are not the intended
recipient, please advise us immediately and delete this e-mail
from your system. Do not use any information contained in it.

================================================================
For more information on the Television New Zealand Group, visit
us online at http://www.tvnz.co.nz
================================================================

Re: NullPointerException when using Oracle's DBUri as Generator

Posted by Leszek Gawron <lg...@mobilebox.pl>.
Oliver Powell wrote:
> Hi,
>  
> We are using Oracle's new-ish (since 9i I think) XML DB feature called 
> "DBUri" to directly retrieve an XML representation of our data via HTTP 
> URLs, for use in our Cocoon pipelines. DBUri provides a servlet located 
> on the database machine (which is also running a servlet engine, part of 
> the standard installation procedure) that is able to take a 
> combination of table references and XPath to query the database and 
> return the result as XML. Among other things, a big plus is we can avoid 
> having to use SQL in XSPs.
>  
> Unfortunately, when I try to use this DBUri XML as the generator for a 
> pipeline that outputs HTML, I get a NullPointerException somewhere deep 
> within Xalan's TransformerImpl class, when handling an "endDocument" 
> event from the looks of things. If you have any suggestions for fixing 
> this it would be much appreciated!
Could you also post the document  ?

-- 
Leszek Gawron                                      lgawron@mobilebox.pl
Project Manager                                    MobileBox sp. z o.o.
+48 (61) 855 06 67                              http://www.mobilebox.pl
mobile: +48 (501) 720 812                       fax: +48 (61) 853 29 65