felix-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "PN. Truong Phuc" <pn.truongp...@gmail.com>
Subject Re: Issue when using Felix Http service bundle package.
Date Wed, 02 Feb 2011 05:48:34 GMT
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 <robw@ascert.com> 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: users-unsubscribe@felix.apache.org
> For additional commands, e-mail: users-help@felix.apache.org
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message