Hello If you're moving from Fuse 6 to Karaf, you have to do few (or even more) things manually - that's why Fuse 6 did it for you in the first place ;)
Karaf 4's approach to Data Sources is through much improved Pax JDBC project and you should rather manage your data sources using DataSourceFactory - that's standard OSGi service (org.osgi.service.jdbc) implemented by Pax JDBC. Karaf manual provides a link to examples: https://github.com/apache/karaf/blob/main/examples/karaf-jdbc-example/README.md About "missing requirement [my-test-26-karaf-2-routes/0.0.1.SNAPSHOT] osgi.service; effective:=active" that's (from my ~9 years experience with OSGi) one of the most confusing and discouraging things in OSGi. This is an error from "bundle resolver" which prevents resolving a bundle because "a service" is not available. What's wrong with this? because there are two "layers" or "spaces" mixed - bundle (module) and a service. OSGi promises you that services are highly dynamic, while bundles (modules) are more static. IMO preventing a resolution of a bundle because a service is missing (I saw cases that the service was being registered from this very bundle itself!) is simply wrong. Fortunately maven-bundle-plugin (and bnd itself) has option to "fix" this - I always use (especially for data source / JPA) bundles this header: <_removeheaders>Import-Service</_removeheaders> this way, the bundle won't contain it and (OSGi) resolver won't complain. regards Grzegorz Grzybek czw., 20 paź 2022 o 19:28 Ephemeris Lappis <[email protected]> napisał(a): > Hello. > > We are working on an old Fuse 6.3, and my current work is about > porting our works from Fuse to Karaf. > > So,yes, I'd like to manage my DB configurations using "off the self" > features if possible, and avoid creating hybrid ones... > > Do you mean the bundle I've tested and seemed to work is not the good > one, and I should use > org.apache.aries.transaction:org.apache.aries.transaction.jdbc:2.1.3. > > On Karaf 4.4.1 the connector feature seems to be poor, and if I'm not > wrong it doesn't provide this bundle : > karaf@root()> feature:info connector > Feature connector 3.1.1 > Description: > OSGi support for JCA Connector 1.6 > Details: > OSGi support for JCA Connector 1.6 > Feature has no configuration > Feature has no configuration files > Feature depends on: > transaction [2,3) > Feature contains followed bundles: > mvn:org.apache.geronimo.specs/geronimo-j2ee-connector_1.6_spec/1.0 > mvn:org.apache.geronimo.specs/geronimo-validation_1.0_spec/1.1 > mvn:org.apache.geronimo.components/geronimo-connector/3.1.4 > Feature has no conditionals. > > What should I do : add a direct dependency on the bundle, look for a > better feature ? > > What's strange, is that the bundle I found seemed to work when > installing it manually on a karaf instance, but something is wrong > when I add it as a dependency in my DB feature. The Camel routes > bundle fails with that error : > > Caused by: org.apache.felix.resolver.reason.ReasonException: Unable to > resolve my-test-26-karaf-2-routes/0.0.1.SNAPSHOT: missing requirement > [my-test-26-karaf-2-routes/0.0.1.SNAPSHOT] osgi.service; > effective:=active; > filter:="(&(objectClass=javax.sql.DataSource)(osgi.jndi.service.name > =jdbc/fifi))" > > However, The 2 DataSource services are present, one with the > javax.sql.DataSource interface and both with the right > osgi.jndi.service.name=jdbc/fifi... > > Any idea ? > > Thanks for your help. > > Regards. > > > Le jeu. 20 oct. 2022 à 17:57, Grzegorz Grzybek <[email protected]> a > écrit : > > > > Hello > > > > > > czw., 20 paź 2022 o 17:54 Ephemeris Lappis <[email protected]> > napisał(a): > >> > >> Hello again. > >> > >> Looking at my old Fuse installations I found that the bundle that > >> wraps XADatasource services is > >> > "mvn:org.apache.aries.transaction/org.apache.aries.transaction.wrappers/1.0.0". > >> Installing it manually, it seems to wrap my XADataSource into a simple > >> "XA aware" DataSource. Now I can see the 2 services : > > > > > > Which Fuse version do you mean? > > > >> > >> > >> [javax.sql.DataSource] > >> ---------------------- > >> aries.xa.aware = true > >> aries.xa.name = xa-fifi > >> aries.xa.pooling = true > >> aries.xa.poolMaxSize = 10 > >> aries.xa.poolMinSize = 3 > >> datasource.name = postgresql-fifi > >> osgi.jndi.service.name = jdbc/fifi > >> osgi.service.blueprint.compname = dsBean > >> service.bundleid = 124 > >> service.id = 251 > >> service.ranking = 1000 > >> service.scope = singleton > >> Provided by : > >> Fifi-T26 :: DB (124) > >> Used by: > >> Fifi-T26 :: Camel (186) > >> System Bundle (0) > >> > >> [javax.sql.XADataSource] > >> ------------------------ > >> aries.xa.name = xa-fifi > >> aries.xa.pooling = true > >> aries.xa.poolMaxSize = 10 > >> aries.xa.poolMinSize = 3 > >> datasource.name = postgresql-fifi > >> osgi.jndi.service.name = jdbc/fifi > >> osgi.service.blueprint.compname = dsBean > >> service.bundleid = 124 > >> service.id = 210 > >> service.scope = bundle > >> Provided by : > >> Fifi-T26 :: DB (124) > >> Used by: > >> Fifi-T26 :: DB (124) > >> System Bundle (0) > >> > >> And my Camel routes seem to get the expected DataSource and run as > >> expected... at least for elementary tests. > >> > >> So, my question is now : Instead of setting this bundle as a > >> dependency of my service feature, is there an existing Karaf feature > >> that could be more suitable to be a dependency ? > > > > > > In Fuse 6 there's "connector" feature: > > > > <feature name="connector" description="OSGi support for JCA > Connector 1.6" version="3.1.1" resolver="(obr)"> > > <details>OSGi support for JCA Connector 1.6</details> > > <feature version="[1.1,2)">transaction</feature> > > <bundle > dependency="true">mvn:org.apache.geronimo.specs/geronimo-j2ee-connector_1.6_spec/1.0</bundle> > > <bundle > dependency="true">mvn:javax.validation/validation-api/1.1.0.Final-redhat-1</bundle> > > > <bundle>mvn:org.apache.geronimo.components/geronimo-connector/3.1.1</bundle> > > <bundle > start-level="30">mvn:org.apache.aries.transaction/org.apache.aries.transaction.jdbc/2.1.3</bundle> > > </feature> > > > > And the "wrapping" is done by org.apache.aries.transaction.jdbc. > > > > Are you thinking about configuring it correctly in Karaf or in Fuse? > > > > regards > > Grzegorz Grzybek > > > >> > >> > >> Thanks again. > >> > >> Regards. > >> > >> > >> Le jeu. 20 oct. 2022 à 14:46, Ephemeris Lappis > >> <[email protected]> a écrit : > >> > > >> > Hello. > >> > > >> > I'm trying to configure a XADataSource exposed by a bundle and a > >> > feature. (see the attachment). > >> > > >> > The bundle is a single blueprint that creates the PostgreSQL XA > >> > DataSource and exposes it as a service. > >> > > >> > I set Aries XA properties to let Aries wrapping my datasource : I hope > >> > this works in my case. At the bundle level, > >> > > >> > The service appears like that : > >> > [javax.sql.XADataSource] > >> > ------------------------ > >> > aries.xa.name = xa-fifi > >> > aries.xa.pooling = true > >> > aries.xa.poolMaxSize = 10 > >> > aries.xa.poolMinSize = 3 > >> > datasource.name = postgresql-fifi > >> > osgi.jndi.service.name = jdbc/fifi > >> > osgi.service.blueprint.compname = dsBean > >> > service.bundleid = 124 > >> > service.id = 210 > >> > service.scope = bundle > >> > Provided by : Fifi-T26 :: DB (124) > >> > Used by: > >> > System Bundle (0) > >> > > >> > My feature (see attachment), declares a non-XA DataSource capability, > >> > what is perhaps wrong... > >> > > <capability>osgi.service;objectClass=javax.jdbc.DataSource);effective:=active</capability> > >> > > >> > Should I declare a double capability with XADataSource ? > >> > > >> > But my Camel routes bundle references a jaxa.sql.DataSource service > >> > with the needed jndi name, but fails with this error message. > >> > > >> > Unable to start container for blueprint bundle > >> > my-test-26-karaf-2-routes/0.0.1.SNAPSHOT due to unresolved > >> > dependencies [(&(osgi.jndi.service.name > =jdbc/fifi)(objectClass=javax.sql.DataSource))] > >> > > >> > The same pattern works on Red-Hat Fuse with a XADataSource exposed > >> > service and a DataSource reference in the routes bundles, because > >> > Aries TM is wrapping the service to auto-enlist connections in JTA > >> > transactions... > >> > > >> > What's wrong here ??? > >> > Someone with any experience on transactions ? > >> > > >> > Thanks in advance. > >> > > >> > Regards. > >> > > >> > > >> > I expect Aries to wrap ml >
