Karaf 4.3.6
I use a configuration property to configure injected objects, via @Reference.
Updating a configuration PID containing an property ending in ".target" using
config:... results in a NullPointerException
***
* etc/foo.cfg
***
mydb.target=(osgi.jndi.service.name=myDb)
***
* Component Reference
***
@Component configurationPid = ({ "foo" })
public class Foo implements FooService {
@Reference
private DataSource mydb = null;
...
}
***
* Steps to reproduce
***
1) Edit the configuration using "config:edit foo"
2) List properties using "config:properties-list"
3) Update the configuration using "config:update"
karaf@root()> config:edit foo
karaf@root()> config:property-list
dataSource.target = <null>
karaf@root()> config:update
Error executing command: java.lang.NullPointerException
karaf@root()>
***
* karaf.log
***
16:51:40.372 ERROR [Karaf ssh console user karaf] Exception caught while
executing command
java.lang.NullPointerException: null
at
org.apache.felix.utils.properties.ConfigurationHandler.writeValue(ConfigurationHandler.java:791)
~[?:?]
at
org.apache.felix.utils.properties.ConfigurationHandler.write(ConfigurationHandler.java:229)
~[?:?]
at
org.apache.felix.utils.properties.TypedProperties.convertToString(TypedProperties.java:345)
~[?:?]
at
org.apache.felix.utils.properties.TypedProperties.put(TypedProperties.java:172)
~[?:?]
at
org.apache.felix.utils.properties.TypedProperties.put(TypedProperties.java:52)
~[?:?]
at java.util.AbstractMap.putAll(AbstractMap.java:281) ~[?:1.8.0_172]
at
org.apache.karaf.config.core.impl.ConfigRepositoryImpl.update(ConfigRepositoryImpl.java:73)
~[?:?]
at
org.apache.karaf.config.command.UpdateCommand.doExecute(UpdateCommand.java:42)
~[?:?]
at
org.apache.karaf.config.command.ConfigCommandSupport.execute(ConfigCommandSupport.java:49)
~[?:?]
at
org.apache.karaf.shell.impl.action.command.ActionCommand.execute(ActionCommand.java:84)
~[?:?]
at
org.apache.karaf.shell.impl.console.osgi.secured.SecuredCommand.execute(SecuredCommand.java:68)
~[?:?]
at
org.apache.karaf.shell.impl.console.osgi.secured.SecuredCommand.execute(SecuredCommand.java:86)
~[?:?]
at org.apache.felix.gogo.runtime.Closure.executeCmd(Closure.java:599)
~[?:?]
at
org.apache.felix.gogo.runtime.Closure.executeStatement(Closure.java:526) ~[?:?]
at org.apache.felix.gogo.runtime.Closure.execute(Closure.java:415)
~[?:?]
at org.apache.felix.gogo.runtime.Pipe.doCall(Pipe.java:416) ~[?:?]
at org.apache.felix.gogo.runtime.Pipe.call(Pipe.java:229) ~[?:?]
at org.apache.felix.gogo.runtime.Pipe.call(Pipe.java:59) ~[?:?]
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
~[?:1.8.0_172]
at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
~[?:1.8.0_172]
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
~[?:1.8.0_172]
at java.lang.Thread.run(Thread.java:748) [?:1.8.0_172]
Is this a bug?
Paul Spencer