karaf-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Grzegorz Grzybek (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (KARAF-6181) ManagedServiceFactory does not work reliably anymore
Date Tue, 05 Mar 2019 14:22:00 GMT

    [ https://issues.apache.org/jira/browse/KARAF-6181?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16784491#comment-16784491
] 

Grzegorz Grzybek commented on KARAF-6181:
-----------------------------------------

If you check {{config:edit}} help, you can see:
{noformat}
Create a factory config by factory pid and alias:
  > config:edit --factory --alias myalias myfactorypid
In this case the config is created with a pid like myfactorypid.<generated id>. The
file name is myfactorypid-myalias.cfg.
{noformat}

Specifying PID like you did ({{org.opennms.dummy.services-1}}) creates non-factory configuration
in a file that's used then (by fileinstall) to create factory configuration - and I saw this
_problem_ as well - duplication of configs.

Just use {{--factory}} option and (optionally) {{--alias}} if you want the part after {{-}}
specified (instead of UUID).

> ManagedServiceFactory does not work reliably anymore 
> -----------------------------------------------------
>
>                 Key: KARAF-6181
>                 URL: https://issues.apache.org/jira/browse/KARAF-6181
>             Project: Karaf
>          Issue Type: Bug
>    Affects Versions: 4.2.2, 4.2.3
>         Environment: Mac OS X, Apache Karaf 4.2.2/4.2.3, Java 8
>            Reporter: Markus von Rüden
>            Priority: Major
>
> It seems that the *ManagedServiceFactory* in combination with *service.pid* does not
work reliably anymore with Apache Karaf 4.2.3.
> *The Problem*
> Registering a *ManagedServiceFactory* with a provided *service.pid* does no longer invoke
the "updated(...)" method ** even when it should. 
> *How to Reproduce*
> I created a simple example project, where a *ManagedServiceFactory* service is exposed
with *service.pid=org.opennms.dummy.services*
> The service simply prints out if a service with the pid managed by the factory was created/updated/deleted
> In order to help narrowing down the problem, here is how to reproduce it
>   
>  * Checkout the [example repository|https://github.com/mvrueden/karaf-managed-service-factory-example]
>  * Build the code with {{mvn clean install}}
>  * Download latest Apache Karaf 4.2.3 Distribution from [here|http://www.apache.org/dyn/closer.lua/karaf/4.2.3/apache-karaf-4.2.3.tar.gz].
>  * Extract the archive
>  * Start the container {{./bin/karaf}}
>  * Install {{aries-blueprint}}: {{feature:install aries-blueprint}}
>  * Install the bundle: {{install -s mvn:org.opennms.dummy/managed-service-factory/1.0-SNAPSHOT}}
>  * Verify via {{list}}
>  * Now add some configuration files, e.g.
> {code:java}
> config:edit org.opennms.dummy.services-1
> config:property-set key value
> config:update
>  {code}
> If you check the logs via {{log:tail}} you can see, that only some or none are actually
logged. In my case 2 of 5 were logged. However if I do a {{config:list}} all configs are listed,
but only a few (the logged ones) have a factoryPid.
> {quote}karaf@root()> config:list "(service.pid=org.opennms*)"
>  ----------------------------------------------------------------
>  Pid: org.opennms.dummy.services-3
>  BundleLocation: null
>  Properties:
>  a = b
>  felix.fileinstall.filename = [file:/Users/mvrueden/Downloads/apache-karaf-4.2.3/etc/org.opennms.dummy.services-3.cfg|file:///Users/mvrueden/Downloads/apache-karaf-4.2.3/etc/org.opennms.dummy.services-3.cfg]
>  service.pid = org.opennms.dummy.services-3
>  ----------------------------------------------------------------
>  Pid: org.opennms.dummy.services-asdf
>  BundleLocation: null
>  Properties:
>  a = b
>  bla = bla
>  felix.fileinstall.filename = [file:/Users/mvrueden/Downloads/apache-karaf-4.2.3/etc/org.opennms.dummy.services-asdf.cfg|file:///Users/mvrueden/Downloads/apache-karaf-4.2.3/etc/org.opennms.dummy.services-asdf.cfg]
>  service.pid = org.opennms.dummy.services-asdf
>  ----------------------------------------------------------------
>  Pid: org.opennms.dummy.services-xyz
>  BundleLocation: null
>  Properties:
>  felix.fileinstall.filename = [file:/Users/mvrueden/Downloads/apache-karaf-4.2.3/etc/org.opennms.dummy.services-xyz.cfg|file:///Users/mvrueden/Downloads/apache-karaf-4.2.3/etc/org.opennms.dummy.services-xyz.cfg]
>  service.pid = org.opennms.dummy.services-xyz
>  ----------------------------------------------------------------
>  Pid: org.opennms.dummy.services.30b34eda-96f1-4bd1-9e6e-396e3af9cd84
>  FactoryPid: org.opennms.dummy.services
>  BundleLocation: ?
>  Properties:
>  felix.fileinstall.filename = [file:/Users/mvrueden/Downloads/apache-karaf-4.2.3/etc/org.opennms.dummy.services-2.cfg|file:///Users/mvrueden/Downloads/apache-karaf-4.2.3/etc/org.opennms.dummy.services-2.cfg]
>  service.factoryPid = org.opennms.dummy.services
>  service.pid = org.opennms.dummy.services.30b34eda-96f1-4bd1-9e6e-396e3af9cd84
>  ----------------------------------------------------------------
>  Pid: org.opennms.dummy.services.e670d214-5eba-4086-9129-f79918542f8c
>  FactoryPid: org.opennms.dummy.services
>  BundleLocation: ?
>  Properties:
>  felix.fileinstall.filename = [file:/Users/mvrueden/Downloads/apache-karaf-4.2.3/etc/org.opennms.dummy.services-1.cfg|file:///Users/mvrueden/Downloads/apache-karaf-4.2.3/etc/org.opennms.dummy.services-1.cfg]
>  service.factoryPid = org.opennms.dummy.services
>  service.pid = org.opennms.dummy.services.e670d214-5eba-4086-9129-f79918542f8c
>  x = z
> {quote}
> Restarting the container also did not work.
>  However, uninstalling the bundle and re-installing it, will work.
> I was able to confirm this for 4.2.2 as well. In 4.1.5 it still works as expected.
> Please let me know if there is anything I can do to help resolving this.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Mime
View raw message