Adrian Geissel wrote: > > Hi, > > We looking at migrating our application from C1.8.2 over to C2. > > In C1.x, we used Turbine for connection pooling, and we need to move over to > the Avalon CoponentManager framework. > > There was one real advantage in using Turbine, where there is a > singleton-access to the connection-pool, thereby allowing it to be easily > integrated with external code. Basically, we have a tried-and-tested > database access library that takes utilises an internal ConnectionFactory > that calls into Turbine for its connections. > > I have not found a similar factory method for accessing either the Cocoon > object, its ComponentManager, or any managed components. Have I missed > something, or is there a preferred approach? A non-singleton access to the > connection pool will require a potentially reasonable coding change. > > Also, having a little difficulty in configuring a pooled connection to > PostgreSQL - I've followed the instructions in the 'datasources' document, > but the ComponentManager complains that the named component cannot be found. > I've included the relevant bits from both cocoon.xconf, the calling code > (from within an Action) and log-file extract. > > Any and all help will be greatly appreciated, > Many thanks > Adrian > > ========== cocoon.xconf extract ============== > <markup-languages> > <!-- Removed for clarity --> > </markup-languages>
<datasources> <jdbc name="zdam"> <pool-controller min="2" max="10"/> <auto-commit>false</auto-commit> <!-- Supply the correct class name. The instructions tell you to place this in web.xml, but this is now possible --> <driver>org.postgresql.driver.JDBCDriver</driver> <dburl>jdbc:postgesql://193.120.120.11/zdam_test</dburl> <user>sql</user> <password>garfield</password> </jdbc> </datasources> > > <!-- > <datasources> > --> > <component > name="org.apache.avalon.excalibur.datasource.DataSourceComponentSelector" > class="org.apache.cocoon.CocoonComponentSelector"> > <!-- Data source details for the ZDAM database --> > <component-instance name="zdam" > class="org.apache.avalon.util.datasource.JdbcDataSource"> > <pool-controller min="2" max="10"/> > <auto-commit>false</auto-commit> > <dburl>jdbc:postgresql://193.120.120.11/zdam_test</dburl> > <user>sql</user> > <password>garfield</password> > </component-instance> > </component> > > <!-- > </datasources> > --> > > ========== cocoon.xconf extract ============== > > ========== calling code extract ============== > > ComponentSelector selector = (ComponentSelector) > manager.lookup(org.apache.cocoon.Roles.DB_CONNECTION); > ConnectionFactory.dataSource = (DataSourceComponent) > selector.select("zdam"); > > ========== calling code extract ============== > > ========== log-file extract ============== > org.apache.avalon.framework.component.ComponentException: UnnamedSelector: > ComponentSelector could not find the component for hint: zdam > at > org.apache.avalon.excalibur.component.ExcaliburComponentSelector.select(Exca > liburComponentSelector.java:239) > at > com.zenark.zdam.cocoon.action.DoUserLoginAction.compose(DoUserLoginAction.ja > va:102) > at > org.apache.avalon.excalibur.component.DefaultComponentFactory.newInstance(De > faultComponentFactory.java:98) > at > org.apache.avalon.excalibur.component.ThreadSafeComponentHandler.initialize( > ThreadSafeComponentHandler.java:81) > at > org.apache.avalon.excalibur.component.ExcaliburComponentSelector.addComponen > t(ExcaliburComponentSelector.java:383) > at > org.apache.cocoon.sitemap.AbstractSitemap.load_component(AbstractSitemap.jav > a:231) > at > org.apache.cocoon.www.sitemap_xmap$Configurer.configActions(sitemap_xmap.jav > a:929) > at org.apache.cocoon.www.sitemap_xmap.configure(sitemap_xmap.java:276) > at > org.apache.avalon.excalibur.component.DefaultComponentFactory.newInstance(De > faultComponentFactory.java:108) > at > org.apache.avalon.excalibur.component.ThreadSafeComponentHandler.initialize( > ThreadSafeComponentHandler.java:81) > at > org.apache.cocoon.components.language.generator.GeneratorSelector.addGenerat > or(GeneratorSelector.java:118) > at > org.apache.cocoon.components.language.generator.ProgramGeneratorImpl.addComp > iledComponent(ProgramGeneratorImpl.java:292) > at > org.apache.cocoon.components.language.generator.ProgramGeneratorImpl.generat > eResource(ProgramGeneratorImpl.java:273) > at > org.apache.cocoon.components.language.generator.ProgramGeneratorImpl.load(Pr > ogramGeneratorImpl.java:179) > at org.apache.cocoon.sitemap.Handler.run(Handler.java:204) > at java.lang.Thread.run(Thread.java:484) > > ========== log-file extract ============== > > --------------------------------------------------------------------- > Please check that your question has not already been answered in the > FAQ before posting. <http://xml.apache.org/cocoon/faqs.html> > > To unsubscribe, e-mail: <[EMAIL PROTECTED]> > For additional commands, e-mail: <[EMAIL PROTECTED]> --------------------------------------------------------------------- Please check that your question has not already been answered in the FAQ before posting. <http://xml.apache.org/cocoon/faqs.html> To unsubscribe, e-mail: <[EMAIL PROTECTED]> For additional commands, e-mail: <[EMAIL PROTECTED]>