You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@felix.apache.org by "Felix Meschberger (JIRA)" <ji...@apache.org> on 2012/05/31 16:08:24 UTC
[jira] [Commented] (FELIX-2925) java.lang.NullPointerException:
reference and pid must not be null
[ https://issues.apache.org/jira/browse/FELIX-2925?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13286587#comment-13286587 ]
Felix Meschberger commented on FELIX-2925:
------------------------------------------
This looks like a bug in the Configuration Admin implementation.
Could this in fact be the same as FELIX-2813 which is supposed to be fixed in trunk (and being voted upon for the Configuration Admin 1.4.0 release) ?
> java.lang.NullPointerException: reference and pid must not be null
> ------------------------------------------------------------------
>
> Key: FELIX-2925
> URL: https://issues.apache.org/jira/browse/FELIX-2925
> Project: Felix
> Issue Type: Bug
> Components: Declarative Services (SCR)
> Affects Versions: scr-1.6.0
> Reporter: Andrei Pozolotin
>
> #################
> getting this:
> *ERROR* Unexpected problem executing task
> java.lang.NullPointerException: reference and pid must not be null
> at org.osgi.service.cm.ConfigurationEvent.<init>(ConfigurationEvent.java:120)
> at org.apache.felix.cm.impl.ConfigurationManager$FireConfigurationEvent.run(ConfigurationManager.java:1818)
> at org.apache.felix.cm.impl.UpdateThread.run(UpdateThread.java:104)
> at java.lang.Thread.run(Thread.java:662)
> #################
> at this line:
> conf.update(props);
> #################
> for this snippet:
> package com.barchart.mgr;
> import java.util.Date;
> import java.util.Dictionary;
> import java.util.Properties;
> import org.apache.felix.scr.annotations.Activate;
> import org.apache.felix.scr.annotations.Component;
> import org.apache.felix.scr.annotations.Deactivate;
> import org.apache.felix.scr.annotations.Reference;
> import org.osgi.service.cm.Configuration;
> import org.osgi.service.cm.ConfigurationAdmin;
> import org.osgi.service.component.ComponentContext;
> import org.slf4j.Logger;
> import org.slf4j.LoggerFactory;
> @Component
> public class HelloManager {
> private static Logger log = LoggerFactory.getLogger(HelloManager.class);
> @Reference
> private ConfigurationAdmin admin;
> @Activate
> protected synchronized void activate(ComponentContext context) {
> log.debug("ACTIVATE");
> log.debug("admin: {}", admin);
> try {
> Configuration[] confArray = admin.listConfigurations(null);
> if (confArray == null) {
> log.debug("confArray == null");
> } else {
> for (Configuration conf : confArray) {
> log.debug("conf: {}", conf);
> }
> }
> String pid = "com.barchart.hello.impl.CompSingle";
> Configuration conf = admin.getConfiguration(pid, null);
> conf.update();
> log.debug("conf: {}", conf);
> Dictionary props = conf.getProperties();
> if (props == null) {
> log.debug("props == null");
> props = new Properties();
> props.put("created", new Date().toString());
> }
> conf.update(props);
> } catch (Exception e) {
> log.error("", e);
> }
> }
> @Deactivate
> protected synchronized void deactivate(ComponentContext context) {
> log.debug("DEACTIVATE");
> }
> }
> #################
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira