On 24.05.2004 14:22, Christoph Ender wrote:

I'm trying to implement a simple Action that has to access a datasource.
The datasource itself is okay (queries via SQL Transformer work) and I've
also successfully implemented a simple Action that doesn't use the database.


When trying to lookup org.apache.avalon.excalibur.datasource.DataSourceComponentSelector
via the ServiceManager I get a ClassCastException. I've copied over as much
code I could get from examples, but it looks like I'm still doing something wrong. I'll
post the relevant lines here:

...

The last line that assigns the ComponentSelector to selector fails with the
ClassCastExceoption. The ServiceManager is correctly initialized by the
service(ServiceManager) method (it gets called correctly) and the ServiceManager
returns a "true" value when calling
hasService(org.apache.avalon.excalibur.datasource.DataSourceComponentSel ector).

A ServiceManager does not return a ComponentSelector, but a ServiceSelector, so you must cast to SS instead of CS. Even if the implementation class only implements CS this works, as a wrapper is build around it.


Joerg

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to