Finally I sow the exact class.
And I got the connection: 

WrapperServiceSelector selector =(WrapperServiceSelector) getComponent(DataSourceComponent.ROLE +

"Selector");

DataSourceComponent dataSource = (DataSourceComponent) selector.select(

"connection");

Connection conexion = dataSource.getConnection();

Thank you very much.
 

 



 
On 11/16/05, Torsten Curdt <[EMAIL PROTECTED]> wrote:
> Hi.
> I'm using cocoon 2.1.7. In a  javaflow class. I have this code:
> if
>
> ( getComponent( DataSourceComponent.ROLE + "Selector")instanceof
> ComponentSelector);
> {
>
>
> ComponentSelector selector = (ComponentSelector) getComponent
> (DataSourceComponent.ROLE + "Selector");
> }
>
> But I obtain:
>
> ERROR   (2005-11-16) 09:38.57:718   [sitemap.handled-errors] (/
> mysis/login.do) http-8080-Processor25/ErrorHandlerHelper:
> java.lang.ClassCastException

Hm... try something like this (from the top of my head)

Object o = getComponent(DataSourceComponent.ROLE + "Selector");

System.out.println(o.getClass() + "@" + o.getClass().getClassLoader());
System.out.println(ComponentSelector.class + "@" +
ComponentSelector.class.getClassLoader());

That way you should see the exact class being returned as well
as the classloader that has loaded it.

> But I don't know how to do this in a java flow.

Just like you would do in an action.

HTH

cheers
--
Torsten