You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by Reinhard Poetz <re...@apache.org> on 2006/03/07 19:44:26 UTC
Problems with tree buiilder
I updated SVN and tried to run the block deployment samples
(cocoon-deployer-webapp-sample or cocoon-deployer-plugin-demo) and get the
following stacktrace:
25336 [BoundedThreadPool0-1] WARN org.mortbay.log - /p1/test
org.apache.avalon.framework.configuration.ConfigurationException: Could not load
TreeBuilder configuration from resource
://org/apache/cocoon/components/treeprocessor/sitemap-language.xml
at
org.apache.cocoon.components.treeprocessor.sitemap.SitemapLanguage.build(SitemapLanguage.java:423)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at
org.apache.cocoon.core.container.handler.PoolableComponentHandler$ProxyHandler.invoke(PoolableComponentHandle
r.java:155)
at $Proxy1.build(Unknown Source)
at
org.apache.cocoon.components.treeprocessor.TreeProcessor.buildConcreteProcessor(TreeProcessor.java:405)
at
org.apache.cocoon.components.treeprocessor.TreeProcessor.setupConcreteProcessor(TreeProcessor.java:340)
at
org.apache.cocoon.components.treeprocessor.TreeProcessor.process(TreeProcessor.java:241)
at
org.apache.cocoon.sitemap.SitemapServlet.service(SitemapServlet.java:161)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:860)
at
org.apache.cocoon.blocks.servlet.BlockManager.service(BlockManager.java:158)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:860)
at
org.apache.cocoon.blocks.BlocksContext$PathDispatcher.forward(BlocksContext.java:178)
at
org.apache.cocoon.blocks.servlet.BlocksManager.service(BlocksManager.java:233)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:860)
at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:423)
at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:350)
at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:195)
at
org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:164)
at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:536)
at org.mortbay.jetty.Server.handle(Server.java:309)
at org.mortbay.jetty.Server.handle(Server.java:285)
at org.mortbay.jetty.HttpConnection.doHandler(HttpConnection.java:364)
at org.mortbay.jetty.HttpConnection.access$1600(HttpConnection.java:46)
at
org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:612)
at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:485)
at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:194)
at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:298)
at
org.mortbay.jetty.nio.SelectChannelConnector$HttpEndPoint.run(SelectChannelConnector.java:710)
at
org.mortbay.thread.BoundedThreadPool$PoolThread.run(BoundedThreadPool.java:412)
Caused by: java.lang.ArrayIndexOutOfBoundsException: -1
at java.util.ArrayList.get(ArrayList.java:326)
at
org.apache.cocoon.environment.internal.EnvironmentHelper.getSitemapServiceManager(EnvironmentHelper.java:396)
at
org.apache.cocoon.components.source.CocoonSourceResolver.getComponentLocator(CocoonSourceResolver.java:212)
at
org.apache.cocoon.components.source.CocoonSourceResolver.resolveURI(CocoonSourceResolver.java:140)
at
org.apache.cocoon.components.source.CocoonSourceResolver.resolveURI(CocoonSourceResolver.java:181)
at
org.apache.cocoon.components.treeprocessor.sitemap.SitemapLanguage.build(SitemapLanguage.java:414)
... 31 more
Any ideas?
--
Reinhard Pötz Independent Consultant, Trainer & (IT)-Coach
{Software Engineering, Open Source, Web Applications, Apache Cocoon}
web(log): http://www.poetz.cc
--------------------------------------------------------------------
___________________________________________________________
Telefonate ohne weitere Kosten vom PC zum PC: http://messenger.yahoo.de
Re: Problems with tree buiilder
Posted by Carsten Ziegeler <cz...@apache.org>.
Reinhard Poetz wrote:
> I updated SVN and tried to run the block deployment samples
> (cocoon-deployer-webapp-sample or cocoon-deployer-plugin-demo) and get the
> following stacktrace:
>
>
> Any ideas?
>
Yupp :) This is due to a change I did last week; the change is not
finished as I wanted to discuss possible solutions first here in the
list but didn't have time yet...
Now, the problem is that the code is trying to get the current bean
factory of the sitemap while the sitemap is constructed. With the "old
core", we have a fallback with the Cocoon class which calls the
enterEnvironment() method. I guess in the case of the blocks-fw you
don't have this fallback. So the workaround should be to call
enterEnvironment somewhere and but the root processor with the root bean
factory on the stack.
The problem I wanted to discuss is where to store the current bean
factory. Currently I added a getBeanFactory() method to the Processor
interface, allowing each and every processor to have an own bean factory.
An alternative would be to have this outside the processor and have a
"processor manager" kind of a class which stores the corresponding bean
factory for a processor (if it has one).
I think both solutions make sense. While the first one is easier to
implement, the second one is cleaner as it separates the concerns better.
So which way do we want to proceed? Or is there a better option?
With these changes I'm trying to reduce the impact of the internal
pipeline handling as much as possible. In the optimum case we are able
to remove the environment stack handling completly or at least make it
as small as possible.
Carsten
--
Carsten Ziegeler - Open Source Group, S&N AG
http://www.s-und-n.de
http://www.osoco.org/weblogs/rael/
Re: FOP 0.91 Serializer
Posted by Jean-Baptiste Quenot <jb...@apache.org>.
* Alexander Lochschmied:
> I would if I knew how..
Dear Alexander,
Your contribution is very interesting and we are likely to commit
it for the next release.
In order to file this contribution, you have first to create an
account on JIRA:
https://issues.apache.org/jira/secure/Signup!default.jspa
Once you have done that, submit the issue by going here:
https://issues.apache.org/jira/browse/COCOON
And click on CREATE NEW ISSUE
And don't forget to grant Apache the right to include your work by
checking the appropriate option when you attach the new file.
Thanks in advance,
--
Jean-Baptiste Quenot
http://caraldi.com/jbq/
RE: FOP 0.91 Serializer
Posted by Alexander Lochschmied <Al...@Vishay.com>.
I would if I knew how..
--Alexander
-----Original Message-----
From: Joerg Heinicke [mailto:joerg.heinicke@gmx.de]
Sent: Dienstag, 7. März 2006 20:19
To: dev@cocoon.apache.org
Subject: Re: FOP 0.91 Serializer
Please add it to our issue tracker Jira at
https://issues.apache.org/jira/browse/COCOON for organizational and
especially legal reasons.
Thanks.
Jörg
On 07.03.2006 19:52, Alexander Lochschmied wrote:
> Hello everybody,
>
> to get Apache FOP 0.91 beta working with Cocoon, a new Serializer is
> necessary (the FOP API changed considerably). I wrote a very simple but
> working Serializer and hope that helps a little for future releases of
> Cocoon. The Serializer doesn't accept any configuration except 'mime-type'
> yet.
>
> Best regards,
> Alexander
Re: FOP 0.91 Serializer
Posted by Joerg Heinicke <jo...@gmx.de>.
Please add it to our issue tracker Jira at
https://issues.apache.org/jira/browse/COCOON for organizational and
especially legal reasons.
Thanks.
Jörg
On 07.03.2006 19:52, Alexander Lochschmied wrote:
> Hello everybody,
>
> to get Apache FOP 0.91 beta working with Cocoon, a new Serializer is
> necessary (the FOP API changed considerably). I wrote a very simple but
> working Serializer and hope that helps a little for future releases of
> Cocoon. The Serializer doesn't accept any configuration except 'mime-type'
> yet.
>
> Best regards,
> Alexander
Re: FOP 0.91 Serializer
Posted by Jeremias Maerki <de...@jeremias-maerki.ch>.
Just FYI, the FOP API will change slightly in the next release to
improve performance and reuse of reusable components. After the next
release the outer API will be considered stable. I was planning to write
a full FOP serializer (including all important features) for Cocoon when
the API is finalized. I assume this will happen within the next 4 to 5
weeks. However, I won't be unhappy if someone else writes the serializer.
Time constraints as usual. :-)
On 07.03.2006 19:52:28 Alexander Lochschmied wrote:
> Hello everybody,
>
> to get Apache FOP 0.91 beta working with Cocoon, a new Serializer is
> necessary (the FOP API changed considerably). I wrote a very simple but
> working Serializer and hope that helps a little for future releases of
> Cocoon. The Serializer doesn't accept any configuration except 'mime-type'
> yet.
<snip/>
Jeremias Maerki
FOP 0.91 Serializer
Posted by Alexander Lochschmied <Al...@Vishay.com>.
Hello everybody,
to get Apache FOP 0.91 beta working with Cocoon, a new Serializer is
necessary (the FOP API changed considerably). I wrote a very simple but
working Serializer and hope that helps a little for future releases of
Cocoon. The Serializer doesn't accept any configuration except 'mime-type'
yet.
Best regards,
Alexander
-------- snip ------------------------------------------------
package org.apache.cocoon.serialization;
import org.apache.fop.apps.Fop;
import java.io.OutputStream;
import java.io.Serializable;
import javax.xml.parsers.SAXParserFactory;
import org.apache.avalon.framework.configuration.Configurable;
import org.apache.avalon.framework.configuration.Configuration;
import org.apache.avalon.framework.configuration.ConfigurationException;
import org.apache.avalon.framework.logger.Logger;
import org.apache.avalon.framework.service.ServiceException;
import org.apache.avalon.framework.service.ServiceManager;
import org.apache.avalon.framework.service.Serviceable;
import org.apache.cocoon.caching.CacheableProcessingComponent;
import org.apache.excalibur.source.SourceValidity;
import org.apache.fop.apps.FOUserAgent;
import org.xml.sax.helpers.DefaultHandler;
public class FOP091Serializer
extends AbstractSerializer
implements
Configurable, CacheableProcessingComponent, Serviceable/*, Disposable */ {
protected Logger logger;
protected String mimetype;
protected boolean setContentLength = true;
protected FOUserAgent userAgent = null;
protected Fop fop = null;
protected ServiceManager manager;
protected javax.xml.transform.stream.StreamResult res = null;
public void service( ServiceManager manager )
throws ServiceException {
this.manager = manager;
}
public void configure( Configuration conf )
throws ConfigurationException {
this.logger = getLogger().getChildLogger( "fop" );
this.setContentLength =
conf.getChild( "set-content-length"
).getValueAsBoolean( true );
String configUrl =
conf.getChild( "user-config" ).getValue( null );
this.mimetype = conf.getAttribute( "mime-type" );
// TODO get and use user configuration
// TODO get and use user's renderer definition, ...
}
public String getMimeType() {
return this.mimetype;
}
public void setOutputStream( OutputStream o ) {
DefaultHandler dh = null;
fop = new Fop( this.mimetype );
fop.setOutputStream( o );
SAXParserFactory factory = SAXParserFactory.newInstance();
factory.setNamespaceAware( true );
try {
dh = fop.getDefaultHandler();
setContentHandler( dh );
} catch( Exception ex) {
; // TODO FIXME
}
}
public Serializable getKey() {
return "0";
}
public SourceValidity getValidity() {
return null; //NOPValidity.SHARED_INSTANCE;
}
public void recycle() {
super.recycle();
this.userAgent = null;
this.fop = null;
}
public boolean shouldSetContentLength() {
return this.setContentLength;
}
}
-------- snip ------------------------------------------------