You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Antonio Fiol Bonnín <an...@gmail.com> on 2005/04/21 17:14:49 UTC

CVSSource

Hello,

I am trying to use the CVSSource on Cocoon 2.1.5.

What I tried is adding to cocoon.xconf:
(1 line context information)

    <component-instance
class="org.apache.cocoon.components.source.impl.ModuleSourceFactory"
name="module"/>
    <component-instance name="cocodoco-cvs"
class="com.anwrt.cocoon.cvssource.source.CVSSourceFactory">
      <hostname>cvs.apache.org</hostname>
      <repository>/home/cvspublic</repository>
      <module>xml-cocoon2/src/documentation</module>
      <username>anoncvs</username>
      <password>anoncvs</password>
      <!-- optionnal hierarchy refresh period (in seconds, defaults to 600) -->
      <refresh-period>3600</refresh-period>

      <!-- optionnal commit message expression (sitemap syntax) -->
      <commit-message-expr>{request-param:cvs-message}</commit-message-expr>
    </component-instance>
  </source-factories>

I did this because I did not find a "source-handlers" section.

The problem: StackOverflowException.
The repeating stack:
        at org.apache.cocoon.components.CocoonComponentManager.lookup(CocoonComponentManager.java:275)
        at org.apache.avalon.framework.service.WrapperServiceManager.lookup(WrapperServiceManager.java:107)
        at org.apache.cocoon.components.modules.input.PropertiesFileModule.service(PropertiesFileModule.java:58)
        at org.apache.avalon.framework.container.ContainerUtil.service(ContainerUtil.java:182)
        at org.apache.avalon.excalibur.component.DefaultComponentFactory.newInstance(DefaultComponentFactory.java:255)
        at org.apache.avalon.excalibur.component.ThreadSafeComponentHandler.initialize(ThreadSafeComponentHandler.java:108)
        at org.apache.avalon.excalibur.component.ExcaliburComponentSelector.addComponent(ExcaliburComponentSelector.java:703)
        at org.apache.cocoon.components.ExtendedComponentSelector.configure(ExtendedComponentSelector.java:233)
        at org.apache.avalon.framework.container.ContainerUtil.configure(ContainerUtil.java:240)
        at org.apache.avalon.excalibur.component.DefaultComponentFactory.newInstance(DefaultComponentFactory.java:269)
        at org.apache.avalon.excalibur.component.ThreadSafeComponentHandler.initialize(ThreadSafeComponentHandler.java:108)
        at org.apache.avalon.excalibur.component.ExcaliburComponentManager.lookup(ExcaliburComponentManager.java:276)
        at org.apache.cocoon.components.CocoonComponentManager.lookup(CocoonComponentManager.java:297)
        at org.apache.cocoon.components.treeprocessor.variables.PreparedVariableResolver.getNewModuleToken(PreparedVariableResolver.java:192)
        at org.apache.cocoon.components.treeprocessor.variables.PreparedVariableResolver.<init>(PreparedVariableResolver.java:117)
        at org.apache.cocoon.components.treeprocessor.variables.VariableResolverFactory.getResolver(VariableResolverFactory.java:103)
        at com.anwrt.cocoon.cvssource.source.CVSSourceFactory.getVariable(CVSSourceFactory.java:238)
        at com.anwrt.cocoon.cvssource.source.CVSSourceFactory.configure(CVSSourceFactory.java:209)
        at org.apache.avalon.framework.container.ContainerUtil.configure(ContainerUtil.java:240)
        at org.apache.avalon.excalibur.component.DefaultComponentFactory.newInstance(DefaultComponentFactory.java:269)
        at org.apache.avalon.excalibur.component.ThreadSafeComponentHandler.initialize(ThreadSafeComponentHandler.java:108)
        at org.apache.avalon.excalibur.component.ExcaliburComponentSelector.addComponent(ExcaliburComponentSelector.java:703)
        at org.apache.cocoon.components.ExtendedComponentSelector.configure(ExtendedComponentSelector.java:233)
        at org.apache.avalon.framework.container.ContainerUtil.configure(ContainerUtil.java:240)
        at org.apache.avalon.excalibur.component.DefaultComponentFactory.newInstance(DefaultComponentFactory.java:269)
        at org.apache.avalon.excalibur.component.ThreadSafeComponentHandler.initialize(ThreadSafeComponentHandler.java:108)
        at org.apache.avalon.excalibur.component.ExcaliburComponentManager.lookup(ExcaliburComponentManager.java:276)
        at org.apache.cocoon.components.CocoonComponentManager.lookup(CocoonComponentManager.java:297)
        at org.apache.avalon.framework.service.WrapperServiceManager.lookup(WrapperServiceManager.java:107)
        at org.apache.excalibur.source.impl.SourceResolverImpl.service(SourceResolverImpl.java:132)
        at org.apache.avalon.framework.container.ContainerUtil.service(ContainerUtil.java:182)
        at org.apache.avalon.excalibur.component.DefaultComponentFactory.newInstance(DefaultComponentFactory.java:255)
        at org.apache.avalon.excalibur.component.ThreadSafeComponentHandler.initialize(ThreadSafeComponentHandler.java:108)
        at org.apache.avalon.excalibur.component.ExcaliburComponentManager.lookup(ExcaliburComponentManager.java:234)
        at org.apache.cocoon.components.CocoonComponentManager.lookup(CocoonComponentManager.java:275)


