Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Equinox » Eclipse RCP with OSGi Service - Service not Starting(Service not starting (includes small example app))
Eclipse RCP with OSGi Service - Service not Starting [message #826590] Thu, 22 March 2012 05:01 Go to next message
Ludwig Moser is currently offline Ludwig Moser
Messages: 302
Registered: July 2009
Senior Member
hi,

i noticed that in my application my OSGi services are not starting up.
therefore i created a small application to test why. but i was not able to find out why.

you can Download the tiny OSGi Sample Application here

it constists of an Application, an OSGi Service (Interface and Impl) and a view Plugin, which tries to access the OSGi Service.

i hope someone of you can point me to my mistake
thanks in advance

[Updated on: Thu, 22 March 2012 05:01]

Report message to a moderator

Re: Eclipse RCP with OSGi Service [message #826626 is a reply to message #826590] Thu, 22 March 2012 05:54 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas Schindl
Messages: 5014
Registered: July 2009
Senior Member
So you are trying to use DS?

You are missing the following information in your
lumo.osgi.service.notification.impls MANIFEST.MF:

* Service-Component: OSGI-INF/NotificationService.
* Bundle-ActivationPolicy: lazy

Please also make sure that you have DS in your launch config!

Tom

Am 22.03.12 10:01, schrieb Ludwig Moser:
> hi,
>
> i noticed that in my application my OSGi services are not starting up.
> therefore i created a small application to test why. but i was not able
> to find out why.
>
> you can http://www.biooffice.at/tl_files/java/OSGi-Example.zip
>
> it constists of an Application, an OSGi Service (Interface and Impl) and
> a view Plugin, which tries to access the OSGi Service.
>
> i hope someone of you can point me to my mistake
> thanks in advance
>
Re: Eclipse RCP with OSGi Service [message #826647 is a reply to message #826626] Thu, 22 March 2012 06:31 Go to previous messageGo to next message
Ludwig Moser is currently offline Ludwig Moser
Messages: 302
Registered: July 2009
Senior Member
thanks (in my original code i do have the service-component included)

but why do i need Bundle-ActivationPolicy: lazy
makes no sense to me, as i want it activated immediately (which is done when its set to lazy...)

thanks a lot for this hint - it works now (both in my example and in the normal app!)
Re: Eclipse RCP with OSGi Service [message #826652 is a reply to message #826647] Thu, 22 March 2012 06:41 Go to previous messageGo to next message
Ludwig Moser is currently offline Ludwig Moser
Messages: 302
Registered: July 2009
Senior Member
err - i was too fast - its stil not working when exported.

EDIT: a build file was corrupted... so finally its fixed - thanks

[Updated on: Thu, 22 March 2012 07:10]

Report message to a moderator

Re: Eclipse RCP with OSGi Service [message #826675 is a reply to message #826652] Thu, 22 March 2012 07:18 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas Schindl
Messages: 5014
Registered: July 2009
Senior Member
Are your build.properties correct?

Tom

Am 22.03.12 11:41, schrieb Ludwig Moser:
> err - i was too fast - its stil not working when exported.
Re: Eclipse RCP with OSGi Service [message #826676 is a reply to message #826647] Thu, 22 March 2012 07:19 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas Schindl
Messages: 5014
Registered: July 2009
Senior Member
Am 22.03.12 11:31, schrieb Ludwig Moser:
> thanks (in my original code i do have the service-component included)
>
> but why do i need Bundle-ActivationPolicy: lazy
> makes no sense to me, as i want it activated immediately (which is done
> when its set to lazy...)

This equinox specific. Tom Watson has explained it once to me but I
can't remember.

Tom
Re: Eclipse RCP with OSGi Service [message #826682 is a reply to message #826647] Thu, 22 March 2012 07:24 Go to previous messageGo to next message
Paul Webster is currently offline Paul Webster
Messages: 6850
Registered: July 2009
Location: Ottawa
Senior Member

Ludwig Moser wrote on Thu, 22 March 2012 06:31
but why do i need Bundle-ActivationPolicy: lazy
makes no sense to me, as i want it activated immediately (which is done when its set to lazy...)



If you use DS a lot or are creating eclipse plugins as opposed to bundles, the lazy flag just tells equinox that it doesn't have to activate your bundle until the first time another bundle tries to load a class. ex: if you provide a service via DS and no one ever asks for it, your bundle won't be activated.

If you're in an OSGi application and you start all of your bundles yourself, it probably doesn't do anything for you.

PW


Re: Eclipse RCP with OSGi Service [message #826749 is a reply to message #826682] Thu, 22 March 2012 09:05 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas Schindl
Messages: 5014
Registered: July 2009
Senior Member
I don't think this is fully correct - lazy activation is REQUIRED when
you use DS - but Tom Watson can prove me wrong on this naturally. IIRC
it has something to do with backwards compat, ....

Tom

Am 22.03.12 12:24, schrieb Paul Webster:
> Ludwig Moser wrote on Thu, 22 March 2012 06:31
>> but why do i need Bundle-ActivationPolicy: lazy
>> makes no sense to me, as i want it activated immediately (which is
>> done when its set to lazy...)
>
>
>
> If you use DS a lot or are creating eclipse plugins as opposed to
> bundles, the lazy flag just tells equinox that it doesn't have to
> activate your bundle until the first time another bundle tries to load a
> class. ex: if you provide a service via DS and no one ever asks for it,
> your bundle won't be activated.
> If you're in an OSGi application and you start all of your bundles
> yourself, it probably doesn't do anything for you.
>
> PW
>
Re: Eclipse RCP with OSGi Service [message #826783 is a reply to message #826749] Thu, 22 March 2012 09:58 Go to previous messageGo to next message
Ludwig Moser is currently offline Ludwig Moser
Messages: 302
Registered: July 2009
Senior Member
i had one of my build properties fucked up (no clue why - linebreak and custom text in it?!?)
should never happen ;D
DS & Lazy Avctivation (was: Re: Eclipse RCP with OSGi Service) [message #827332 is a reply to message #826749] Fri, 23 March 2012 03:11 Go to previous message
Gunnar Wagenknecht is currently offline Gunnar Wagenknecht
Messages: 446
Registered: July 2009
Senior Member
Hi,
Am 22.03.2012 14:05, schrieb Tom Schindl:
> I don't think this is fully correct - lazy activation is REQUIRED when
> you use DS

DS in Equinox works as any other thing in OSGi. It's only fully
functional once any involved bundle (the DS implementation, the DS
provider as well as the DS consumer) is ACTIVE. Until that point it's
not fully functional. For example, it may discover your components and
the components may be fully satisfiable but they are not activated
because the DS framework does not load the component class because the
bundle is not ACTIVE. (*[1]) Here is when Bundle-ActivationPolicy: lazy
comes into play. It allows the DS framework to auto-start the bundle in
order to load the component class.

[1]: Note, in OSGi classes from a RESOLVED bundle can be loaded. Thus, I
think its the DS implementation that puts the additional ACTIVE
constraint onto that model.


-Gunnar




--
Gunnar Wagenknecht
gunnar@xxxxxxxx
http://wagenknecht.org/
Previous Topic:Control based authorization in eclipse RCP
Next Topic:Download page legend
Goto Forum:
  


Current Time: Sun Apr 20 18:12:59 EDT 2014

Powered by FUDForum. Page generated in 0.01861 seconds