Thorsten Scherler wrote:
On Tue, 2007-10-30 at 12:43 +0100, Thorsten Scherler wrote:
Hi all,
I am trying to get started with cocoon 2.2 development and need to write
my own custom transformer.
Since I will start from scratch I directly want to start using Spring
instead of Avalon.
Is there a documentation and/or an example for components that are based
directly on spring instead of avalon that I can use to get familiar?
I found
http://www.mail-archive.com/[EMAIL PROTECTED]/msg39766.html
So I defined my transformer in the spring context.
<bean id="dispatcher"
name="org.apache.cocoon.transformation.Transformer/dispatcher"
class="org.apache.forrest.dispatcher.transformation.DispatcherTransformer"/>
which is a simple test transformer:
package org.apache.forrest.dispatcher.transformation;
import org.apache.cocoon.transformation.AbstractSAXTransformer;
import org.xml.sax.SAXException;
public class DispatcherTransformer extends AbstractSAXTransformer {
private StringBuffer xmlBuffer;
/**
* Receive notification of the beginning of a document.
*/
public void startDocument() throws SAXException {
xmlBuffer = new StringBuffer();
xmlBuffer.append("<?xml version='1.0' encoding='UTF-8'?>\r\n");
xmlBuffer.append("<test/>");
}
public void endDocument() throws SAXException{
super.contentHandler.characters(xmlBuffer.toString().toCharArray(), 0,
xmlBuffer.length());
}
}
After "mvn install" I run "mvn jetty:run" and receive an exception in
the AbstractSAXTransformer:
Caused by: java.lang.NullPointerException
at
org.apache.cocoon.transformation.AbstractSAXTransformer.setup(AbstractSAXTransformer.java:274)
at
org.apache.cocoon.components.pipeline.AbstractProcessingPipeline.setupPipeline(AbstractProcessingPipeline.java:354)
When I debug in Eclipse I can see the following cause:
LINE:274 = if (getLogger().isDebugEnabled()) {
where getLogger() returns when inspecting:
"Method "getLogger" with signature "()Lorg/apache/commons/logging/Log;"
is not applicable on this object"
I reckon I need to configure the logging differently but sadly there
seems to very little documentation yet (or at least I could not find it
yet).
Any idea what I am doing wrong?
The problem is that the AbstractSAXTransformer still uses Logkit logging and if
it is initialized by Spring, the logger isn't set.
Fhis has been fixed in trunk by Vadim recently and will be part of the next
release.
--
Reinhard Pötz Managing Director, {Indoqa} GmbH
http://www.indoqa.com/en/people/reinhard.poetz/
Member of the Apache Software Foundation
Apache Cocoon Committer, PMC member, PMC Chair [EMAIL PROTECTED]
_________________________________________________________________________