You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by Max Larsson <ma...@abz-informatik.de> on 2005/05/07 16:28:00 UTC

The cocoon protocol can not be used outside an environment

Hallo,

i've a problem (see subject, which i could figure out
how to solve.

What i am doing in short is:
Implementing a transformer (similar to cinclue) only that
for ich request to another source i start thread, which process
the source. The transformer continues to go through the
sax events. At the endDocument method, the transformer waits
for all launched threads and serializa their output into single
stream of SAX events.

The problem i get is that my threads calls:
source = SourceUtil.getSource( 
resource,configurationParameters,resourceParameters,resolver );

which results in an MalformedURLExpetion with:
The cocoon protocol can not be used outside an environment


This actually goes down a call to the method
CocoonComponentManager.getCurrentEnvironment();

which returns null, thus the exception thrown.

Now, why is that so? Why the sudden is the Env. null,
or another question, how can i solve this?

regards


Max


Re: The cocoon protocol can not be used outside an environment

Posted by Vadim Gritsenko <va...@reverycodes.com>.
Max Larsson wrote:
> What i am doing in short is:
> Implementing a transformer (similar to cinclue) only that
> for ich request to another source i start thread, which process
> the source. The transformer continues to go through the
> sax events. At the endDocument method, the transformer waits
> for all launched threads and serializa their output into single
> stream of SAX events.

Take a look at IncludeTransformer in the scratchpad - does exactly the same.

Vadim

Re: The cocoon protocol can not be used outside an environment

Posted by Sylvain Wallez <sy...@apache.org>.
Max Larsson wrote:

> Hallo,
>
> i've a problem (see subject, which i could figure out
> how to solve.
>
> What i am doing in short is:
> Implementing a transformer (similar to cinclue) only that
> for ich request to another source i start thread, which process
> the source. The transformer continues to go through the
> sax events. At the endDocument method, the transformer waits
> for all launched threads and serializa their output into single
> stream of SAX events.
>
> The problem i get is that my threads calls:
> source = SourceUtil.getSource( 
> resource,configurationParameters,resourceParameters,resolver );
>
> which results in an MalformedURLExpetion with:
> The cocoon protocol can not be used outside an environment
>
>
> This actually goes down a call to the method
> CocoonComponentManager.getCurrentEnvironment();
>
> which returns null, thus the exception thrown.
>
> Now, why is that so? Why the sudden is the Env. null,
> or another question, how can i solve this?


Have a look at the cron block. It comes with a BackgroundEnvironment 
that is used to setup background threads so that they can use the cocoon 
protocol. Now you're right that automatically creating such an 
environment when none exists would be more convenient.

Sylvain

-- 
Sylvain Wallez                        Anyware Technologies
http://apache.org/~sylvain            http://anyware-tech.com
Apache Software Foundation Member     Research & Technology Director