The code is similar to an example on documentation on cocoon.
This code works fine with 2.1.4.

RG

Il giorno 08/ott/2009, alle ore 11.20, Thorsten Scherler ha scritto:

On Thu, 2009-10-08 at 10:22 +0200, roberto graiff wrote:
Hi all , I'm some trouble to write CustomGenerator with cocoon 2.1.10.
It work fine with 2.1.4.

A snippet of code:






public class DatabaseGenerator extends ServiceableGenerator
implements CacheableProcessingComponent, Disposable {


...
...


@Override
public void service(ServiceManager manager) throws ServiceException {
  super.service(manager);


ComponentSelector selector =
(ComponentSelector)manager.lookup(DataSourceComponent.ROLE +
"Selector"); ----  this line throw an exception

Hmm, it seems you want
org.apache.cocoon.components.treeprocessor.sitemap.ComponentsSelector

Mind the plural on the Component part.

HTH

salu2

  this.datasource = (DataSourceComponent)
selector.select(this._datasource);
conn = this.datasource.getConnection();


}


....
...
.....
......


}








When call a generator cocoon throw an exception when try to obtain the
ComponentSelector:




java.lang.ClassCastException:
org.apache.avalon.framework.service.WrapperServiceSelector
at
sidera.cocoon.generation.DatabaseGenerator.generate (DatabaseGenerator.java:127)
at
org.apache.cocoon.components.pipeline.AbstractProcessingPipeline.processXMLPipeline (AbstractProcessingPipeline.java:579)
at
org.apache.cocoon.components.pipeline.impl.AbstractCachingProcessingPipeline.processXMLPipeline (AbstractCachingProcessingPipeline.java:279)
at
org.apache.cocoon.components.pipeline.AbstractProcessingPipeline.process (AbstractProcessingPipeline.java:780)
at
org.apache.cocoon.components.source.impl.SitemapSource.toSAX (SitemapSource.java:413)
at
org.apache.cocoon.components.source.SourceUtil.toSAX (SourceUtil.java:101)
at
org.apache.cocoon.components.source.SourceUtil.parse (SourceUtil.java:321)










Any suggestion ??


Regards


RG


--
Thorsten Scherler <thorsten.at.apache.org>
Open Source Java <consulting, training and solutions>

Sociedad Andaluza para el Desarrollo de la Sociedad
de la Información, S.A.U. (SADESI)





---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to