Hi Mark,

I recommend you to use the Spring configuration. I never had this
requirement before but by the error message and the configuration fragment
that you have sent the NPE is caused because you are not passing an
instance of "org.dspace.saxon.ConfigurableTransformerFactory", you are
passing a String instead.

<property name='transformerFactory'

IIRC you should change it to:
<property name='transformerFactory'>
  <bean class="org.dspace.saxon.ConfigurableTransformerFactory"/>

The attribute "value" is for literal values. You can also define the bean
with an ID and then use the attribute "ref" with the ID of the bean.
I hope that helps.


El mié., 4 dic. 2019 a las 22:46, Mark H. Wood (<mw...@iupui.edu>) escribió:

> I'm using Cocoon 2.2.  I need to pass a custom XSLT transformer
> factory (that wraps Saxon's to configure it) to TraxProcessor, and the
> advice I've found in several places around the Web doesn't seem to be
> working:  my factory class never gets instantiated.
> I've got a file META-INF/cocoon/avalon/cocoon-core-saxon-xslt.xconf:
> <?xml version="1.0" encoding="UTF-8"?>
> <components>
>   <component role="org.apache.excalibur.xml.xslt.XSLTProcessor/saxon"
>     class="org.apache.cocoon.components.xslt.TraxProcessor">
>     <parameter name="use-store" value="true"/>
>     <parameter name="transformer-factory"
>                value="org.dspace.saxon.ConfigurableTransformerFactory"/>
>   </component>
> </components>
> I also tried copying it to WEB-INF/cocoon and it didnt' seem to work
> there either.
> I do have <configurator:settings/> and <avalon:bridge/> in the Spring
> config.
> Is there some way to debug component configuration and see if the file
> is even being looked for (and where *is* configuration looking)?  The
> Cocoon site directs me to Excalibur, which directs me to Avalon, which
> says that Avalon is wound up and directs me back to Excalibur....
> I've also tried to configure the thing using Spring:
>     <bean name='org.apache.excalibur.xml.xslt.XSLTProcessor/saxon'
>           class='org.apache.cocoon.components.xslt.TraxProcessor'
>           init-method='initialize'
>           destroy-method='dispose'>
>       <!--property name='use-store' value='true'/-->
>       <property name='transformerFactory'
>                 value='org.dspace.saxon.ConfigurableTransformerFactory'/>
>     </bean>
> but so far I'm missing something:  TraxProcessor.sourceToSAX throws an
> NPE.  I'm probably not setting the parameters correctly -- there isn't
> a setter for use-store at all, for example.
> I've found any number of pages that tell me Avalon configuration is
> being replaced by Spring, but nothing practical on how to convert
> Avalon configuration (such as the first sample above) to Spring, or
> even how to write fresh Spring configuration for Cocoon components.
> It would be nice to know how to do this even if I wind up using the
> Avalon approach with the present task.
> --
> Mark H. Wood
> Lead Technology Analyst
> University Library
> Indiana University - Purdue University Indianapolis
> 755 W. Michigan Street
> Indianapolis, IN 46202
> 317-274-0749
> www.ulib.iupui.edu

Reply via email to