You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@karaf.apache.org by ksobkowiak <kr...@gmail.com> on 2013/01/17 09:12:23 UTC

Re: datasources and their reference in blueprint.xml?

Hi Noam

What kind of error do you have in case you try to deploy the both blueprints
in one bundle? I suppose the blueprint context can not be started. 

If you reference the datasource in blueprint.xml from the service registry
the blueprint extender waits with instantiation of the context until the
datasource is available in the service registry, but the datasource is not
available, because the blueprint context has not been completely
bootstrapped yet. 

Perhaps someone more advanced in blueprint will correct me if I am wrong. I
am not sure if registering and  referencing a service in one bundle is
correct.

If you deploy the data source separately in the deploy directory, a new
bundle is created automatically for this blueprint and the datasource is
registered in the service registry. You can install your bundle correctly,
because the datasource service is alredy available in the registry. 

If you deploy the data source service together with the functionality which
uses the service you lose the power of the service registry. Please
reference the bean "sqlDataSource" in the "DataSourceHolder" instead of the
"emDataSource" reference, or deploy the datasource in a separate bundle so
you can replace it with another one without affecting your
"DataSourceHolder". 

If you still want to deploy the both xml files in one bundle you cantry to
define the availability of the reference "emDataSource" as optional
(availability="optional") - in this case the dependency need not be resolved
during initialization.



Best regards
Krzysztof



--
View this message in context: http://karaf.922171.n3.nabble.com/datasources-and-their-reference-in-blueprint-xml-tp4027199p4027363.html
Sent from the Karaf - User mailing list archive at Nabble.com.