The depend-on flag on the bean element can be used for that.
The JPA 2.x Aries bundles should solve the service dependency problem and
be better integrated with the pax-jdbc config stuff.

2016-07-11 9:37 GMT+02:00 jochenw <jochen.walz.m...@googlemail.com>:

> Hello,
>
> start levels have been removed for a number of bundles in the Karaf
> enterprise features. In principle a good idea (sometimes start levels are
> even seen as anti-pattern in OSGi).
>
> However, sometimes I now face the issue that the transaction service is
> missing when one of my persistence bundle start up, and some initial
> writing
> to the DB fails (currently, I don't have the stack trace available, but it
> says "no transaction associated with this thread"). Is does not happen
> every
> time (looks more frequent if the machine is busy with other things, or on
> devices with restricted computing power). Giving the data source /
> persistence bundles higher start levels than 80 does not help.
>
> I'm using pax-jdbc to create the data source (however, not pax-jdbc-config,
> since also that turned out too slow sometimes to create the data sources
> before the persistence bundles started).
>
> Might be a dumb question: how can make the data source bundle (data source
> created via blueprint.xml) waiting for the transaction manager being
> available? And / or (even better, since then I could switch to using
> pax-jdbc-config for creation of the data source): how can I make my
> persistence bundles waiting for the datasource being available? I only have
> the blueprint.xml (for the data source) and the persistence.xml (for the
> persistence unit), and currently don't see a possibility to make them wait
> for their dependencies.
>
> Currently, I'm using JPA 1.0.4, transaction 1.3.0.
>
> From my datasource blueprint.xml:
>
>         <bean id="myXADataSource"
> class="org.apache.commons.dbcp2.managed.BasicManagedDataSource"
>                 destroy-method="close">
>                 <property name="url" value="${url}" />
>                 <property name="username" value="${userName}" />
>                 <property name="password" value="${password}" />
>                 <property name="driverClassName"
> value="org.postgresql.Driver" />
>                 <property name="initialSize" value="10" />
>                 <property name="maxTotal" value="50" />
>                 <property name="maxIdle" value="20" />
>                 <property name="transactionManager"
> ref="transactionManager" />
>         </bean>
>
>         <reference id="transactionManager"
> interface="javax.transaction.TransactionManager" />
>
>
> Regards,
> Jochen
>
>
>
>
>
> --
> View this message in context:
> http://karaf.922171.n3.nabble.com/Removal-of-start-levels-from-Karaf-4-0-2-onwards-transaction-manager-not-available-in-time-tp4047189.html
> Sent from the Karaf - User mailing list archive at Nabble.com.
>



-- 
------------------------
Guillaume Nodet
------------------------
Red Hat, Open Source Integration

Email: gno...@redhat.com
Web: http://fusesource.com
Blog: http://gnodet.blogspot.com/

Reply via email to