If I understand what is happening, cocoon is trying to initialize
everything recursively. IOW, the getVariable method of CVSSource needs
something from the component manager which is not ready until it is
fully initialized... but what?

Any hints? Thank you very much for your help.

-- 
Antonio

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: CVSSource

Posted by Cédric Damioli <ce...@anyware-tech.com>.
Antonio Fiol Bonnín a écrit :

>2005/4/21, Cédric Damioli <ce...@anyware-tech.com>:
>  
>
>>Antonio Fiol Bonnín a écrit :
>>
>>    
>>
>>>Hello,
>>>
>>>I am trying to use the CVSSource on Cocoon 2.1.5.
>>>
>>>What I tried is adding to cocoon.xconf:
>>>(1 line context information)
>>>
>>>   <component-instance
>>>class="org.apache.cocoon.components.source.impl.ModuleSourceFactory"
>>>name="module"/>
>>>   <component-instance name="cocodoco-cvs"
>>>class="com.anwrt.cocoon.cvssource.source.CVSSourceFactory">
>>>     <hostname>cvs.apache.org</hostname>
>>>     <repository>/home/cvspublic</repository>
>>>     <module>xml-cocoon2/src/documentation</module>
>>>     <username>anoncvs</username>
>>>     <password>anoncvs</password>
>>>     <!-- optionnal hierarchy refresh period (in seconds, defaults to 600) -->
>>>     <refresh-period>3600</refresh-period>
>>>
>>>     <!-- optionnal commit message expression (sitemap syntax) -->
>>>     <commit-message-expr>{request-param:cvs-message}</commit-message-expr>
>>>   </component-instance>
>>> </source-factories>
>>>
>>>I did this because I did not find a "source-handlers" section.
>>>
>>>The problem: StackOverflowException.
>>>The repeating stack:
>>>(snip)
>>>
>>>If I understand what is happening, cocoon is trying to initialize
>>>everything recursively. IOW, the getVariable method of CVSSource needs
>>>something from the component manager which is not ready until it is
>>>fully initialized... but what?
>>>
>>>Any hints? Thank you very much for your help.
>>>
>>>
>>>
>>>      
>>>
>>You guessed correctly ! :-)
>>
>>IIRC, the guilty component is an InputModule (in your case,
>>PropertiesFileModule).
>>There's also others InputModule (XMLMetaModule ?) trying to lookup a
>>SourceResolver, which itself try to initialize CVSSourceFactory, which
>>itself needs InputModule (via VariableResolver), etc etc...
>>
>>Every time I want to use CVSSource in my project, I clean InputModule
>>section and all works correctly after that.
>>    
>>
>
>Maybe it works if you clean the InputModule section. I will test it.
>
>However, isn't it a bug (of CVSSource or other) that you can't have
>both CVSSource and InputModules together at the same time?
>
>Shouldn't someone break the loop? Who? How?
>
>  
>
I imagine you could create a version of CVSSource not dependent of 
InputModules (without variable resolving).

