Have you check the HTTP service bundle properties? I think by default, the bundle starts the bridge service and you need to set the org.apache.felix.http.jettyEnabled=true to get the HTTP service to work. Also check that the org.osgi.service.http.port is set to an unused port. You can set these in the config.properties if you don't have the config admin installed.
Allen On Tue, Feb 1, 2011 at 9:48 PM, PN. Truong Phuc <[email protected]>wrote: > Hi Rob, > I see that my bundle should be started after the HTTP service. I had > started > my bundle after the HTTP service bundle package start and still it can't > see > any http service. > > I found that, the HTTP bundle just start the bridge service not HTTP > service. > > Thanks, > Regards > > > Phuc PN. Truong > > > On Wed, Feb 2, 2011 at 12:23 PM, Rob Walker <[email protected]> wrote: > > > > > > > The state of osgi bundle is: > >> > >> 0|Active | 0|System Bundle (3.0.6) > >> 1|Active | 1|Apache Felix Bundle Repository (1.6.2) > >> 2|Active | 1|Apache Felix Gogo Command (0.6.1) > >> 3|Active | 1|Apache Felix Gogo Runtime (0.6.1) > >> 4|Active | 1|Apache Felix Gogo Shell (0.6.1) > >> 5|Active | 1|Apache Felix Http Bundle (2.0.4) > >> > >> Thanks, > >> > > It does look to be started here - although I note you aren't running any > > kind of log service, which might help you be showing log and diagnostic > > messages > > > > public void start(BundleContext bc) throws Exception { > >>>>> ServiceReference sRef = > >>>>> > >>>>> bc.getServiceReference(HttpService.class.getName()); > >>>>>> > >>>>>> if (sRef != null) > >>>>> > >>>>> { > >>>>> > >>>>> HttpService service = (HttpService) bc.getService(sRef); > >>>>> > >>>>> service.registerServlet("/hello", new Service(), null, null); > >>>>> > >>>>> } > >>>>> > >>>> One thing to be very careful of here is startup timing. You cannot > > simply assume in your start() method that other services will be started > at > > this point. And if they aren't, you won't get a service reference for > them. > > > > There are various approaches around this - the easiest is to use one of > the > > lifecycle handlers, like Felix DS, to manage this for you. > > > > An alternative is to use your own service listeners, but this can involve > a > > lot more coding on your part - especially for boundary cases. > > > > As a simple/quick hack to see if this is the problem - you could put all > > your base bundles in a lower start level than your test bundle. This > isn't > > an especially nice solution, but it can work. > > > > - Rob Walker > > > > > > > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: [email protected] > > For additional commands, e-mail: [email protected] > > > > >

