startlevel is not an appropriate solution for this problem. Your original code doesn’t show the use of the service tracker. Your replacement code appears to assume that every referenced service is already present at activation. In order to assure this I suggest you supply your component with a mandatory configuration specifying <targetname>.cardinality.minimum, or adjust your code to take account of dynamic referenced service appearance and disappearance. I don’t know how the new R7 features work with this property but I’d be surprised if constructor injection didn’’t take it into account.
david jencks > On Sep 21, 2018, at 5:16 PM, David Daniel <david.daniel.1...@gmail.com> wrote: > > Adding a cardinality did not seem to solve the issue. It appears to be an > issue with the startlevel as stopping and starting the bundle worked and > the only bundle that started before it was added. Is there an example of > the new R7 startlevel stuff in felix. I would like to give the bundle I > want loaded last a start level of 5 or something. > > Thanks, > David > > 45|Active | 1|web.server (1.0.0.SNAPSHOT)|1.0.0.SNAPSHOT > 46|Active | 1|web.ui.site (1.0.0.SNAPSHOT)|1.0.0.SNAPSHOT > 47|Active | 1|web.ui.qr (1.0.0.SNAPSHOT)|1.0.0.SNAPSHOT > g! stop 45 > > 20:11:57 > 20:12:09.153 [pipe-stop 45] INFO Events.Service.web.server:? - > ServiceEvent UNREGISTERING [com.mobigov.web.server.HandlerBuilder] > 20:12:09.164 [ixDispatchQueue] INFO Events.Bundle.web.server:? - > BundleEvent STOPPED > g! start 45 > > 20:12:09 > 20:12:16.266 [pipe-start 45] INFO Events.Service.web.server:? - > ServiceEvent REGISTERED [com.mobigov.web.server.HandlerBuilder] > 20:12:16.285 [pipe-start 45] INFO c.mobigov.web.server.HandlerBuilder:31 - > Adding Handler for: /communication > 20:12:16.286 [pipe-start 45] INFO c.mobigov.web.server.HandlerBuilder:31 - > Adding Handler for: /web.ui > 20:12:16.286 [pipe-start 45] INFO c.mobigov.web.server.HandlerBuilder:31 - > Adding Handler for: /qr > 20:12:16.287 [pipe-start 45] INFO c.mobigov.web.server.UndertowServer:42 - > Directory exists > 20:12:16.299 [ixDispatchQueue] INFO Events.Bundle.web.server:? - > BundleEvent STARTED > > On Thu, Sep 20, 2018 at 11:30 PM Eric Norman <eric.d.nor...@gmail.com> > wrote: > >> Are those the SCR annotations, or the newer official OSGi declarative >> service annotations? >> >> In either cause, I suppose you'd need to to adjust the cardinality property >> on the @Reference annotation to tell it you want multiple service >> references. >> >> Regards, >> -Eric >> >> On Thu, Sep 20, 2018 at 7:42 PM David Daniel <david.daniel.1...@gmail.com> >> wrote: >> >>> I had switched form a servicetracker to constructor injection of a list >>> with scr 2.1.6 . The servicetracker got all the services correctly but >> the >>> list is only getting 1. I was wondering if I did not understand >> something >>> or if there was an open bug. >>> >>> Thanks for any help, >>> David >>> >>> From >>> >>> try { >>> mBundleContext = bc; >>> String filterString = "(" + Constants.OBJECTCLASS + "=" + >>> IHandlerFactory.class.getName() + ")"; >>> Filter filter = bc.createFilter(filterString); >>> tracker = new ServiceTracker(bc, filter, this); >>> tracker.open(); >>> >>> } catch (InvalidSyntaxException e) { >>> if (log != null) { >>> log.log(LogService.LOG_ERROR, e.getMessage()); >>> } >>> } >>> >>> To >>> >>> @Activate >>> public HandlerBuilder(@Reference List<IHandlerFactory> handlerFactories) >> { >>> pathHandler.addExactPath("/", new Forwarding()); >>> pathHandler.addExactPath("/manifest.json", new Manifest()); >>> for(IHandlerFactory handler : handlerFactories) { >>> if (handler.Type().equals("path")) { >>> if (handler instanceof IPathHandlerFactory) { >>> logger.info("Adding Handler for: " + ((IPathHandlerFactory) >>> handler).Prefix >>> ()); >>> pathHandler.addPrefixPath(((IPathHandlerFactory) handler).Prefix(), >>> handler. >>> Get()); >>> } >>> } >>> } >>> } >>> >> --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@felix.apache.org For additional commands, e-mail: users-h...@felix.apache.org