Hi,

When I tried, the bundle "BotImpl" provided the service
'org.osgi.service.component.ComponentFactory', I can see it in the
"services" command output.

However it's not binded in the BotApplication by the @Reference.

regards,

François Papon
[email protected]

Le 03/09/2018 à 19:02, Jean-Baptiste Onofré a écrit :
> Hi Milen,
>
> effective means that it expects a service available in the registry. So,
> if ComponentFactory is preset in the registry (you can check with the ls
> command), it should work via the feature.
>
> I will provide a fix to Thiago.
>
> Regards
> JB
>
> On 03/09/2018 16:40, Milen Dyankov wrote:
>> This is a shot it the dark and I'm sure JB will correct me if I'm
>> wrong but I think it may be due to `effective:=active` directive.
>>
>> See, if you deploy the `scr` feature and your bundles, they are
>> activated. But IMHO the application bundle shouldn't resolve because
>> It has
>> `Require-Capability: ...
>> osgi.service;filter:="(objectClass=org.osgi.service.component.ComponentFactory)";effective:=active,
>> .....`
>> but there is no such service registered.
>>
>> Therefore my guess is that direct deployment of bundles ignores the
>> requirement as it is `effective:=active` but it is enforced by the
>> feature/kar resolver.
>>
>> Best,
>> Milen
>> On Mon, Sep 3, 2018 at 3:55 PM Francois Papon
>> <[email protected]> wrote:
>>> Hi,
>>>
>>> I tried yesterday and I'm able to reproduce after migrate on 
>>> maven-bundle-plugin, I will search more deeply for the component-factory ;)
>>>
>>> regards,
>>>
>>> François Papon
>>> [email protected]
>>>
>>> Le 03/09/2018 à 17:47, Thiago Moreira (timba) a écrit :
>>>
>>>
>>>   Hey guys, were you able to reproduce the problem?
>>>
>>>   Thanks
>>>
>>> Thiago Moreira
>>> +55 48 99911-6331
>>>
>>>
>>> On Sun, Sep 2, 2018 at 1:10 PM Jean-Baptiste Onofré <[email protected]> 
>>> wrote:
>>>> Some may see this as a pro, some as a cons ;)
>>>>
>>>> Anyway, maven-bundle-plugin uses bnd (library). The bnd plugin allows to
>>>> delegate the headers definition in the specific file.
>>>>
>>>> maven-bundle-plugin defines a lot of default headers based on Maven.
>>>> That's what I would like to check (the diff in the generated headers).
>>>>
>>>> Regards
>>>> JB
>>>>
>>>> On 02/09/2018 17:25, Francois Papon wrote:
>>>>> You don't have to declare things in a bnd.bnd file,  you can define it
>>>>> directly in the plugin configuration in your pom.xml like this :
>>>>>
>>>>>             <plugin>
>>>>>                 <groupId>org.apache.felix</groupId>
>>>>>                 <artifactId>maven-bundle-plugin</artifactId>
>>>>>                 <configuration>
>>>>>                     <instructions>
>>>>>                         <Export-Package>
>>>>>                             org.apache.karaf.vineyard.registry.api
>>>>>                         </Export-Package>
>>>>>                     </instructions>
>>>>>                 </configuration>
>>>>>             </plugin>
>>>>>
>>>>> regards,
>>>>>
>>>>> François Papon
>>>>> [email protected]
>>>>>
>>>>> Le 02/09/2018 à 19:21, Thiago Moreira (timba) a écrit :
>>>>>>   What is the advantages in your point of view of bundle over bnd?
>>>>>> Maybe I should start another thread...
>>>>>>
>>>>>> Thiago Moreira
>>>>>> +55 48 99911-6331
>>>>>>
>>>>>>
>>>>>> On Sun, Sep 2, 2018 at 12:12 PM Francois Papon
>>>>>> <[email protected] <mailto:[email protected]>>
>>>>>> wrote:
>>>>>>
>>>>>>     Sorry, I missed it, I see it now :)
>>>>>>
>>>>>>     @Component(service = Bot.class, factory = "bot.factory")
>>>>>>     public class BotImpl implements Bot {
>>>>>>
>>>>>>     regards
>>>>>>
>>>>>>     François Papon
>>>>>>     [email protected] <mailto:[email protected]>
>>>>>>
>>>>>>     Le 02/09/2018 à 19:09, Francois Papon a écrit :
>>>>>>>     Ok,
>>>>>>>
>>>>>>>     You should use the maven-bundle-plugin instead of the bnd-plugin,
>>>>>>>     it's more convenient ;)
>>>>>>>
>>>>>>>     Btw, I see that in your BotApplication class you are searching a
>>>>>>>     service with a component.factory property = bot.factory but I
>>>>>>>     can't see where you are registring this factory
>>>>>>>
>>>>>>>     @Reference(target = "(component.factory=bot.factory)")
>>>>>>>     protected ComponentFactory factory;
>>>>>>>
>>>>>>>     regards,
>>>>>>>
>>>>>>>     François Papon
>>>>>>>     [email protected] <mailto:[email protected]>
>>>>>>>     Le 02/09/2018 à 19:01, Thiago Moreira (timba) a écrit :
>>>>>>>>       Nice! I already look the example.
>>>>>>>>
>>>>>>>>     Thiago Moreira
>>>>>>>>     +55 48 99911-6331
>>>>>>>>
>>>>>>>>
>>>>>>>>     On Sun, Sep 2, 2018 at 11:57 AM Francois Papon
>>>>>>>>     <[email protected]
>>>>>>>>     <mailto:[email protected]>> wrote:
>>>>>>>>
>>>>>>>>         I will take a look ;)
>>>>>>>>
>>>>>>>>         You can also take a look on the Karaf SCR example to deal
>>>>>>>>         with scr.
>>>>>>>>
>>>>>>>>         regards,
>>>>>>>>
>>>>>>>>         François Papon
>>>>>>>>         [email protected] <mailto:[email protected]>
>>>>>>>>
>>>>>>>>         Le 02/09/2018 à 18:01, Thiago Moreira (timba) a écrit :
>>>>>>>>>           Hey François, the project is available
>>>>>>>>>         here https://github.com/tmoreira2020/poc-osgi-whiteboard
>>>>>>>>>
>>>>>>>>>           Thanks
>>>>>>>>>
>>>>>>>>>         Thiago Moreira
>>>>>>>>>         +55 48 99911-6331
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>         On Sun, Sep 2, 2018 at 10:45 AM francois.papon
>>>>>>>>>         <[email protected]
>>>>>>>>>         <mailto:[email protected]>> wrote:
>>>>>>>>>
>>>>>>>>>             Hi,
>>>>>>>>>
>>>>>>>>>             Can you share your bundle and your feature ?
>>>>>>>>>
>>>>>>>>>             Regards,
>>>>>>>>>
>>>>>>>>>             François
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>             Envoyé depuis mon smartphone Samsung Galaxy.
>>>>>>>>>
>>>>>>>>>             -------- Message d'origine --------
>>>>>>>>>             De : "Thiago Moreira (timba)" <[email protected]
>>>>>>>>>             <mailto:[email protected]>>
>>>>>>>>>             Date : 02/09/2018 16:14 (GMT+04:00)
>>>>>>>>>             À : [email protected] <mailto:[email protected]>
>>>>>>>>>             Objet : Re: Unable to deploy a Karaf kar file
>>>>>>>>>             containing a ComponentFactory OSGi declarative service
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>               I have tried with Karaf 4.2.1 without lucky. My steps:
>>>>>>>>>
>>>>>>>>>              1. Unzip the bundle
>>>>>>>>>              2. Start with karaf command
>>>>>>>>>              3. Build the project with mvn clean install
>>>>>>>>>              4. Install the kar file
>>>>>>>>>                  1. Copy the kar file
>>>>>>>>>                     br.com.thiagomoreira.kar-1.0.0-SNAPSHOT.kar to
>>>>>>>>>                     the deploy folder
>>>>>>>>>                  2. Or use the kar:install command
>>>>>>>>>              5. Logs and console prints the exception: *Unable to
>>>>>>>>>                 resolve
>>>>>>>>>                 br.com.thiagomoreira.application/1.0.0.201809021204: 
>>>>>>>>> missing
>>>>>>>>>                 requirement
>>>>>>>>>                 [br.com.thiagomoreira.application/1.0.0.201809021204]
>>>>>>>>>                 osgi.service;
>>>>>>>>>                 
>>>>>>>>> filter:="(objectClass=org.osgi.service.component.ComponentFactory)";
>>>>>>>>>                 effective:=active*
>>>>>>>>>
>>>>>>>>>               I have tried to install SCR feature before the kar
>>>>>>>>>             fail too, without lucky. What I'm missing?
>>>>>>>>>
>>>>>>>>>               Yes, I was using ServiceMix 7.0.1 but now I switched
>>>>>>>>>             to Karaf 4.2.1 (after your reply in the ServiceMix
>>>>>>>>>             mailing list)
>>>>>>>>>
>>>>>>>>>               Thanks
>>>>>>>>>
>>>>>>>>>             Thiago Moreira
>>>>>>>>>             +55 48 99911-6331
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>             On Sun, Sep 2, 2018 at 1:53 AM Jean-Baptiste Onofré
>>>>>>>>>             <[email protected] <mailto:[email protected]>> wrote:
>>>>>>>>>
>>>>>>>>>                 Hi,
>>>>>>>>>
>>>>>>>>>                 I tried on both Karaf 4.1.6 and Karaf 4.2.1, and it
>>>>>>>>>                 works fine for me:
>>>>>>>>>                 the SCR feature is installed and my SCR bundle
>>>>>>>>>                 starts correctly when I
>>>>>>>>>                 put the kar in the deploy folder or when I use
>>>>>>>>>                 kar:install.
>>>>>>>>>
>>>>>>>>>                 So, you are using SMX 7.0.1 as Karaf version ?
>>>>>>>>>
>>>>>>>>>                 Regards
>>>>>>>>>                 JB
>>>>>>>>>
>>>>>>>>>                 On 01/09/2018 19:10, Thiago Moreira (timba) wrote:
>>>>>>>>>                 >
>>>>>>>>>                 >   I need scr as prerequisite to run my app. The
>>>>>>>>>                 thing is I'm running a
>>>>>>>>>                 > docker that has a vanilla ServiceMix (7.0.1)
>>>>>>>>>                 installation and my goal is
>>>>>>>>>                 > to be able to deploy a single file with
>>>>>>>>>                 everything that I need.
>>>>>>>>>                 >
>>>>>>>>>                 >   I tried to install scr and then deploy the kar
>>>>>>>>>                 (via deploy folder) but
>>>>>>>>>                 > not lucky
>>>>>>>>>                 >
>>>>>>>>>                 >   Yes, the
>>>>>>>>>                 service org.osgi.service.component.ComponentFactory is
>>>>>>>>>                 > installed and it is provided by my "Bot
>>>>>>>>>                 Implementation" bundle.
>>>>>>>>>                 >
>>>>>>>>>                 >   I didn't understand your last question. Is
>>>>>>>>>                 there another way to
>>>>>>>>>                 > achieve the installation of everything at once
>>>>>>>>>                 (like EARs)?
>>>>>>>>>                 >
>>>>>>>>>                 >   BTW, I'm an OSGi/Karaf/ServiceMix beginner. :D
>>>>>>>>>                 >
>>>>>>>>>                 > Thiago Moreira
>>>>>>>>>                 > +55 48 99911-6331
>>>>>>>>>                 >
>>>>>>>>>                 >
>>>>>>>>>                 > On Sat, Sep 1, 2018 at 1:28 PM Jean-Baptiste
>>>>>>>>>                 Onofré <[email protected] <mailto:[email protected]>
>>>>>>>>>                 > <mailto:[email protected]
>>>>>>>>>                 <mailto:[email protected]>>> wrote:
>>>>>>>>>                 >
>>>>>>>>>                 >     Oh sorry, I missed the cause:  the service
>>>>>>>>>                 >     org.osgi.service.component.ComponentFactory
>>>>>>>>>                 is not there ;)
>>>>>>>>>                 >
>>>>>>>>>                 >     Why do you have as a prerequisite ?
>>>>>>>>>                 >
>>>>>>>>>                 >     I guess that if you install the scr feature
>>>>>>>>>                 before the kar it works fine
>>>>>>>>>                 >     right ?
>>>>>>>>>                 >
>>>>>>>>>                 >     Can you check if you have the
>>>>>>>>>                 ComponentFactory service ?
>>>>>>>>>                 >
>>>>>>>>>                 >     By the way, why did you define the
>>>>>>>>>                 requirement in your bundle ?
>>>>>>>>>                 >
>>>>>>>>>                 >     Regards
>>>>>>>>>                 >     JB
>>>>>>>>>                 >
>>>>>>>>>                 >     On 01/09/2018 18:19, Thiago Moreira (timba)
>>>>>>>>>                 wrote:
>>>>>>>>>                 >     >
>>>>>>>>>                 >     >   Hey JB, yes it does. Check it here
>>>>>>>>>                 feature.xml
>>>>>>>>>                 >     >
>>>>>>>>>                 >
>>>>>>>>>                  
>>>>>>>>> <https://github.com/tmoreira2020/poc-osgi-whiteboard/blob/master/br.com.thiagomoreira.kar/src/main/feature/feature.xml>
>>>>>>>>>                 >     >
>>>>>>>>>                 >     > Thiago Moreira
>>>>>>>>>                 >     > +55 48 99911-6331
>>>>>>>>>                 >     >
>>>>>>>>>                 >     >
>>>>>>>>>                 >     > On Sat, Sep 1, 2018 at 1:05 PM
>>>>>>>>>                 Jean-Baptiste Onofré
>>>>>>>>>                 >     <[email protected] <mailto:[email protected]>
>>>>>>>>>                 <mailto:[email protected] <mailto:[email protected]>>
>>>>>>>>>                 >     > <mailto:[email protected]
>>>>>>>>>                 <mailto:[email protected]> <mailto:[email protected]
>>>>>>>>>                 <mailto:[email protected]>>>> wrote:
>>>>>>>>>                 >     >
>>>>>>>>>                 >     >     Hi,
>>>>>>>>>                 >     >
>>>>>>>>>                 >     >     does the features XML used to create
>>>>>>>>>                 the kar contain the scr
>>>>>>>>>                 >     feature ?
>>>>>>>>>                 >     >
>>>>>>>>>                 >     >     Basically, as you are using DS, you
>>>>>>>>>                 have to install the scr
>>>>>>>>>                 >     feature.
>>>>>>>>>                 >     >
>>>>>>>>>                 >     >     Regards
>>>>>>>>>                 >     >     JB
>>>>>>>>>                 >     >
>>>>>>>>>                 >     >     On 01/09/2018 17:52, Thiago Moreira
>>>>>>>>>                 (timba) wrote:
>>>>>>>>>                 >     >     >
>>>>>>>>>                 >     >     >   Hey all! Does anyone can help me
>>>>>>>>>                 with this question?
>>>>>>>>>                 >     >     >
>>>>>>>>>                 >     >
>>>>>>>>>                 >
>>>>>>>>>                   
>>>>>>>>> https://stackoverflow.com/questions/52118716/unable-to-deploy-a-karaf-kar-file-containing-a-componentfactory-osgi-declarative
>>>>>>>>>                 >     >     >
>>>>>>>>>                 >     >     >   Thanks
>>>>>>>>>                 >     >     >
>>>>>>>>>                 >     >     > p.s. I have tried to send the
>>>>>>>>>                 question directly to here
>>>>>>>>>                 >     before but
>>>>>>>>>                 >     >     seems
>>>>>>>>>                 >     >     > that I wasn't properly added to the
>>>>>>>>>                 list. Given another try...
>>>>>>>>>                 >     >     >
>>>>>>>>>                 >     >     > Thiago Moreira
>>>>>>>>>                 >     >     > +55 48 99911-6331
>>>>>>>>>                 >     >
>>>>>>>>>                 >     >     --
>>>>>>>>>                 >     >     Jean-Baptiste Onofré
>>>>>>>>>                 >     >     [email protected]
>>>>>>>>>                 <mailto:[email protected]>
>>>>>>>>>                 <mailto:[email protected]
>>>>>>>>>                 <mailto:[email protected]>>
>>>>>>>>>                 >     <mailto:[email protected]
>>>>>>>>>                 <mailto:[email protected]>
>>>>>>>>>                 <mailto:[email protected]
>>>>>>>>>                 <mailto:[email protected]>>>
>>>>>>>>>                 >     >     http://blog.nanthrax.net
>>>>>>>>>                 >     >     Talend - http://www.talend.com
>>>>>>>>>                 >     >
>>>>>>>>>                 >
>>>>>>>>>                 >     --
>>>>>>>>>                 >     Jean-Baptiste Onofré
>>>>>>>>>                 >     [email protected]
>>>>>>>>>                 <mailto:[email protected]>
>>>>>>>>>                 <mailto:[email protected]
>>>>>>>>>                 <mailto:[email protected]>>
>>>>>>>>>                 >     http://blog.nanthrax.net
>>>>>>>>>                 >     Talend - http://www.talend.com
>>>>>>>>>                 >
>>>>>>>>>
>>>>>>>>>                 --
>>>>>>>>>                 Jean-Baptiste Onofré
>>>>>>>>>                 [email protected] <mailto:[email protected]>
>>>>>>>>>                 http://blog.nanthrax.net
>>>>>>>>>                 Talend - http://www.talend.com
>>>>>>>>>
>>>
>>

Reply via email to