Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [osgi-users] Dynamic component behavior

Tim and Dirk,

Thank you from the bottom of my heart. I have found the culprit, but it leads me to another question.

Initially instead of using scr:list I used services, which wouldn't show my "ActivatorComponent". So I went about to do an scr:info on each one of the referenced services and they all came up as either satisfied or active.

Once I did an scr:list, I saw that my "ActivatorComponent" was unsatisfied and then I did an scr:info on it and saw the culprit which is:
osgi> Component Description: com.castortech.iris.image.provider.IrisImageImpl
=======================================================================
Class:         com.castortech.iris.image.provider.IrisImageImpl
Bundle:        215 (com.castortech.iris.image.provider:1.0.0.qualifier)
Enabled:       true
Immediate:     false
Services:      [com.castortech.iris.image.IrisImage]
Scope:         singleton
Config PID(s): [IrisImage_PID], Policy: require
Base Props:    (0 entries)

Component Configuration Id: 2301
--------------------------------
State:        ACTIVE
Service:      1141 [com.castortech.iris.image.IrisImage]
    Used by bundle 141 (com.castortech.iris.irisdb.core:1.0.0.qualifier)
Config Props: (4 entries)
  component.id<Long> = 2301
  component.name<String> = com.castortech.iris.image.provider.IrisImageImpl
  imagePlugin<String> = com.castortech.iris.models.ecore.ba.edit
  service.pid<String> = IrisImage_PID
References:   (total 1)
  - imageProvider: com.castortech.iris.image.provider.internal.ImageProvider SATISFIED 1..1 static
    target=(*) scope=bundle (1 binding):
    * Bound to [654] from bundle 215 (com.castortech.iris.image.provider:1.0.0.qualifier)

It is in ACTIVE state with all references satisfied. Problem is that this was set with a required configuration, that Tim pointed as a possible cause. But how can it show as active in that case?

Cheers,
Alain




Alain Picard
Chief Strategy Officer
Castor Technologies Inc
o:514-360-7208
m:813-787-3424


On Tue, Jul 6, 2021 at 9:34 AM Tim Ward <timothyjward@xxxxxxxxxx> wrote:
Hi Alain,

Why wouldn't the service tracker return a service reference for it?

What is the state of the "ActivatorComponents" component in the ServiceComponentRuntime? 

If it shows as “unsatisfied" then it means that there’s still something missing. This is most likely to be a “required” configuration policy with no corresponding configuration present. The next most likely is a reference that your internal tool has missed. Unlikely, but possible, is that one of your references has a minimum cardinality defined and there aren’t enough services to satisfy it.

If the component is “satisfied” or “active” then check the services that it exposes. Does it actually register as a service? If it is a registering a service then is it possible that the Service Tracker is looking for a different interface than the one exposed by the component? If neither of these are the problem then check the class space of the two bundles. The Service Tracker will only discover services that are compatible with the ClassLoader associated with the bundle context used to create the tracker. If there are two different exporters of the service interface then this is likely your problem. You can confirm this by telling the service tracker to track all services when opening it (see https://javadoc.io/static/org.osgi/osgi.core/7.0.0/org/osgi/util/tracker/ServiceTracker.html#open-boolean-). If it shows up when you pass true, but not if you pass false, then your runtime has some class space issues.

I hope that this helps,

Tim

On 5 Jul 2021, at 18:26, Alain Picard <picard@xxxxxxxxxxxxxx> wrote:


On Mon, Jul 5, 2021 at 12:15 PM Dirk Fauth via osgi-users <osgi-users@xxxxxxxxxxx> wrote:

Well, I wanted to switch to dynamic services and had been using greedy before but looking at the example here I lost that part, while having the referenced page open at the same time.

So that resolves this issue, thanks Dirk, but still leaves me with the 2nd one, where the service fails to load most of the time (restarting a few times and I will finally find a run that works).

In the same realm and with the same component, I'm facing another issue. And please note that this is not new code but just now called earlier in the startup process.

Here I have a service tracker used to get my service reference for the ActivatorComponents shown in my previous email.

Listing services from the console and matching all references or using our internal tool returns:
osgi> checkRefs com.castortech.iris.emf.irisdb.custom.activator.ActivatorComponents
Checking for com.castortech.iris.emf.irisdb.custom.activator.ActivatorComponents references
  Referenced service com.castortech.iris.emf.irisdb.custom.api.BaTypeUtils/dynamic is registered
  Referenced service com.castortech.iris.emf.irisdb.custom.api.CoreAttributeUtils/dynamic is registered
  Referenced service com.castortech.iris.emf.irisdb.custom.api.CoreClassUtils/dynamic is registered
  Referenced service com.castortech.iris.emf.irisdb.custom.api.CoreInstanceUtils/dynamic is registered
  Referenced service com.castortech.iris.emf.irisdb.custom.api.CoreModelHelper/dynamic is registered
  Referenced service com.castortech.iris.emf.irisdb.custom.api.CoreOptFeatureUtils/dynamic is registered
  Referenced service com.castortech.iris.emf.irisdb.custom.api.CoreRelationshipUtils/dynamic is registered
  Referenced service com.castortech.iris.emf.irisdb.custom.api.CoreStereotypeHelper/dynamic is registered
  Referenced service com.castortech.iris.emf.irisdb.custom.api.CoreStereotypeUtils/dynamic is registered
  Referenced service com.castortech.iris.emf.irisdb.custom.api.CoreTypeUtils/dynamic is registered
  Referenced service com.castortech.iris.emf.irisdb.custom.api.CoreUtils/dynamic is registered
  Referenced service com.castortech.iris.utils.eclipse.iemf.custom.GenericExpressionResolver/dynamic is registered
  Referenced service com.castortech.util.html.IHtmlService/dynamic is registered
  Referenced service com.castortech.iris.image.IrisImage/dynamic is registered
  Referenced service com.castortech.iris.emf.irisdb.custom.api.NotificationHelper/dynamic is registered
  Referenced service com.castortech.iris.emf.irisdb.custom.api.TimestampableElementUtils/optional,dynamic is registered

indicating that all dependent referenced services are registered and ready to go. Why wouldn't the service tracker return a service reference for it? BTW, we use a retry process that is tested a number of times over about 5 secs, just to make sure that things get resolved. I have never seen this before.
_______________________________________________
osgi-users mailing list
osgi-users@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/osgi-users

_______________________________________________
osgi-users mailing list
osgi-users@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/osgi-users

Back to the top