David, I tested with the discovery demo. On equinox as well as felix. It fails, but not always. I can get it to always work, if I add the zookeeper.cfg to the load directory after starting all services. But as soon as the cfg is in the cache, a restart fails again.
I looked at the source, and the only thing I can see is indeed a race condition at the updated callback. I guess services are registered before the register method is completely done and returned. So the config manager already starts updating the managed services which leads to the nullpointer. After reading the OSGi javadoc I think the start method has to be synchronized. From http://www.osgi.org/javadoc/r2/org/osgi/service/cm/ManagedService.html#updated%28java.util.Dictionary%29 : - The Configuration Admin service must call this method on a thread other than the thread which initiated the callback. This implies that implementors of Managed Service can be assured that the callback will not take place during registration when they execute the registration in a synchronized method. While the stop is synchronized, the start isn't. Can this be the problem? Thanx in advance! On Mon, Dec 7, 2009 at 4:47 PM, David Bosschaert <[email protected] > wrote: > Hi Alexander, > > I just walked through the Discovery Demo as described here: > http://cxf.apache.org/dosgi-discovery-demo-page.html > and it works fine for me. > > Looking at the source code where you get the exception: > > java.lang.NullPointerException > > at > > > org.apache.cxf.dosgi.discovery.zookeeper.Activator.updated(Activator.java:60) > > to me it seems like the updated() callback is made before the > bundle.start() has returned. Hmmm, there might be a race condition > here ... > > Is it possible for you to provide a test case that consistently fails? > Otherwise, did you walk through the Discovery Demot page mentioned > above? Does that work for you? > > Thanks, > > David > > 2009/12/7 Alexander Broekhuis <[email protected]>: > > Hi all, > > > > When using the 1.1 release, I get a nullpointer if discovery is used: > > > > *ERROR* {org.osgi.service.cm. > > ManagedService}={service.pid=org.apache.cxf.dosgi.discovery.zookeeper, > > zookeeper.port=2181, zookeeper.timeout=3000, service.id=38}: Unexpected > > problem updating configuration > > java.lang.NullPointerException > > at > > > org.apache.cxf.dosgi.discovery.zookeeper.Activator.updated(Activator.java:60) > > at > > > org.apache.felix.cm.impl.ConfigurationManager$ManagedServiceUpdate.run(ConfigurationManager.java:959) > > at org.apache.felix.cm.impl.UpdateThread.run(UpdateThread.java:88) > > > > I used the 1.1 snapshot before, and never had this problem with > discovery. > > Is there something I forgot? > > > > I am using the singlebundle release with the latest (3.2.1) zookeeper. > > > > -- > > Met vriendelijke groet, > > > > Alexander Broekhuis > > > -- Met vriendelijke groet, Alexander Broekhuis
