That's not a problem with the service itself, that's a missing requirement.
You can see how it works in Karaf jpa example: the capability is defined in the features providing the datasource: https://github.com/apache/karaf/blob/master/examples/karaf-jpa-example/karaf-jpa-example-features/src/main/feature/feature.xml#L28 So, nothing related to service itself at runtime, just cap/req matching. Regards JB On 02/11/2019 16:09, Steinar Bang wrote: >>>>>> Steinar Bang <[email protected]>: > >> It will certainly simplify this project (and make it less bound to >> postgresql), and I will try it there: >> https://github.com/steinarb/sonar-collector > > I've added pax-jdbc-config setup to the template feature.xml > > https://github.com/steinarb/scratch/blob/sonar-collector/use-pax-jdbc-config/sonar-collector-webhook/src/main/feature/feature.xml#L5 > > The DataSource is created (it seems) but not matched with the > @Reference. > > The initial install fails with: > Error executing command: Unable to resolve root: missing requirement [root] > osgi.identity; osgi.identity=sonar-collector-webhook-with-postgresql; > type=karaf.feature; version="[0,0.0.0]"; > filter:="(&(osgi.identity=sonar-collector-webhook-with-postgresql)(type=karaf.feature)(version>=0.0.0)(version<=0.0.0))" > [caused by: Unable to resolve sonar-collector-webhook-with-postgresql/0.0.0: > missing requirement [sonar-collector-webhook-with-postgresql/0.0.0] > osgi.identity; osgi.identity=sonar-collector-webhook; type=karaf.feature > [caused by: Unable to resolve sonar-collector-webhook/1.0.1.SNAPSHOT: missing > requirement [sonar-collector-webhook/1.0.1.SNAPSHOT] osgi.identity; > osgi.identity=no.priv.bang.sonar.sonar-collector-webhook; type=osgi.bundle; > version="[1.0.1.SNAPSHOT,1.0.1.SNAPSHOT]"; resolution:=mandatory [caused by: > Unable to resolve no.priv.bang.sonar.sonar-collector-webhook/1.0.1.SNAPSHOT: > missing requirement > [no.priv.bang.sonar.sonar-collector-webhook/1.0.1.SNAPSHOT] osgi.service; > effective:=active; > filter:="(&(objectClass=javax.sql.DataSource)(osgi.jndi.service.name = > jdbc/sonar-collector))"]]] > > Command and error message here: > https://gist.github.com/steinarb/f216c322d7428b4c9e835b6ca9a77168 > > I try installing the feature creating the DataSource service, and as far > as I can tell it creates the service and has the correct > osgi.jndi.service.name: > https://gist.github.com/steinarb/402d4af50cd56014b8bf70e17897771c > > At this point I know I have a DataSource service present with (as far as > I can tell) the correct value in the osgi.jndi.service.name, so I try > installing the feature that needs the service (ie. feature name > sonar-collector-webhook), but it fails with unable to match the > DataSource service: > https://gist.github.com/steinarb/77db0de552f2bacf478a533baf1558c9 > > I tried to install the feature sonar-collector-webhook-with-postgresql > again, but got the same error as other two install attempts. > > Any ideas? > > -- Jean-Baptiste Onofré [email protected] http://blog.nanthrax.net Talend - http://www.talend.com
