I have a very strange problem (in Karaf 4.3.6). I use JPA and have a bundle
containing a persistence.xml in which a datasource is referenced:

  <jta-data-source>osgi:service/javax.sql.DataSource/(osgi.jndi.service.name
=jdbc/filetransferhistoryjta)</jta-data-source>

If the datasource is not available when I install this bundle then I will
get an error complaining that the datasource is not present. The strange
thing is that it seems to be dependent on how I install this bundle -
directly installing the bundle or doing it via a feature. In the first case
it works but in the latter it doesn't.

If I first install all the prerequisites I need and then issue the
following command in the Karaf shell:

  bundle:install -s
mvn:se.digia.connect.services.filetransfer/history-domain/3.1-SNAPSHOT

Then it works fine. It even works if I remove the "-s" and start the bundle
afterwards instead.

However, if I use the following feature:

  <feature name="connect-filetransfer-history-db" version="3.1-SNAPSHOT">

<bundle>mvn:se.digia.connect.services.filetransfer/history-domain/3.1-SNAPSHOT</bundle>
  </feature>

And then issue the following command:

  feature:install connect-filetransfer-history-db

Then the datasource cannot be found and the install fails. This happens
consistently. I am using Pax-Jdbc for exposing the datasource via JNDI.

First I thought that there might be a timing problem and that you have to
wait a while to get the datasource published but it doesn't seem to have
anything to do with that at all. I can wait 5 minutes after installing the
datasource. I also check with the command "jndi:names" that it is
published. But it still doesn't work using a feature.

Can anyone tell me what is being done differently when I use a feature
compared to when I just install the bundle directly? There is apparently
some kind of difference.

/Bengt

Reply via email to