You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@karaf.apache.org by Gareth <ga...@gmail.com> on 2013/03/26 19:37:22 UTC

Updating Managed Service Factory Config Via "config:" commands?

Hi,

I am trying to update factory config via config: commands (Karaf 2.3.1).
This config was created by an entry in a feature file thus a backing config
file does not exist. i.e.:

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

If I try and edit this config. 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. Am I missing something here?

BTW, if the factory configuration is backed by a file everything works fine.
And if I update a non-factory not backed by a file, a file gets created
after the update.

If someone could let me know what I am doing wrong, it would be much
appreciated.

thanks in advance,
Gareth





--
View this message in context: http://karaf.922171.n3.nabble.com/Updating-Managed-Service-Factory-Config-Via-config-commands-tp4028322.html
Sent from the Karaf - User mailing list archive at Nabble.com.

Re: Updating Managed Service Factory Config Via "config:" commands?

Posted by Jean-Baptiste Onofré <jb...@nanthrax.net>.
Thanks Gareth,

I gonna tackle that tonight or tomorrow.

Regards
JB

On 06/22/2013 07:55 PM, Gareth wrote:
> Issue created (better late than never):
>
> https://issues.apache.org/jira/browse/KARAF-2366
>
> thanks,
> Gareth
>
>
>
> --
> View this message in context: http://karaf.922171.n3.nabble.com/Updating-Managed-Service-Factory-Config-Via-config-commands-tp4028322p4029090.html
> Sent from the Karaf - User mailing list archive at Nabble.com.
>

-- 
Jean-Baptiste Onofré
jbonofre@apache.org
http://blog.nanthrax.net
Talend - http://www.talend.com

Re: Updating Managed Service Factory Config Via "config:" commands?

Posted by Gareth <ga...@gmail.com>.
Issue created (better late than never):

https://issues.apache.org/jira/browse/KARAF-2366

thanks,
Gareth



--
View this message in context: http://karaf.922171.n3.nabble.com/Updating-Managed-Service-Factory-Config-Via-config-commands-tp4028322p4029090.html
Sent from the Karaf - User mailing list archive at Nabble.com.

Re: Updating Managed Service Factory Config Via "config:" commands?

Posted by Achim Nierbeck <bc...@googlemail.com>.
Hi Gareth,

nope that doesn't feel right, could you please open a issue thanks.

Regards, Achim


2013/3/27 Gareth <ga...@gmail.com>

> Hi Jean-Baptiste, Achim,
>
> Thanks very much for the responses!
>
> When I look at the help I see:
>
> OPTIONS
>         -f, --use-file
>                 Configuration lookup using the filename instead of the pid
>
> which suggests this has something to do with the file already being there.
> Does this need an update?
>
> Anyway I tried to run this command. Result below:
>
> karaf@root> config:edit -f com.mycompany.myservice-healthcheck
> Error executing command: java.lang.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]
>
> thanks in advance,
> Gareth
>
>
>
> --
> View this message in context:
> http://karaf.922171.n3.nabble.com/Updating-Managed-Service-Factory-Config-Via-config-commands-tp4028322p4028325.html
> Sent from the Karaf - User mailing list archive at Nabble.com.
>



-- 

Apache Karaf <http://karaf.apache.org/> Committer & PMC
OPS4J Pax Web <http://wiki.ops4j.org/display/paxweb/Pax+Web/> Committer &
Project Lead
OPS4J Pax for Vaadin <http://team.ops4j.org/wiki/display/PAXVAADIN/Home>
Commiter & Project Lead
blog <http://notizblog.nierbeck.de/>

Re: Updating Managed Service Factory Config Via "config:" commands?

Posted by Gareth <ga...@gmail.com>.
Hi Jean-Baptiste, Achim,

Thanks very much for the responses!

When I look at the help I see:

OPTIONS
        -f, --use-file
                Configuration lookup using the filename instead of the pid

which suggests this has something to do with the file already being there.
Does this need an update?

Anyway I tried to run this command. Result below:

karaf@root> config:edit -f com.mycompany.myservice-healthcheck 
Error executing command: java.lang.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]

thanks in advance,
Gareth



--
View this message in context: http://karaf.922171.n3.nabble.com/Updating-Managed-Service-Factory-Config-Via-config-commands-tp4028322p4028325.html
Sent from the Karaf - User mailing list archive at Nabble.com.

Re: Updating Managed Service Factory Config Via "config:" commands?

Posted by Jean-Baptiste Onofré <jb...@nanthrax.net>.
Hi,

I second Achim for the -f: it's exactly the purpose of this option.

Regards
JB

