You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@felix.apache.org by Chuck Davis <cj...@gmail.com> on 2022/09/16 23:12:50 UTC

Re: repeated calls to Activator

I am attempting to refactor a project into bundles which number 16
presently.  I have a "base" bundle that all others depend on.  The
activator of that bundle is getting called for every other bundle that gets
activated.  Is this to be expected?  It seems to me the framework should
only call the activator a single time.  I have been unsuccessful finding
the reason and it means I cannot do setup in the activator because it gets
called 15 times.  Any insight would be helpful.  Thanks.

Re: repeated calls to Activator

Posted by Chuck Davis <cj...@gmail.com>.
Raymond, thank you again.  Your pointers directed me to the error of my
ways.  The problem was actually in my POM files so it looks like all I have
to do is fix them and the deed will be done.  I fixed two of the POM files
and it solved their problem.....only 13 to go!

On Sat, Sep 17, 2022 at 9:28 AM Chuck Davis <cj...@gmail.com> wrote:

> Raymond, thank you for the pointers.  I have made a little progress this
> a.m. creating a new project -- starting from scratch.  Favorable result so
> far -- maybe I'm off and running to find the problem I've generated.  I
> will definitely check out your pointers as well.
>
> Thanks much.
>
> CD
>
> On Sat, Sep 17, 2022 at 8:35 AM Raymond Augé
> <ra...@liferay.com.invalid> wrote:
>
>> My suspicion is that either:
>> A) you have the "shared" bundle's activator in an exported package, and it
>> is detected (from the classpath) as the activator (via an imported
>> package)
>> in every other bundle (less likely).
>> B) every bundle that consumes the "shared" bundle dependency, is
>> accidentally slurping in the activator (package) and detecting it as its
>> own activator impl (more likely).
>>
>> A test you could try to discover what's happening is to print the bundle
>> from the BundleContext passed to the activator `start(BundleContext)`
>> method and also the classloader of the BundleActivator instance being
>> called.
>>
>> System.out.println("=====> THE BUNDLE: " + bundleContext.getBundle());
>> System.out.println("=====> THE CLASSLOADER: " +
>> getClass().getClassLoader());
>>
>> We can take it from there.
>>
>>
>>
>> On Fri, Sep 16, 2022 at 7:13 PM Chuck Davis <cj...@gmail.com> wrote:
>>
>> > I am attempting to refactor a project into bundles which number 16
>> > presently.  I have a "base" bundle that all others depend on.  The
>> > activator of that bundle is getting called for every other bundle that
>> gets
>> > activated.  Is this to be expected?  It seems to me the framework should
>> > only call the activator a single time.  I have been unsuccessful finding
>> > the reason and it means I cannot do setup in the activator because it
>> gets
>> > called 15 times.  Any insight would be helpful.  Thanks.
>> >
>>
>>
>> --
>> *Raymond Augé* (@rotty3000)
>> Senior Software Architect *Liferay, Inc.* (@Liferay)
>> OSGi Fellow, Java Champion
>>
>

Re: repeated calls to Activator

Posted by Chuck Davis <cj...@gmail.com>.
Raymond, thank you for the pointers.  I have made a little progress this
a.m. creating a new project -- starting from scratch.  Favorable result so
far -- maybe I'm off and running to find the problem I've generated.  I
will definitely check out your pointers as well.

Thanks much.

CD

On Sat, Sep 17, 2022 at 8:35 AM Raymond Augé
<ra...@liferay.com.invalid> wrote:

> My suspicion is that either:
> A) you have the "shared" bundle's activator in an exported package, and it
> is detected (from the classpath) as the activator (via an imported package)
> in every other bundle (less likely).
> B) every bundle that consumes the "shared" bundle dependency, is
> accidentally slurping in the activator (package) and detecting it as its
> own activator impl (more likely).
>
> A test you could try to discover what's happening is to print the bundle
> from the BundleContext passed to the activator `start(BundleContext)`
> method and also the classloader of the BundleActivator instance being
> called.
>
> System.out.println("=====> THE BUNDLE: " + bundleContext.getBundle());
> System.out.println("=====> THE CLASSLOADER: " +
> getClass().getClassLoader());
>
> We can take it from there.
>
>
>
> On Fri, Sep 16, 2022 at 7:13 PM Chuck Davis <cj...@gmail.com> wrote:
>
> > I am attempting to refactor a project into bundles which number 16
> > presently.  I have a "base" bundle that all others depend on.  The
> > activator of that bundle is getting called for every other bundle that
> gets
> > activated.  Is this to be expected?  It seems to me the framework should
> > only call the activator a single time.  I have been unsuccessful finding
> > the reason and it means I cannot do setup in the activator because it
> gets
> > called 15 times.  Any insight would be helpful.  Thanks.
> >
>
>
> --
> *Raymond Augé* (@rotty3000)
> Senior Software Architect *Liferay, Inc.* (@Liferay)
> OSGi Fellow, Java Champion
>

Re: repeated calls to Activator

Posted by Raymond Augé <ra...@liferay.com.INVALID>.
My suspicion is that either:
A) you have the "shared" bundle's activator in an exported package, and it
is detected (from the classpath) as the activator (via an imported package)
in every other bundle (less likely).
B) every bundle that consumes the "shared" bundle dependency, is
accidentally slurping in the activator (package) and detecting it as its
own activator impl (more likely).

A test you could try to discover what's happening is to print the bundle
from the BundleContext passed to the activator `start(BundleContext)`
method and also the classloader of the BundleActivator instance being
called.

System.out.println("=====> THE BUNDLE: " + bundleContext.getBundle());
System.out.println("=====> THE CLASSLOADER: " +
getClass().getClassLoader());

We can take it from there.



On Fri, Sep 16, 2022 at 7:13 PM Chuck Davis <cj...@gmail.com> wrote:

> I am attempting to refactor a project into bundles which number 16
> presently.  I have a "base" bundle that all others depend on.  The
> activator of that bundle is getting called for every other bundle that gets
> activated.  Is this to be expected?  It seems to me the framework should
> only call the activator a single time.  I have been unsuccessful finding
> the reason and it means I cannot do setup in the activator because it gets
> called 15 times.  Any insight would be helpful.  Thanks.
>


-- 
*Raymond Augé* (@rotty3000)
Senior Software Architect *Liferay, Inc.* (@Liferay)
OSGi Fellow, Java Champion