But, on the other hand,  you only have to remove those InputModule who 
create the circular dependencies (those who need a SourceResolver): they 
are only a few.

-- 
Cédric Damioli
ANYWARE TECHNOLOGIES
Tel : +33 (0)5 61 00 52 90
Fax : +33 (0)5 61 00 51 46
http://www.anyware-tech.com


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: CVSSource

Posted by Antonio Fiol Bonnín <an...@gmail.com>.
> > Every time I want to use CVSSource in my project, I clean InputModule
> > section and all works correctly after that.
> 
> Maybe it works if you clean the InputModule section. I will test it.
> 
> However, isn't it a bug (of CVSSource or other) that you can't have
> both CVSSource and InputModules together at the same time?
> 
> Shouldn't someone break the loop? Who? How?


I have tried something that worked on cocoon 2.1.5: using lazy initialization.

Here's the necessary change for CVSSourceFactory:

- Method implementation one-line change:

    private VariableResolver getVariable(Configuration config, String
name, String defValue) throws ConfigurationException {
        Configuration child = config.getChild(name);
        try {
            String pattern = child.getValue(defValue);
            return new LazyVariableResolver(pattern, this.manager); //
instead of using VariableResolverFactory
        } catch(PatternException pe) {
            throw new ConfigurationException(
                "Wrong expression for " + child.getName() + " at " +
child.getLocation(),
                pe
            );
        }
    }


- New inner class (could easily be moved outside):

    class LazyVariableResolver extends VariableResolver {
        VariableResolver delegate;
        ComponentManager cm;

        LazyVariableResolver(String s, ComponentManager cm) throws
PatternException {
            super(s);
            this.cm = cm;
        }

        public String resolve(InvokeContext context, Map map) throws
PatternException {
            if(delegate==null) {
                delegate =
VariableResolverFactory.getResolver(originalExpr, cm);
            }
            return delegate.resolve(context, map);
        }
    }


But possibly this is not the right thing to do for Cocoon 2.1.7, as I
think the VariableResolver thing has changed quite a lot from 2.1.5 to
2.1.7.

-- 
Antonio

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: CVSSource

Posted by Antonio Fiol Bonnín <an...@gmail.com>.
2005/4/21, Cédric Damioli <ce...@anyware-tech.com>:
> Antonio Fiol Bonnín a écrit :
> 
> >Hello,
> >
> >I am trying to use the CVSSource on Cocoon 2.1.5.
> >
> >What I tried is adding to cocoon.xconf:
> >(1 line context information)
> >
> >    <component-instance
> >class="org.apache.cocoon.components.source.impl.ModuleSourceFactory"
> >name="module"/>
> >    <component-instance name="cocodoco-cvs"
> >class="com.anwrt.cocoon.cvssource.source.CVSSourceFactory">
> >      <hostname>cvs.apache.org</hostname>
> >      <repository>/home/cvspublic</repository>
> >      <module>xml-cocoon2/src/documentation</module>
> >      <username>anoncvs</username>
> >      <password>anoncvs</password>
> >      <!-- optionnal hierarchy refresh period (in seconds, defaults to 600) -->
> >      <refresh-period>3600</refresh-period>
> >
> >      <!-- optionnal commit message expression (sitemap syntax) -->
> >      <commit-message-expr>{request-param:cvs-message}</commit-message-expr>
> >    </component-instance>
> >  </source-factories>
> >
> >I did this because I did not find a "source-handlers" section.
> >
> >The problem: StackOverflowException.
> >The repeating stack:
> > (snip)
> >
> >If I understand what is happening, cocoon is trying to initialize
> >everything recursively. IOW, the getVariable method of CVSSource needs
> >something from the component manager which is not ready until it is
> >fully initialized... but what?
> >
> >Any hints? Thank you very much for your help.
> >
> >
> >
> You guessed correctly ! :-)
> 
> IIRC, the guilty component is an InputModule (in your case,
> PropertiesFileModule).
> There's also others InputModule (XMLMetaModule ?) trying to lookup a
> SourceResolver, which itself try to initialize CVSSourceFactory, which
> itself needs InputModule (via VariableResolver), etc etc...
> 
> Every time I want to use CVSSource in my project, I clean InputModule
> section and all works correctly after that.

