Hello.

For sure, I didn't get your point about capabilities. As in my case
the JMS and JDBC services are provided by features outside of the
scope of all my applicative bundles and features, how do you consider
I should provide a "capability" for them, and thus let the resolver
satisfied ? I've seen your example with a feature group where a JDBC
service is "self provided" by one feature. How can I tell the feature
resolver that the capabilities for my two service references are going
to be provided by other means ?

Thanks a lot for your help and "teaching" (I'm sure others also need
lessons about features and capabilities) !

Regards.

Le jeu. 25 août 2022 à 16:06, Jean-Baptiste Onofré <j...@nanthrax.net> a écrit :
>
> Hi,
>
> It's normal that the bundle works outside of the feature: it's the
> feature resolver who checks the requirements/capabilities of the
> bundles/features.
>
> And you didn't get my point: the fact that a ConnectionFactory service
> is there or not at runtime doesn't matter. The most important is to
> have a bundle/feature that provides the service capability (not the
> service itself).
>
> Regards
> JB
>
> On Thu, Aug 25, 2022 at 1:45 PM Ephemeris Lappis
> <ephemeris.lap...@gmail.com> wrote:
> >
> > Hello.
> >
> > You've probably not seen my own answers on the post to update it with
> > my last tests :
> > - the bundle has no problem when installed out of the feature, and I
> > think the service manifest itself is not the issue
> > - In this manifest, I understand the requirement on the jms service,
> > but the existing connection factory should satisfy it
> > - why the similar jdbc datasource requirement is processed as expected
> > and doesn't lead to a similar issue ?
> > - Disabling the serviceRequirements in the feature configuration, the
> > feature installer works as expected.
> >
> > I agree with you, I'm going to post a new message on the Karaf list.
> >
> > Do you think that in my new post I should mention a Karaf feature
> > installer's (its "resolver") issue, since the bundle installer has no
> > problem finding the existing services to satisfy requirements ?
> >
> > Thanks again.
> >
> > Le jeu. 25 août 2022 à 07:23, Jean-Baptiste Onofré <j...@nanthrax.net> a 
> > écrit :
> > >
> > > Hi,
> > >
> > > you have a requirement in your bundle: it's the Import-Service
> > > statement. The problem comes from there: it's nothing about the
> > > runtime.
> > >
> > > I would recommend adding configuration to maven-bundle-plugin to not
> > > put this requirement in your bundle MANIFEST.
> > >
> > > I already answered similar questions on the Karaf mailing list several 
> > > times.
> > >
> > > By the way, this kind of question should be discussed on the Karaf
> > > mailing list IMHO.
> > >
> > > Regards
> > > JB
> > >
> > > On Tue, Aug 23, 2022 at 10:35 AM Ephemeris Lappis
> > > <ephemeris.lap...@gmail.com> wrote:
> > > >
> > > > Hello again !
> > > >
> > > > Well, I'm not sure I understand what you mean about "requirements" in 
> > > > my bundle. I have no requirement in my manifest. Here the full copy of 
> > > > the manifest :
> > > >
> > > > Manifest-Version: 1.0
> > > > Bnd-LastModified: 1661240801094
> > > > Build-Jdk-Spec: 1.8
> > > > Bundle-Blueprint: OSGI-INF/blueprint/routes.xml
> > > > Bundle-Description: Fifi-T26 :: Camel routes
> > > > Bundle-ManifestVersion: 2
> > > > Bundle-Name: Fifi-T26 :: Camel
> > > > Bundle-SymbolicName: my-test-26-karaf-2-routes
> > > > Bundle-Version: 0.0.1.SNAPSHOT
> > > > Created-By: Apache Maven Bundle Plugin 5.1.8
> > > > DynamicImport-Package: groovy.*,org.codehaus.groovy.*
> > > > Import-Package: javax.jms,javax.sql,my.test.t26.helper;version="[0.0,1
> > > >  )",my.test.t26.uow;version="[0.0,1)",org.osgi.service.blueprint;versi
> > > >  on="[1.0.0,2.0.0)"
> > > > Import-Service: javax.jms.ConnectionFactory;multiple:=false,my.test.t2
> > > >  6.helper.Helper;multiple:=false,my.test.t26.uow.CustomUnitOfWorkFacto
> > > >  ry;multiple:=false,javax.sql.DataSource;multiple:=false;filter=(osgi.
> > > >  jndi.service.name=jdbc/fifi)
> > > > Tool: Bnd-6.3.1.202206071316
> > > >
> > > > I aim to provide my bundle (and all similar bundles in our projects) as 
> > > > a feature, with dependencies that pull all the common features. For 
> > > > that I have created a global common feature, and for  every applicative 
> > > > bundle, this feature is referenced as a prerequisite. Here are the 
> > > > bundle feature and the common one :
> > > >
> > > > <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
> > > > <features xmlns="http://karaf.apache.org/xmlns/features/v1.6.0"; 
> > > > name="my-test-26-karaf-2-routes">
> > > >     
> > > > <repository>mvn:my.tests/my-test-26-karaf-x-feature/0.0.1-SNAPSHOT/xml/features</repository>
> > > >     <feature name="my-test-26-karaf-2-routes-cfg" description="Fifi-T26 
> > > > :: Camel routes - Configuration" version="0.0.1.SNAPSHOT">
> > > >         <details>Fifi-T26 :: Camel routes - Configuration</details>
> > > >         <configfile 
> > > > finalname="/etc/my_test_26_karaf_2_routes.cfg">mvn:my.tests/my-test-26-karaf-2-routes/0.0.1-SNAPSHOT/cfg/configuration</configfile>
> > > >     </feature>
> > > >     <feature name="my-test-26-karaf-2-routes" description="Fifi-T26 :: 
> > > > Camel" version="0.0.1.SNAPSHOT">
> > > >         <details>Fifi-T26 :: Camel routes</details>
> > > >         <feature version="0.0.1-SNAPSHOT" 
> > > > prerequisite="true">my-test-26-karaf-x-feature</feature>
> > > >         <feature version="0.0.1-SNAPSHOT" 
> > > > prerequisite="true">my-test-26-karaf-2-routes-cfg</feature>
> > > >         
> > > > <bundle>mvn:my.tests/my-test-26-karaf-2-routes/0.0.1-SNAPSHOT</bundle>
> > > >     </feature>
> > > > </features>
> > > >
> > > > <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
> > > > <features xmlns="http://karaf.apache.org/xmlns/features/v1.6.0"; 
> > > > name="my-test-26-karaf">
> > > >     
> > > > <repository>mvn:org.apache.camel.karaf/apache-camel/2.25.4/xml/features</repository>
> > > >     <feature name="my-test-26-karaf-x-feature" description="Fifi-T26 :: 
> > > > Feature" version="0.0.1.SNAPSHOT">
> > > >         <details>Fifi-T26 :: Feature Definition</details>
> > > >         <feature>transaction</feature>
> > > >         <feature version="2.25.4">camel-spring</feature>
> > > >         <feature version="2.25.4">camel-blueprint</feature>
> > > >         <feature version="2.25.4">camel-groovy</feature>
> > > >         <feature version="2.25.4">camel-csv</feature>
> > > >         <feature version="2.25.4">camel-jms</feature>
> > > >         <feature version="2.25.4">camel-sql</feature>
> > > >         
> > > > <bundle>mvn:my.tests/my-test-26-karaf-1-service/0.0.1-SNAPSHOT</bundle>
> > > >         
> > > > <bundle>mvn:my.tests/my-test-26-karaf-1-api/0.0.1-SNAPSHOT</bundle>
> > > >     </feature>
> > > > </features>
> > > >
> > > > The error happens when I try to install my bundle as a feature :
> > > > repo-add 
> > > > mvn:my.tests/my-test-26-karaf-2-routes/0.0.1-SNAPSHOT/XML/features
> > > > feature:install my-test-26-karaf-2-routes
> > > >
> > > > All the dependent features and their bundles are installed and started 
> > > > as expected, and when my bundle is deployed, the missing jms service 
> > > > message appears, and the operation fails.
> > > >
> > > > 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.jms.ConnectionFactory)"
> > > >
> > > > BUT when I install my bundle manually, it works : no missing service !
> > > >
> > > > bundle:install -s mvn:my.tests/my-test-26-karaf-2-routes/0.0.1-SNAPSHOT
> > > >
> > > > The referenced services (my custom ones, a data source and the jms 
> > > > connection factory) are all found without any problem, and my routes 
> > > > are started, and work as expected, including XA transactions...
> > > >
> > > > What's wrong when the bundle is deployed using its feature ? What is 
> > > > the difference between a raw bundle installing and doing the same using 
> > > > the feature ?
> > > >
> > > > Thanks again for your help.
> > > >
> > > > Regards.
> > > >
> > > >
> > > > Le mar. 23 août 2022 à 07:09, Jean-Baptiste Onofré <j...@nanthrax.net> 
> > > > a écrit :
> > > >>
> > > >> Hi,
> > > >>
> > > >> That's not a problem of package but of OSGi requirement.
> > > >>
> > > >> You can do:
> > > >> - do not include requirement in your my-test... bundle
> > > >> - provide the capability in your feature (similar to
> > > >> https://github.com/apache/karaf/blob/main/examples/karaf-jpa-example/karaf-jpa-example-features/src/main/feature/feature.xml#L28)
> > > >>
> > > >> IMHO, the easiest way is to avoid requirement in your bundle (adding
> > > >> this to the maven-bundle-plugin configuration).
> > > >>
> > > >> So, there's no problem with the packages, etc. The problem is simply
> > > >> the requirement in your bundle (you can see in the MANIFEST of your
> > > >> bundle, you will see a Require-Capability/Require-Service
> > > >> instructions).
> > > >>
> > > >> Regards
> > > >> JB
> > > >>
> > > >> See:
> > > >>
> > > >> On Mon, Aug 22, 2022 at 12:23 PM Ephemeris Lappis
> > > >> <ephemeris.lap...@gmail.com> wrote:
> > > >> >
> > > >> > Hello again.
> > > >> >
> > > >> > As it seems I have no solution to get an implicit connection 
> > > >> > factory, I've adapted my POC setting myself a reference. But it 
> > > >> > seems that it doesn't work because the service that is created by 
> > > >> > the jms:create command doesn't match some class definition.
> > > >> >
> > > >> > In my POC's code I've added a dependency javax.jms-api version 2.0 
> > > >> > to match the API version that the bundle that is deployed is 
> > > >> > providing.
> > > >> > karaf@root()> exports | grep javax.jms
> > > >> > javax.jms.doc-files                                    │ 2.0.0       
> > > >> > │ 83  │ javax.jms-api
> > > >> > javax.jms                                              │ 2.0.0       
> > > >> > │ 83  │ javax.jms-api
> > > >> >
> > > >> > In my blueprints I've added the service reference, and used it on my 
> > > >> > JMS routes :
> > > >> >  <reference
> > > >> >     id="myJMS"
> > > >> >     interface="javax.jms.ConnectionFactory"
> > > >> >     availability="mandatory" />
> > > >> >
> > > >> > <from uri="jms:queue:k1-test-queue-1?connectionFactory=#myJMS" />
> > > >> >
> > > >> > My bundle's manifest imports the correct package and service :
> > > >> > Import-Package: 
> > > >> > javax.jms;version="[2.0,3)",my.test.t26.helper;version
> > > >> >  
> > > >> > ="[0.0,1)",my.test.t26.uow;version="[0.0,1)",org.osgi.service.bluepri
> > > >> >  nt;version="[1.0.0,2.0.0)"
> > > >> > Import-Service: 
> > > >> > javax.jms.ConnectionFactory;multiple:=false,my.test.t2
> > > >> >  
> > > >> > 6.helper.Helper;multiple:=false,my.test.t26.uow.CustomUnitOfWorkFacto
> > > >> >  ry;multiple:=false
> > > >> >
> > > >> > The service seems to be present on Karaf :
> > > >> >
> > > >> > karaf@root()> jms:connectionfactories
> > > >> > JMS Connection Factory
> > > >> > ──────────────────────
> > > >> > jms/my_amq
> > > >> >
> > > >> > and with service:list :
> > > >> >
> > > >> > [javax.jms.ConnectionFactory]
> > > >> > -----------------------------
> > > >> >  name = my_amq
> > > >> >  osgi.jndi.service.name = jms/my_amq
> > > >> >  password = secret
> > > >> >  pax.jms.managed = true
> > > >> >  service.bundleid = 93
> > > >> >  service.factoryPid = org.ops4j.connectionfactory
> > > >> >  service.id = 147
> > > >> >  service.pid = 
> > > >> > org.ops4j.connectionfactory.4d276d00-2c50-49b0-93f9-18dc16a107ce
> > > >> >  service.scope = singleton
> > > >> >  type = activemq
> > > >> >  url = tcp://localhost:61616
> > > >> >  user = application
> > > >> > Provided by :
> > > >> >  OPS4J Pax JMS Config (93)
> > > >> > Used by:
> > > >> >  System Bundle (0)
> > > >> >
> > > >> > [javax.management.MBeanRegistration, 
> > > >> > org.apache.karaf.features.management.FeaturesServiceMBean, 
> > > >> > javax.management.NotificationEmitter, 
> > > >> > javax.management.NotificationBroadcaster, 
> > > >> > javax.management.DynamicMBean, javax.management.MBeanRegistration]
> > > >> >
> > > >> > But when installing my feature, the services do not match, and I 
> > > >> > have the following error :( !!!
> > > >> >
> > > >> > Unable to resolve root: missing requirement [root] osgi.identity; 
> > > >> > osgi.identity=my-test-26-karaf-2-routes; type=karaf.feature; 
> > > >> > version="[0.0.1.SNAPSHOT,0.0.1.SNAPSHOT]"; 
> > > >> > filter:="(&(osgi.identity=my-test-26-karaf-2-routes)(type=karaf.feature)(version>=0.0.1.SNAPSHOT)(version<=0.0.1.SNAPSHOT))"
> > > >> >  [caused by: 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.identity; 
> > > >> > osgi.identity=my-test-26-karaf-2-routes; type=osgi.bundle; 
> > > >> > version="[0.0.1.SNAPSHOT,0.0.1.SNAPSHOT]"; resolution:=mandatory 
> > > >> > [caused by: 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.jms.ConnectionFactory)"]]
> > > >> >
> > > >> > I thought it may come from the class origin, but only one bundle 
> > > >> > seems to export it. So I tried to find the issue elsewhere...
> > > >> >
> > > >> > Inspecting the ActiveMQ OSGi bundle :
> > > >> >  52 │ Active   │  80 │ 5.17.1             │ ActiveMQ :: OSGi bundle
> > > >> >
> > > >> > I saw that it also gets the class, but doesn't export it :
> > > >> >
> > > >> > karaf@root()> bundle:classes 52 | grep javax.jms.ConnectionFactory
> > > >> > javax/jms/ConnectionFactory.class | exported: false
> > > >> >
> > > >> > Can I deduce that the JMS connection factory service may have been 
> > > >> > created using a bad class from a private package, and this may be 
> > > >> > the reason why it doesn't match my reference, and perhaps why the 
> > > >> > camel-jms component doesn't detect it ?
> > > >> >
> > > >> > With previous versions of ActiveMQ I think it was working...
> > > >> >
> > > >> > Thanks a lot for your help.
> > > >> >
> > > >> > Regards.
> > > >> >
> > > >> >
> > > >> > Le lun. 22 août 2022 à 07:01, Jean-Baptiste Onofré 
> > > >> > <j...@nanthrax.net> a écrit :
> > > >> >>
> > > >> >> Hi,
> > > >> >>
> > > >> >> here's the documentation about camel-activemq:
> > > >> >> https://camel.apache.org/components/3.18.x/activemq-component.html
> > > >> >>
> > > >> >> About the ConnectionFactory, you have to define it as reference in
> > > >> >> your route. You can find an example here:
> > > >> >>
> > > >> >> https://github.com/jbonofre/camel-amq-redelivery/blob/master/src/main/resources/OSGI-INF/blueprint/route.xml
> > > >> >> https://github.com/jbonofre/camel-amq-redelivery/blob/master/src/main/resources/OSGI-INF/blueprint/connectionfactory.xml
> > > >> >>
> > > >> >> Regards
> > > >> >> JB
> > > >> >>
> > > >> >> On Sun, Aug 21, 2022 at 10:22 AM Ephemeris Lappis
> > > >> >> <ephemeris.lap...@gmail.com> wrote:
> > > >> >> >
> > > >> >> > Hello.
> > > >> >> >
> > > >> >> > I've never seen any documentation about "camel-activeemq" : 
> > > >> >> > what's the
> > > >> >> > feature that provides it ?
> > > >> >> >
> > > >> >> > As I've said before, I've been trying to use camel-jms but 
> > > >> >> > surprisingly
> > > >> >> > my unique connection factory is not detected, and the component 
> > > >> >> > asks for
> > > >> >> > an explicit declaration. I thought that one unique connection 
> > > >> >> > factory
> > > >> >> > should be taken into account... I've created a unique connection 
> > > >> >> > factory
> > > >> >> > using "jms:create" connecting to an external ActiveMQ, and I've 
> > > >> >> > checked
> > > >> >> > that the service is present declaring the right interface. Is 
> > > >> >> > there a
> > > >> >> > special way of declaring or naming the connexion factory to make 
> > > >> >> > it
> > > >> >> > available for routes with camel-jms endpoints ?
> > > >> >> >
> > > >> >> > Thanks a lot for your help.
> > > >> >> >
> > > >> >> > Regards.
> > > >> >> >
> > > >> >> > Ephemeris Lappis
> > > >> >> >
> > > >> >> > Le 21/08/2022 à 08:12, Jean-Baptiste Onofré a écrit :
> > > >> >> > > That's correct: activemq-camel has been removed.
> > > >> >> > >
> > > >> >> > > You can now use camel-jms (recommended) or camel-activeemq.
> > > >> >> > >
> > > >> >> > > You can wrap your own component if needed, but I would rather 
> > > >> >> > > update
> > > >> >> > > to camel-jms (not so hard to do).
> > > >> >> > >
> > > >> >> > > Regards
> > > >> >> > > JB
> > > >> >> > >
> > > >> >> > > On Fri, Aug 19, 2022 at 12:33 PM Ephemeris Lappis
> > > >> >> > > <ephemeris.lap...@gmail.com> wrote:
> > > >> >> > >> Hello.
> > > >> >> > >>
> > > >> >> > >> I've been working before on ActiveMQ 5.16.5, but as this 
> > > >> >> > >> version leads to
> > > >> >> > >> too many problems on Karaf 4.4.1 (spring compatibility among 
> > > >> >> > >> other issues),
> > > >> >> > >> I've decided to switch to ActiveMQ 5.17.1.
> > > >> >> > >>
> > > >> >> > >> Before, I think the component camel-activemq was provided by 
> > > >> >> > >> the feature
> > > >> >> > >> activemq-camel, but with 5.17.1 it doesn't appear anymore in 
> > > >> >> > >> this feature,
> > > >> >> > >> if I'm not wrong...
> > > >> >> > >>
> > > >> >> > >> I've also tried as you suggested to use the jms component in 
> > > >> >> > >> my routes, but
> > > >> >> > >> the connection factory I've created to connect to my ActiveMQ 
> > > >> >> > >> server is not
> > > >> >> > >> taken into account by the component that requires an explicit 
> > > >> >> > >> connection
> > > >> >> > >> factory... Changing all our about 100 camel projects to change 
> > > >> >> > >> from
> > > >> >> > >> activemq to jms and declare a connection factory reference 
> > > >> >> > >> seems to be a
> > > >> >> > >> very bad choice for us...
> > > >> >> > >>
> > > >> >> > >> So, from both sides I've issues.
> > > >> >> > >>
> > > >> >> > >> Any idea to get out of this sad situation 😥 ?
> > > >> >> > >>
> > > >> >> > >> Thanks a lot !
> > > >> >> > >>
> > > >> >> > >> Regards.
> > > >> >> > >>
> > > >> >> > >> PS: Perhaps the documentation on the component should say that 
> > > >> >> > >> it's
> > > >> >> > >> available "Since Camel 1.0" but also only with restriction 
> > > >> >> > >> after a given
> > > >> >> > >> version...
> > > >> >> > >>
> > > >> >> > >>
> > > >> >> > >> Le ven. 19 août 2022 à 11:51, Claus Ibsen 
> > > >> >> > >> <claus.ib...@gmail.com> a écrit :
> > > >> >> > >>
> > > >> >> > >>> camel-activemq is not out of the box in Apache Camel in Camel 
> > > >> >> > >>> v2.
> > > >> >> > >>> It comes from Apache ActiveMQ 5.x instead.
> > > >> >> > >>>
> > > >> >> > >>> However starting from ActiveMQ 5.17 then they dropped their 
> > > >> >> > >>> camel-activemq
> > > >> >> > >>> JAR and its no longer available.
> > > >> >> > >>> Instead use the generic camel-jms instead. Or go back to 
> > > >> >> > >>> ActiveMQ 5.16.x
> > > >> >> > >>>
> > > >> >> > >>> In the Camel website make sure to browse the components list 
> > > >> >> > >>> for the Camel
> > > >> >> > >>> version you use. The list is different per version.
> > > >> >> > >>>
> > > >> >> > >>>
> > > >> >> > >>> On Fri, Aug 19, 2022 at 11:35 AM Ephemeris Lappis <
> > > >> >> > >>> ephemeris.lap...@gmail.com> wrote:
> > > >> >> > >>>
> > > >> >> > >>>> Hello.
> > > >> >> > >>>>
> > > >> >> > >>>> I've already asked the question, but probably not clearly...
> > > >> >> > >>>>
> > > >> >> > >>>> I don't understand why I can't resolve the dependency for :
> > > >> >> > >>>> org.apache.camel:camel-activemq:jar:2.25.4
> > > >> >> > >>>>
> > > >> >> > >>>> I used this component for a long time on old servicemix 
> > > >> >> > >>>> environments,
> > > >> >> > >>>> and I'm trying to port my projects to Karaf using Camel 
> > > >> >> > >>>> 2.25.4 (and
> > > >> >> > >>>> ActiveMQ 5.17.1).
> > > >> >> > >>>>
> > > >> >> > >>>> The component is still documented on the Camel components 
> > > >> >> > >>>> list, but I
> > > >> >> > >>>> can't find it.
> > > >> >> > >>>>
> > > >> >> > >>>> Any help ?
> > > >> >> > >>>>
> > > >> >> > >>>> Thanks in advance.
> > > >> >> > >>>>
> > > >> >> > >>>> Regards.
> > > >> >> > >>>>
> > > >> >> > >>>
> > > >> >> > >>> --
> > > >> >> > >>> Claus Ibsen
> > > >> >> > >>> -----------------
> > > >> >> > >>> http://davsclaus.com @davsclaus
> > > >> >> > >>> Camel in Action 2: https://www.manning.com/ibsen2
> > > >> >> > >>>
> > > >> >> >
> > > >> >> > --
> > > >> >> > Cet e-mail a été vérifié par le logiciel antivirus d'Avast.
> > > >> >> > www.avast.com

Reply via email to