Description
This is related to this thread in the mailing list:
In summary, it does not appear to be possible to update a factory configuration not backed by a file (e.g. one created via a karaf feature file).
If I have a configuration like this:
Pid: com.mycompany.myservice.327d4cd4-4704-4190-9e51-26f5f0b91435
FactoryPid: com.mycompany.myservice
BundleLocation: mvn:com.mycompany/mycompany/1.0.0-SNAPSHOT
Properties:
myservice.host = 0.0.0.0
myservice.port = 8080
org.apache.karaf.features.configKey = com.mycompany.myservice-healthcheck
service.factoryPid = com.mycompany.myservice
service.pid = com.mycompany.myservice.327d4cd4-4704-4190-9e51-26f5f0b91435
and try to edit the configuration. e.g.:
config:edit com.mycompany.myservice-healthcheck
config:propset myservice.port = 8081
config:update
I get a new config:
Pid: com.mycompany.myservice.8cbfea87-f66e-44b4-b94a-11fdb14c235f
FactoryPid: com.mycompany.myservice
BundleLocation: mvn:com.antennasoftware/gravity.clientAP.blueprint/1.0.0-SNAPSHOT
Properties:
service.pid = com.mycompany.myservice.8cbfea87-f66e-44b4-b94a-11fdb14c235f
myservice.port = 8081
service.factoryPid = com.mycompany.myservice
felix.fileinstall.filename = file:/home/karaf/apache-karaf-2.3.1/etc/com.mycompany.myservice-healthcheck.cfg
If I go and specify the pid exactly:
> config:edit com.mycompany.myservice.327d4cd4-4704-4190-9e51-26f5f0b91435
> config:propset myservice.port 8081
> config:update
Nothing happens.
If I try the "-f" option (which I understand should create a file) I get a NullPointerException:
2013-03-26 21:10:08,231 | INFO | []:[] | Thread-8220 | Console | araf.shell.console.jline.Console 198 | 14 - org.apache.karaf.shell.console - 2.3.1 | Exception caught while executing command
java.lang.NullPointerException
at org.apache.karaf.shell.config.ConfigCommandSupport.findConfigurationByFileName(ConfigCommandSupport.java:115)
at org.apache.karaf.shell.config.EditCommand.doExecute(EditCommand.java:50)
at org.apache.karaf.shell.config.ConfigCommandSupport.doExecute(ConfigCommandSupport.java:68)
at org.apache.karaf.shell.console.OsgiCommandSupport.execute(OsgiCommandSupport.java:38)
at org.apache.felix.gogo.commands.basic.AbstractCommand.execute(AbstractCommand.java:35)
at org.apache.felix.gogo.runtime.CommandProxy.execute(CommandProxy.java:78)
at org.apache.felix.gogo.runtime.Closure.executeCmd(Closure.java:474)
at org.apache.felix.gogo.runtime.Closure.executeStatement(Closure.java:400)
at org.apache.felix.gogo.runtime.Pipe.run(Pipe.java:108)
at org.apache.felix.gogo.runtime.Closure.execute(Closure.java:183)
at org.apache.felix.gogo.runtime.Closure.execute(Closure.java:120)
at org.apache.felix.gogo.runtime.CommandSessionImpl.execute(CommandSessionImpl.java:89)
at org.apache.karaf.shell.console.jline.Console.run(Console.java:174)
at java.lang.Thread.run(Unknown Source)[:1.7.0_05]
at org.apache.karaf.shell.ssh.ShellFactoryImpl$ShellImpl$4.doRun(ShellFactoryImpl.java:144)[28:org.apache.karaf.shell.ssh:2.3.1]
at org.apache.karaf.shell.ssh.ShellFactoryImpl$ShellImpl$4$1.run(ShellFactoryImpl.java:135)
at java.security.AccessController.doPrivileged(Native Method)[:1.7.0_05]
at javax.security.auth.Subject.doAs(Unknown Source)[:1.7.0_05]
at org.apache.karaf.shell.ssh.ShellFactoryImpl$ShellImpl$4.run(ShellFactoryImpl.java:133)[28:org.apache.karaf.shell.ssh:2.3.1]