On 03/26/2013 09:42 PM, Achim Nierbeck wrote:
> Hi,
>
> you should add the '-f' to the config:edit command, this way a file with
> the same name is created.
> In your case it should look like the following:
>
> config:edit -f com.mycompany.myservice-healthcheck
>
> regards, Achim
>
>
>
> 2013/3/26 Gareth <gareth.o.collins@gmail.com
> <ma...@gmail.com>>
>
>     Hi,
>
>     I am trying to update factory config via config: commands (Karaf 2.3.1).
>     This config was created by an entry in a feature file thus a backing
>     config
>     file does not exist. i.e.:
>
>     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
>
>     If I try and edit this config. 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. Am I missing something here?
>
>     BTW, if the factory configuration is backed by a file everything
>     works fine.
>     And if I update a non-factory not backed by a file, a file gets created
>     after the update.
>
>     If someone could let me know what I am doing wrong, it would be much
>     appreciated.
>
>     thanks in advance,
>     Gareth
>
>
>
>
>
>     --
>     View this message in context:
>     http://karaf.922171.n3.nabble.com/Updating-Managed-Service-Factory-Config-Via-config-commands-tp4028322.html
>     Sent from the Karaf - User mailing list archive at Nabble.com.
>
>
>
>
> --
>
> Apache Karaf <http://karaf.apache.org/> Committer & PMC
> OPS4J Pax Web <http://wiki.ops4j.org/display/paxweb/Pax+Web/> Committer
> & Project Lead
> OPS4J Pax for Vaadin <http://team.ops4j.org/wiki/display/PAXVAADIN/Home>
> Commiter & Project Lead
> blog <http://notizblog.nierbeck.de/>

-- 
Jean-Baptiste Onofré
jbonofre@apache.org
http://blog.nanthrax.net
Talend - http://www.talend.com

Re: Updating Managed Service Factory Config Via "config:" commands?

Posted by Krzysztof Sobkowiak <kr...@gmail.com>.
Hi

I have spent some time last night to test some features I used to use in 
Karaf 2.x. The option -f/--file has been removed in Karaf 3.x (but 
config:edit --help still describes this option). How can I update the 
managed service factory using the config: command with no usage of the 
generated pid. Can I edit the config using the file name like in Karaf 
2.x? If no, how can I perform this config update? Could you please 
update the User Manual with information how to manage the managed 
service factories?

Best regards
Krzysztof

On 26.03.2013 21:42, Achim Nierbeck wrote:
> Hi,
>
> you should add the '-f' to the config:edit command, this way a file 
> with the same name is created.
> In your case it should look like the following:
>
> config:edit -f com.mycompany.myservice-healthcheck
>
> regards, Achim
>
>
>
> 2013/3/26 Gareth <gareth.o.collins@gmail.com 
> <ma...@gmail.com>>
>
>     Hi,
>
>     I am trying to update factory config via config: commands (Karaf
>     2.3.1).
>     This config was created by an entry in a feature file thus a
>     backing config
>     file does not exist. i.e.:
>
>     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
>
>     If I try and edit this config. 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. Am I missing something here?
>
>     BTW, if the factory configuration is backed by a file everything
>     works fine.
>     And if I update a non-factory not backed by a file, a file gets
>     created
>     after the update.
>
>     If someone could let me know what I am doing wrong, it would be much
>     appreciated.
>
>     thanks in advance,
>     Gareth
>
>
>
>
>
>     --
>     View this message in context:
>     http://karaf.922171.n3.nabble.com/Updating-Managed-Service-Factory-Config-Via-config-commands-tp4028322.html
>     Sent from the Karaf - User mailing list archive at Nabble.com.
>
>
>
>
> -- 
>
> Apache Karaf <http://karaf.apache.org/> Committer & PMC
> OPS4J Pax Web <http://wiki.ops4j.org/display/paxweb/Pax+Web/> 
> Committer & Project Lead
> OPS4J Pax for Vaadin 
> <http://team.ops4j.org/wiki/display/PAXVAADIN/Home> Commiter & Project 
> Lead
> blog <http://notizblog.nierbeck.de/>


-- 
Krzysztof Sobkowiak

JEE & OSS Architect | Technical Architect @ Capgemini
e-mail: krzys.sobkowiak@gmail.com <ma...@gmail.com> | 
Twitter: @KSobkowiak

Re: Updating Managed Service Factory Config Via "config:" commands?

Posted by Achim Nierbeck <bc...@googlemail.com>.
Hi,

you should add the '-f' to the config:edit command, this way a file with
the same name is created.
In your case it should look like the following:

config:edit -f com.mycompany.myservice-healthcheck

regards, Achim



2013/3/26 Gareth <ga...@gmail.com>

> Hi,
>
> I am trying to update factory config via config: commands (Karaf 2.3.1).
> This config was created by an entry in a feature file thus a backing config
> file does not exist. i.e.:
>
> 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
>
> If I try and edit this config. 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. Am I missing something here?
>
> BTW, if the factory configuration is backed by a file everything works
> fine.
> And if I update a non-factory not backed by a file, a file gets created
> after the update.
>
> If someone could let me know what I am doing wrong, it would be much
> appreciated.
>
> thanks in advance,
> Gareth
>
>
>
>
>
> --
> View this message in context:
> http://karaf.922171.n3.nabble.com/Updating-Managed-Service-Factory-Config-Via-config-commands-tp4028322.html
> Sent from the Karaf - User mailing list archive at Nabble.com.
>



-- 

Apache Karaf <http://karaf.apache.org/> Committer & PMC
OPS4J Pax Web <http://wiki.ops4j.org/display/paxweb/Pax+Web/> Committer &
Project Lead
OPS4J Pax for Vaadin <http://team.ops4j.org/wiki/display/PAXVAADIN/Home>
Commiter & Project Lead
blog <http://notizblog.nierbeck.de/>