aries-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Brunner Basil <>
Subject Blueprint service dependencies
Date Thu, 19 Apr 2012 15:34:17 GMT

I have two OSGi bundles The first one contains only a Blueprint data source definition:

<blueprint xmlns="">

  <bean id="dataSource" class="org.h2.jdbcx.JdbcDataSource">
    <property name="URL" value="jdbc:h2:db/database" />

  <service interface="javax.sql.DataSource" ref="dataSource">
      <entry key="" value="jdbc/database" />


The second bundle contains a JPA persistence file and a blueprint file:

<persistence xmlns=""
  xmlns:xsi="" version="1.0">

  <persistence-unit name="CaptureAgentCore" transaction-type="JTA">


<blueprint default-activation="eager"
  xmlns="" xmlns:xsi=""
  xmlns:jpa="" xmlns:tx="">

  <bean id="SchedulerService" class="ch.entwine.captureagent.scheduler.Scheduler">
    <jpa:context property="entityManager" unitname="CaptureAgentCore" />
    <tx:transaction method="*" value="Required" />

  <service ref="SchedulerService" interface="ch.entwine.captureagent.scheduler.Scheduler"
depends-on="dataSource" />

I ran into the problem that the data source is not yet registered when the JPA entity manager
tries to get a reference to it. Error message:

2012-04-19 16:17:38 ERROR (DelayedLookupDataSource:57) No JTA datasource could be located
using the JNDI name osgi:service/javax.sql.DataSource/(
javax.naming.NameNotFoundException: osgi:service/javax.sql.DataSource/"("

I've now tried to set the 'depends-on' attribute on the SchedulerService definition in the
blueprint file of bundle two (see above). Unfortunately I get the following error now:

17:19:09 ERROR (BlueprintContainerImpl:348) Unable to start blueprint container for bundle
org.osgi.service.blueprint.container.ComponentDefinitionException: Unresolved ref/idref to
component: dataSource

So, my question is how I can make sure the data source gets registered before the JPA entity
manager gets started?

Thanks for your help!

View raw message