Maybe it works if you clean the InputModule section. I will test it.

However, isn't it a bug (of CVSSource or other) that you can't have
both CVSSource and InputModules together at the same time?

Shouldn't someone break the loop? Who? How?

-- 
Antonio

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: CVSSource

Posted by Cédric Damioli <ce...@anyware-tech.com>.
Antonio Fiol Bonnín a écrit :

>Hello,
>
>I am trying to use the CVSSource on Cocoon 2.1.5.
>
>What I tried is adding to cocoon.xconf:
>(1 line context information)
>
>    <component-instance
>class="org.apache.cocoon.components.source.impl.ModuleSourceFactory"
>name="module"/>
>    <component-instance name="cocodoco-cvs"
>class="com.anwrt.cocoon.cvssource.source.CVSSourceFactory">
>      <hostname>cvs.apache.org</hostname>
>      <repository>/home/cvspublic</repository>
>      <module>xml-cocoon2/src/documentation</module>
>      <username>anoncvs</username>
>      <password>anoncvs</password>
>      <!-- optionnal hierarchy refresh period (in seconds, defaults to 600) -->
>      <refresh-period>3600</refresh-period>
>
>      <!-- optionnal commit message expression (sitemap syntax) -->
>      <commit-message-expr>{request-param:cvs-message}</commit-message-expr>
>    </component-instance>
>  </source-factories>
>
>I did this because I did not find a "source-handlers" section.
>
>The problem: StackOverflowException.
>The repeating stack:
>        at org.apache.cocoon.components.CocoonComponentManager.lookup(CocoonComponentManager.java:275)
>        at org.apache.avalon.framework.service.WrapperServiceManager.lookup(WrapperServiceManager.java:107)
>        at org.apache.cocoon.components.modules.input.PropertiesFileModule.service(PropertiesFileModule.java:58)
>        at org.apache.avalon.framework.container.ContainerUtil.service(ContainerUtil.java:182)
>        at org.apache.avalon.excalibur.component.DefaultComponentFactory.newInstance(DefaultComponentFactory.java:255)
>        at org.apache.avalon.excalibur.component.ThreadSafeComponentHandler.initialize(ThreadSafeComponentHandler.java:108)
>        at org.apache.avalon.excalibur.component.ExcaliburComponentSelector.addComponent(ExcaliburComponentSelector.java:703)
>        at org.apache.cocoon.components.ExtendedComponentSelector.configure(ExtendedComponentSelector.java:233)
>        at org.apache.avalon.framework.container.ContainerUtil.configure(ContainerUtil.java:240)
>        at org.apache.avalon.excalibur.component.DefaultComponentFactory.newInstance(DefaultComponentFactory.java:269)
>        at org.apache.avalon.excalibur.component.ThreadSafeComponentHandler.initialize(ThreadSafeComponentHandler.java:108)
>        at org.apache.avalon.excalibur.component.ExcaliburComponentManager.lookup(ExcaliburComponentManager.java:276)
>        at org.apache.cocoon.components.CocoonComponentManager.lookup(CocoonComponentManager.java:297)
>        at org.apache.cocoon.components.treeprocessor.variables.PreparedVariableResolver.getNewModuleToken(PreparedVariableResolver.java:192)
>        at org.apache.cocoon.components.treeprocessor.variables.PreparedVariableResolver.<init>(PreparedVariableResolver.java:117)
>        at org.apache.cocoon.components.treeprocessor.variables.VariableResolverFactory.getResolver(VariableResolverFactory.java:103)
>        at com.anwrt.cocoon.cvssource.source.CVSSourceFactory.getVariable(CVSSourceFactory.java:238)
>        at com.anwrt.cocoon.cvssource.source.CVSSourceFactory.configure(CVSSourceFactory.java:209)
>        at org.apache.avalon.framework.container.ContainerUtil.configure(ContainerUtil.java:240)
>        at org.apache.avalon.excalibur.component.DefaultComponentFactory.newInstance(DefaultComponentFactory.java:269)
>        at org.apache.avalon.excalibur.component.ThreadSafeComponentHandler.initialize(ThreadSafeComponentHandler.java:108)
>        at org.apache.avalon.excalibur.component.ExcaliburComponentSelector.addComponent(ExcaliburComponentSelector.java:703)
>        at org.apache.cocoon.components.ExtendedComponentSelector.configure(ExtendedComponentSelector.java:233)
>        at org.apache.avalon.framework.container.ContainerUtil.configure(ContainerUtil.java:240)
>        at org.apache.avalon.excalibur.component.DefaultComponentFactory.newInstance(DefaultComponentFactory.java:269)
>        at org.apache.avalon.excalibur.component.ThreadSafeComponentHandler.initialize(ThreadSafeComponentHandler.java:108)
>        at org.apache.avalon.excalibur.component.ExcaliburComponentManager.lookup(ExcaliburComponentManager.java:276)
>        at org.apache.cocoon.components.CocoonComponentManager.lookup(CocoonComponentManager.java:297)
>        at org.apache.avalon.framework.service.WrapperServiceManager.lookup(WrapperServiceManager.java:107)
>        at org.apache.excalibur.source.impl.SourceResolverImpl.service(SourceResolverImpl.java:132)
>        at org.apache.avalon.framework.container.ContainerUtil.service(ContainerUtil.java:182)
>        at org.apache.avalon.excalibur.component.DefaultComponentFactory.newInstance(DefaultComponentFactory.java:255)
>        at org.apache.avalon.excalibur.component.ThreadSafeComponentHandler.initialize(ThreadSafeComponentHandler.java:108)
>        at org.apache.avalon.excalibur.component.ExcaliburComponentManager.lookup(ExcaliburComponentManager.java:234)
>        at org.apache.cocoon.components.CocoonComponentManager.lookup(CocoonComponentManager.java:275)
>
>
>If I understand what is happening, cocoon is trying to initialize
>everything recursively. IOW, the getVariable method of CVSSource needs
>something from the component manager which is not ready until it is
>fully initialized... but what?
>
>Any hints? Thank you very much for your help.
>
>  
>
You guessed correctly ! :-)

IIRC, the guilty component is an InputModule (in your case, 
PropertiesFileModule).
There's also others InputModule (XMLMetaModule ?) trying to lookup a 
SourceResolver, which itself try to initialize CVSSourceFactory, which 
itself needs InputModule (via VariableResolver), etc etc...

Every time I want to use CVSSource in my project, I clean InputModule 
section and all works correctly after that.

Hope that helps,

Cédric

-- 
Cédric Damioli
IS Project Leader
CMS solutions
ANYWARE TECHNOLOGIES
Tel : +33 (0)5 61 00 52 90
Fax : +33 (0)5 61 00 51 46
http://www.anyware-tech.com


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org