You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by "Grzegorz Kossakowski (JIRA)" <ji...@apache.org> on 2007/09/18 01:14:43 UTC

[jira] Commented: (COCOON-2106) DatabaseReader and SQLTransformer cannot obtain datasource

    [ https://issues.apache.org/jira/browse/COCOON-2106?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12528185 ] 

Grzegorz Kossakowski commented on COCOON-2106:
----------------------------------------------

I come to conclusion that registering wrappers automatically is rather troublesome and not worth the effort. The trouble comes from the fact that I wanted to register separate wrappers for existing beans that is not possible by using Spring XML extension because not all beans are parsed when extension is called.

That's why I decided to just implement simple wrapping bean that must be declared manually. The proper declaration would look like:
<bean name="org.apache.avalon.excalibur.datasource.DataSourceComponent/personnel"
            class="org.apache.cocoon.databases.bridge.spring.avalon.SpringToAvalonDataSourceWrapper">
  <property name="wrappedBean">
    <bean name="org.apache.avalon.excalibur.datasource.DataSourceComponent/personnel"
          class="org.springframework.jdbc.datasource.DriverManagerDataSource">
      (...)
    </bean>
  </property>
</bean>

Csaba, could you try if this works for you?

> DatabaseReader and SQLTransformer cannot obtain datasource
> ----------------------------------------------------------
>
>                 Key: COCOON-2106
>                 URL: https://issues.apache.org/jira/browse/COCOON-2106
>             Project: Cocoon
>          Issue Type: Bug
>          Components: Blocks: Databases
>    Affects Versions: 2.2-dev (Current SVN)
>            Reporter: Csaba Kazó
>            Assignee: Grzegorz Kossakowski
>         Attachments: dbreader.diff, sqltrans.diff
>
>
> The DatabaseReader and SQLTransformer components fail to obtain the configured data source and throw a ServiceException like "Component with 'org.apache.avalon.excalibur.datasource.DataSourceComponent/personnel' is not defined in this service manager. (Key='AvalonServiceManager')". The failing function call in both cases is:
> this.manager.lookup(DataSourceComponent.ROLE + '/' + datasourceName)
> The result is the same regardless of whether the data source is defined as an Avalon component or a Spring bean.
> Changing the code to use ServiceSelector as in the "Creating a Reader" document [1] and the modular database actions solves the problem for both cases. The attached patch applies this modification to DatabaseReader.java.
> [1] http://cocoon.zones.apache.org/daisy/cdocs/g1/g1/g2/g1/g2/681.html

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Re: [jira] Commented: (COCOON-2106) DatabaseReader and SQLTransformer cannot obtain datasource

Posted by Grzegorz Kossakowski <gk...@apache.org>.
Kazó Csaba pisze:
> Sure, I'll check it as soon as I can. As a matter of fact I tried it just now but the
> cocoon-databases-bridge block (which I guess I need now) won't start because its config [1]
> references the non-existent class
> org.apache.cocoon.core.container.spring.avalon.SpringToAvalonDataSourceBridge. (I believe it has
> been moved to the package org.apache.cocoon.databases.bridge.spring.avalon, at least based on a
> file search.)

You are right, I fixed that. Could you do svn up and give it another try.

Thanks.

-- 
Grzegorz Kossakowski
Committer and PMC Member of Apache Cocoon
http://reflectingonthevicissitudes.wordpress.com/

Re: [jira] Commented: (COCOON-2106) DatabaseReader and SQLTransformer cannot obtain datasource

Posted by Kazó Csaba <ka...@freemail.hu>.
> <bean name="org.apache.avalon.excalibur.datasource.DataSourceComponent/personnel"
>             class="org.apache.cocoon.databases.bridge.spring.avalon.SpringToAvalonDataSourceWrapper">
>   <property name="wrappedBean">
>     <bean name="org.apache.avalon.excalibur.datasource.DataSourceComponent/personnel"
>           class="org.springframework.jdbc.datasource.DriverManagerDataSource">
>       (...)
>     </bean>
>   </property>
> </bean>
> 
> Csaba, could you try if this works for you?

Sure, I'll check it as soon as I can. As a matter of fact I tried it just now but the cocoon-databases-bridge block (which I guess I need now) won't start because its config [1] references the non-existent class org.apache.cocoon.core.container.spring.avalon.SpringToAvalonDataSourceBridge. (I believe it has been moved to the package org.apache.cocoon.databases.bridge.spring.avalon, at least based on a file search.)

Csaba

[1] http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-databases/cocoon-databases-bridge/src/main/resources/META-INF/cocoon/spring/SpringToAvalonDataSourceBridge.xml?view=markup