Unable to resolve DataSource from OSGi Service Registry in Fabric managed container
Issue
In a Fabric managed environment we deploy one blueprint based OSGi bundle that exports its JDBC DataSource into the OSGi Service Registry.
We use configuration similar to
<bean id="mysql-ds" class="com.mysql.jdbc.jdbc2.optional.MysqlXADataSource">
<property name="databaseName" value="test"/>
<property name="url" value="jdbc:mysql://localhost/test_db?relaxAutoCommit=true" />
...
</bean>
<service id="MysqlDataSourceService" interface="javax.sql.XADataSource" ref="mysql-ds">
<service-properties>
<entry key="osgi.service.blueprint.compname" value="mysql-ds"/>
<entry key="osgi.jndi.service.name" value="jdbc/MysqlDataSource"/>
<entry key="datasource.name" value="mysql-ds"/>
...
</service-properties>
</service>
We then have another bundle that imports the JDBC DataSource using blueprint
<reference id="mysql-ds" interface="javax.sql.DataSource" filter="(datasource.name=mysql-ds)" />
Both bundles are referenced in the same Fabric profile definition.
When we deploy the Fabric profile to a container the deployment fails with
017-03-08 13:23:01,572 | ERROR | 6.0.1-1-thread-1 | DeploymentAgent | 86 - io.fabric8.fabric-agent - 1.2.0.redhat-630187 |
Unable to update agent org.osgi.service.resolver.ResolutionException: Unable to resolve root: missing requirement [root]
osgi.identity; osgi.identity=epfl-transaction; type=osgi.bundle; version="[1.0.0.SNAPSHOT,1.0.0.SNAPSHOT]";
resolution:=mandatory [caused by: Unable to resolve epfl-transaction/1.0.0.SNAPSHOT: missing requirement [epfl-transaction/1.0.0.SNAPSHOT]
osgi.service; effective:=active; filter:="(&(objectClass=javax.sql.DataSource)(datasource.name=mysql-ds))"]
However if we manually deploy these bundles on a standalone JBoss Fuse container (not Fabric managed) it works just fine.
Environment
- JBoss Fuse 6.3
- JBoss Fuse 6.2.x
- JBoss Fuse 6.1
- Fabric managed environment
Subscriber exclusive content
A Red Hat subscription provides unlimited access to our knowledgebase of over 48,000 articles and solutions.
Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.
