DataSourceSelector how to config??

Mike Schubert <[email protected]>
Newsgroups gmane.comp.jakarta.avalon.user
Organization interface projects GmbH Dresden
Message-ID <[email protected]>
Hallo,

i use the "cornerstore"  DataSourceSelector (better "i would...")
but it work not so as i thought.

I configure a block.xml like this:
------------------------------------------------------------------
<include name="dataSource" id="cornerstone-datasources:cornerstone-datasources-impl" version="1.0">
    <configuration> 
    	<data-sources>
	    <data-source name="oracledb" class="org.apache.avalon.excalibur.datasource.JdbcDataSource">
		<pool-controller min="5" max="20">
		     <keep-alive>select 1</keep-alive>
		</pool-controller>
		<auto-commit>true</auto-commit>
		<driver>oracle.jdbc.driver.OracleDriver</driver>
		<dburl>jdbc:oracle:thin:@...</dburl>
		<user>...</user>
		<password>...</password>
	   </data-source>
	</data-sources>
    </configuration> 
</include>
	
<component name="sqltest" class="de.ifbus.p10_0050.server.comp.sql.SQLAbfrageTestComponent">
   <dependencies>
        <dependency key="sqlabfrage" source="dataSource"/>
   </dependencies>
</component>
------------------------------------------------------------------

My service methode in SQLAbfrageTestComponent looks like:
------------------------------------------------------------------
    /**
     * ...
     * @avalon.dependency type="org.apache.avalon.excalibur.datasource.DataSourceComponent"
     *                    key="sqlabfrage"
     */
    public void service(ServiceManager manager) throws ServiceException {
       DataSourceSelector datasources = (DataSourceSelector) manager.lookup("sqlabfrage");
       DataSourceComponent datasource = (DataSourceComponent) datasources.select("oracledb");
       ...
------------------------------------------------------------------

But i get the failure:
------------------------------------------------------------------
[DEBUG  ] (kernel): state: initialized
---- exception report ----------------------------------------------------------
Exception: org.apache.avalon.merlin.KernelException
Message: Kernel startup failure.
---- cause ---------------------------------------------------------------------
Exception: org.apache.avalon.merlin.KernelException
Message: Cannot deploy application.
---- cause ---------------------------------------------------------------------
Exception: org.apache.avalon.activation.LifecycleException
Message: Unable to create a new component instance in appliance [/p10_0050/sqltest] due to a component deployment failure.
---- cause ---------------------------------------------------------------------
Exception: org.apache.avalon.framework.service.ServiceException
Message: Unable to provide DataSourceComponent for oracledb (Key='oracledb')
---- stack trace ---------------------------------------------------------------
org.apache.avalon.framework.service.ServiceException: Unable to provide DataSourceComponent for oracledb (Key='oracledb')
org.apache.avalon.cornerstone.blocks.datasources.DefaultDataSourceSelector.select(DefaultDataSourceSelector.java:224)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
java.lang.reflect.Method.invoke(Method.java:324)
org.apache.avalon.activation.impl.ApplianceInvocationHandler.invoke(ApplianceInvocationHandler.java:129)
$Proxy1.select(Unknown Source)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
java.lang.reflect.Method.invoke(Method.java:324)
org.apache.avalon.activation.impl.BlockInvocationHandler.invoke(BlockInvocationHandler.java:108)
$Proxy0.select(Unknown Source)
de.ifbus.p10_0050.server.comp.sql.SQLAbfrageTestComponent.service(SQLAbfrageTestComponent.java:47)
org.apache.avalon.framework.container.ContainerUtil.service(ContainerUtil.java:143)
org.apache.avalon.activation.impl.DefaultComponentFactory.incarnation(DefaultComponentFactory.java:325)
org.apache.avalon.activation.impl.DefaultComponentFactory.incarnate(DefaultComponentFactory.java:130)
org.apache.avalon.activation.impl.SingletonLifestyleManager.refreshReference(SingletonLifestyleManager.java:144)
org.apache.avalon.activation.impl.SingletonLifestyleManager.commission(SingletonLifestyleManager.java:60)
org.apache.avalon.activation.impl.DefaultAppliance.commission(DefaultAppliance.java:94)
org.apache.avalon.activation.impl.DefaultRuntime.commission(DefaultRuntime.java:86)
org.apache.avalon.composition.model.impl.DefaultSystemContext.commission(DefaultSystemContext.java:362)
org.apache.avalon.composition.model.impl.DefaultDeploymentModel.commission(DefaultDeploymentModel.java:122)
org.apache.avalon.composition.model.impl.Commissioner.run(Commissioner.java:185)
java.lang.Thread.run(Thread.java:534)
------------------------------------------------------------------

Can anybody help me? 
I think i configured the component right.....

Thanks,

-- 
sincerely

Mike Schubert

"FreeBSD is like a wigwam, no windows, no gates and an apache inside."
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.