Quantcast

config:update throws ClassCastException when used on a Configuration with boolean fields created in the web console

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

config:update throws ClassCastException when used on a Configuration with boolean fields created in the web console

rodgersh
I am using Karaf v2.2.5 on Windows 7. I start Karaf (using the karaf.bat script) and create a configuration that has one or more fields that are checkboxes (i.e., Boolean).

I then go to the Karaf command line console and issue the following commands:

config:edit <PID of configuration just created in Admin Console>
config:propset <booleanFieldName> true
config:update

When I submit the config"update command I get this exception:

09:52:19,658 | INFO  | l Console Thread | Console                          | araf.shell.console.jline.Console  242 | 14 - org.apache.karaf.shell.console - 2.2.5 | Exception caught while executing command
java.lang.ClassCastException: java.lang.Boolean cannot be cast to java.lang.String
        at org.apache.karaf.shell.config.ConfigCommandSupport.persistConfiguration(ConfigCommandSupport.java:161)[41:org.apache.karaf.shell.config:2.2.5]
        at org.apache.karaf.shell.config.ConfigCommandSupport.update(ConfigCommandSupport.java:129)[41:org.apache.karaf.shell.config:2.2.5]
        at org.apache.karaf.shell.config.UpdateCommand.doExecute(UpdateCommand.java:38)[41:org.apache.karaf.shell.config:2.2.5]
        at org.apache.karaf.shell.config.ConfigCommandSupport.doExecute(ConfigCommandSupport.java:63)[41:org.apache.karaf.shell.config:2.2.5]
        at org.apache.karaf.shell.console.OsgiCommandSupport.execute(OsgiCommandSupport.java:38)[14:org.apache.karaf.shell.console:2.2.5]
        at org.apache.felix.gogo.commands.basic.AbstractCommand.execute(AbstractCommand.java:35)[14:org.apache.karaf.shell.console:2.2.5]
        at org.apache.felix.gogo.runtime.CommandProxy.execute(CommandProxy.java:78)[14:org.apache.karaf.shell.console:2.2.5]
        at org.apache.felix.gogo.runtime.Closure.executeCmd(Closure.java:474)[14:org.apache.karaf.shell.console:2.2.5]
        at org.apache.felix.gogo.runtime.Closure.executeStatement(Closure.java:400)[14:org.apache.karaf.shell.console:2.2.5]
        at org.apache.felix.gogo.runtime.Pipe.run(Pipe.java:108)[14:org.apache.karaf.shell.console:2.2.5]
        at org.apache.felix.gogo.runtime.Closure.execute(Closure.java:183)[14:org.apache.karaf.shell.console:2.2.5]
        at org.apache.felix.gogo.runtime.Closure.execute(Closure.java:120)[14:org.apache.karaf.shell.console:2.2.5]
        at org.apache.felix.gogo.runtime.CommandSessionImpl.execute(CommandSessionImpl.java:89)[14:org.apache.karaf.shell.console:2.2.5]
        at org.apache.karaf.shell.console.jline.Console.run(Console.java:221)[14:org.apache.karaf.shell.console:2.2.5]
        at java.lang.Thread.run(Thread.java:662)[:1.6.0_29]

And the configuration is not saved.

Configuration completely created/updated in the Admin Console work fine. Likewise, configurations completely created in the command line console work fine. The issue arises only with boolean fields and what mechanism is used to initially create the configuration.

Thanks.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: config:update throws ClassCastException when used on a Configuration with boolean fields created in the web console

Reuben Garrett
rodgersh,

is there a JIRA [1] filed for the issue you're experiencing? or if not, would you consider opening one? 

[1]: https://issues.apache.org/jira/browse/KARAF

~ Reuben

On Wed, Apr 11, 2012 at 15:54, rodgersh <[hidden email]> wrote:
I am using Karaf v2.2.5 on Windows 7. I start Karaf (using the karaf.bat
script) and create a configuration that has one or more fields that are
checkboxes (i.e., Boolean).

I then go to the Karaf command line console and issue the following
commands:

config:edit <PID of configuration just created in Admin Console>
config:propset <booleanFieldName> true
config:update

When I submit the config"update command I get this exception:

09:52:19,658 | INFO  | l Console Thread | Console                          |
araf.shell.console.jline.Console  242 | 14 - org.apache.karaf.shell.console
- 2.2.5 | Exception caught while executing command
java.lang.ClassCastException: java.lang.Boolean cannot be cast to
java.lang.String
       at
org.apache.karaf.shell.config.ConfigCommandSupport.persistConfiguration(ConfigCommandSupport.java:161)[41:org.apache.karaf.shell.config:2.2.5]
       at
org.apache.karaf.shell.config.ConfigCommandSupport.update(ConfigCommandSupport.java:129)[41:org.apache.karaf.shell.config:2.2.5]
       at
org.apache.karaf.shell.config.UpdateCommand.doExecute(UpdateCommand.java:38)[41:org.apache.karaf.shell.config:2.2.5]
       at
org.apache.karaf.shell.config.ConfigCommandSupport.doExecute(ConfigCommandSupport.java:63)[41:org.apache.karaf.shell.config:2.2.5]
       at
org.apache.karaf.shell.console.OsgiCommandSupport.execute(OsgiCommandSupport.java:38)[14:org.apache.karaf.shell.console:2.2.5]
       at
org.apache.felix.gogo.commands.basic.AbstractCommand.execute(AbstractCommand.java:35)[14:org.apache.karaf.shell.console:2.2.5]
       at
org.apache.felix.gogo.runtime.CommandProxy.execute(CommandProxy.java:78)[14:org.apache.karaf.shell.console:2.2.5]
       at
org.apache.felix.gogo.runtime.Closure.executeCmd(Closure.java:474)[14:org.apache.karaf.shell.console:2.2.5]
       at
org.apache.felix.gogo.runtime.Closure.executeStatement(Closure.java:400)[14:org.apache.karaf.shell.console:2.2.5]
       at
org.apache.felix.gogo.runtime.Pipe.run(Pipe.java:108)[14:org.apache.karaf.shell.console:2.2.5]
       at
org.apache.felix.gogo.runtime.Closure.execute(Closure.java:183)[14:org.apache.karaf.shell.console:2.2.5]
       at
org.apache.felix.gogo.runtime.Closure.execute(Closure.java:120)[14:org.apache.karaf.shell.console:2.2.5]
       at
org.apache.felix.gogo.runtime.CommandSessionImpl.execute(CommandSessionImpl.java:89)[14:org.apache.karaf.shell.console:2.2.5]
       at
org.apache.karaf.shell.console.jline.Console.run(Console.java:221)[14:org.apache.karaf.shell.console:2.2.5]
       at java.lang.Thread.run(Thread.java:662)[:1.6.0_29]

And the configuration is not saved.

Configuration completely created/updated in the Admin Console work fine.
Likewise, configurations completely created in the command line console work
fine. The issue arises only with boolean fields and what mechanism is used
to initially create the configuration.

Thanks.


--
View this message in context: http://karaf.922171.n3.nabble.com/config-update-throws-ClassCastException-when-used-on-a-Configuration-with-boolean-fields-created-in-e-tp3903838p3903838.html
Sent from the Karaf - User mailing list archive at Nabble.com.

Loading...