Thanks Stephan,

I will include the fix for next release cycle.

Regards
JB

> Le 2 sept. 2020 à 13:23, Siano, Stephan <[email protected]> a écrit :
> 
> Hi Jean-Baptiste,
>  
> I have created https://issues.apache.org/jira/browse/KARAF-6836 
> <https://issues.apache.org/jira/browse/KARAF-6836> for the issue. Thanks for 
> your advice.
>  
> Best regards
> Stephan
>  
> From: Jean-Baptiste Onofre <[email protected]> 
> Sent: Mittwoch, 2. September 2020 11:54
> To: [email protected]
> Subject: Re: Restart issue with subsystem runtime
>  
> Hi Stephan,
>  
> I guess you are using the subsystem feature. So, true: the start-level is set 
> to 30 for both subsystem API and Core.
>  
> I don’t see any strong reason why not starting at default start level. That’s 
> maybe a global change in the features XML.
>  
> Can you please create a Jira, I will that for 4.2.10/4.3.0 ?
>  
> Sorry for the inconvenience.
>  
> Regards
> JB
> 
> 
> Le 2 sept. 2020 à 11:45, Siano, Stephan <[email protected] 
> <mailto:[email protected]>> a écrit :
>  
> Hi,
>  
> We are running a custom distribution based on Karaf 4.2.9. This distribution 
> also contains the subsystem runtime (as provided by the subsystems Karaf 
> feature). Most bundles are running in the root subsystem (all the stuff that 
> is not installed via subsystems), but for some parts we want to run isolated 
> we have scoped (composite) subsystems.
>  
> All this is running fine, but if we stop the container (while a scoped 
> subsystem is running that is referencing packages from the root subsystem) 
> and try to start the Karaf container again, we are getting the following 
> error:
> 2020 09 01 03:50:15#+00#ERROR#Felix##anonymous#FelixStartLevel#####Bundle 
> org.apache.aries.subsystem.core [148] Error starting 
> mvn:org.apache.aries.subsystem/org.apache.aries.subsystem.core/2.0.10 
> (org.osgi.framework.BundleException: Activator start error in bundle 
> org.apache.aries.subsystem.core [148].)org.osgi.framework.BundleException: 
> Activator start error in bundle org.apache.aries.subsystem.core [148].
>                 at 
> org.apache.felix.framework.Felix.activateBundle(Felix.java:2290)
>                 at 
> org.apache.felix.framework.Felix.startBundle(Felix.java:2146)
>                 at 
> org.apache.felix.framework.Felix.setActiveStartLevel(Felix.java:1373)
>                 at 
> org.apache.felix.framework.FrameworkStartLevelImpl.run(FrameworkStartLevelImpl.java:308)
>                 at java.lang.Thread.run(Thread.java:836)
> Caused by: org.osgi.service.subsystem.SubsystemException: 
> org.osgi.framework.BundleException: Cannot start bundle 
> org.apache.xbean.finder [197] because its start level is 80, which is greater 
> than the framework's start level of 30.
>                 at 
> org.apache.aries.subsystem.core.internal.StartAction.run(StartAction.java:346)
>                 at java.security.AccessController.doPrivileged(Native Method)
>                 at 
> org.apache.aries.subsystem.core.internal.BasicSubsystem.start(BasicSubsystem.java:321)
>                 at 
> org.apache.aries.subsystem.core.internal.Activator.activate(Activator.java:160)
>                 at 
> org.apache.aries.subsystem.core.internal.Activator.addingService(Activator.java:274)
>                 at 
> org.osgi.util.tracker.ServiceTracker$Tracked.customizerAdding(ServiceTracker.java:941)
>                 at 
> org.osgi.util.tracker.ServiceTracker$Tracked.customizerAdding(ServiceTracker.java:870)
>                 at 
> org.osgi.util.tracker.AbstractTracked.trackAdding(AbstractTracked.java:256)
>                 at 
> org.osgi.util.tracker.AbstractTracked.trackInitial(AbstractTracked.java:183)
>                 at 
> org.osgi.util.tracker.ServiceTracker.open(ServiceTracker.java:318)
>                 at 
> org.osgi.util.tracker.ServiceTracker.open(ServiceTracker.java:261)
>                 at 
> org.apache.aries.subsystem.core.internal.Activator.start(Activator.java:129)
>                 at 
> org.apache.felix.framework.util.SecureAction.startActivator(SecureAction.java:697)
>                 at 
> org.apache.felix.framework.Felix.activateBundle(Felix.java:2240)
>                 ... 4 common frames omitted
> Caused by: org.osgi.framework.BundleException: Cannot start bundle 
> org.apache.xbean.finder [197] because its start level is 80, which is greater 
> than the framework's start level of 30.
>                 at 
> org.apache.felix.framework.Felix.startBundle(Felix.java:2013)
>                 at 
> org.apache.felix.framework.BundleImpl.start(BundleImpl.java:998)
>                 at 
> org.apache.aries.subsystem.core.internal.StartAction.startBundleResource(StartAction.java:565)
>                 at 
> org.apache.aries.subsystem.core.internal.StartAction.startResource(StartAction.java:593)
>                 at 
> org.apache.aries.subsystem.core.internal.StartAction.run(StartAction.java:306)
>                 at 
> org.apache.aries.subsystem.core.internal.StartAction.startSubsystemResource(StartAction.java:627)
>                 at 
> org.apache.aries.subsystem.core.internal.StartAction.startResource(StartAction.java:591)
>                 at 
> org.apache.aries.subsystem.core.internal.StartAction.run(StartAction.java:306)
>                 ... 17 common frames omitted
> |
> 2020 09 01 
> 03:50:15#+00#ERROR#org.osgi.framework.FrameworkEvent##anonymous#FelixDispatchQueue#####FrameworkEvent
>  ERRORorg.osgi.framework.BundleException: Activator start error in bundle 
> org.apache.aries.subsystem.core [148].
>                 at 
> org.apache.felix.framework.Felix.activateBundle(Felix.java:2290)
>                 at 
> org.apache.felix.framework.Felix.startBundle(Felix.java:2146)
>                 at 
> org.apache.felix.framework.Felix.setActiveStartLevel(Felix.java:1373)
>                 at 
> org.apache.felix.framework.FrameworkStartLevelImpl.run(FrameworkStartLevelImpl.java:308)
>                 at java.lang.Thread.run(Thread.java:836)
> Caused by: org.osgi.service.subsystem.SubsystemException: 
> org.osgi.framework.BundleException: Cannot start bundle 
> org.apache.xbean.finder [197] because its start level is 80, which is greater 
> than the framework's start level of 30.
>                 at 
> org.apache.aries.subsystem.core.internal.StartAction.run(StartAction.java:346)
>                 at java.security.AccessController.doPrivileged(Native Method)
>                 at 
> org.apache.aries.subsystem.core.internal.BasicSubsystem.start(BasicSubsystem.java:321)
>                 at 
> org.apache.aries.subsystem.core.internal.Activator.activate(Activator.java:160)
>                 at 
> org.apache.aries.subsystem.core.internal.Activator.addingService(Activator.java:274)
>                 at 
> org.osgi.util.tracker.ServiceTracker$Tracked.customizerAdding(ServiceTracker.java:941)
>                 at 
> org.osgi.util.tracker.ServiceTracker$Tracked.customizerAdding(ServiceTracker.java:870)
>                 at 
> org.osgi.util.tracker.AbstractTracked.trackAdding(AbstractTracked.java:256)
>                 at 
> org.osgi.util.tracker.AbstractTracked.trackInitial(AbstractTracked.java:183)
>                 at 
> org.osgi.util.tracker.ServiceTracker.open(ServiceTracker.java:318)
>                 at 
> org.osgi.util.tracker.ServiceTracker.open(ServiceTracker.java:261)
>                 at 
> org.apache.aries.subsystem.core.internal.Activator.start(Activator.java:129)
>                 at 
> org.apache.felix.framework.util.SecureAction.startActivator(SecureAction.java:697)
>                 at 
> org.apache.felix.framework.Felix.activateBundle(Felix.java:2240)
>                 ... 4 common frames omitted
> Caused by: org.osgi.framework.BundleException: Cannot start bundle 
> org.apache.xbean.finder [197] because its start level is 80, which is greater 
> than the framework's start level of 30.
>                 at 
> org.apache.felix.framework.Felix.startBundle(Felix.java:2013)
>                 at 
> org.apache.felix.framework.BundleImpl.start(BundleImpl.java:998)
>                 at 
> org.apache.aries.subsystem.core.internal.StartAction.startBundleResource(StartAction.java:565)
>                 at 
> org.apache.aries.subsystem.core.internal.StartAction.startResource(StartAction.java:593)
>                 at 
> org.apache.aries.subsystem.core.internal.StartAction.run(StartAction.java:306)
>                 at 
> org.apache.aries.subsystem.core.internal.StartAction.startSubsystemResource(StartAction.java:627)
>                 at 
> org.apache.aries.subsystem.core.internal.StartAction.startResource(StartAction.java:591)
>                 at 
> org.apache.aries.subsystem.core.internal.StartAction.run(StartAction.java:306)
>                 ... 17 common frames omitted
> |
>  
> The bundle that fails to start is a random bundle from the root subsystem. As 
> a consequence the subsystem runtime doesn’t start.
>  
> I have analyzed the code and it seems that the subsystem runtime tries to 
> start all bundles from the root subsystem when it starts up. However as the 
> subsystem runtime has a start level of 30 and most bundles in the root 
> subsystem have a start level of 80 and obviously Felix refuses the startup of 
> the bundles at that time.
>  
> For testing I have copied the subsystems feature into a subsystems-patched 
> feature with the only difference that I removed the start-level="30" 
> attribute from the three bundles directly included in this feature (Aries 
> subsystem-api, subsystem-core and the Karaf subsystem-core bundle). As a 
> result the subsystem-core bundle was started at start level 80, and the issue 
> did not occur anymore.
>  
> Is there a reason why these bundles are started with start level 30?
>  
> Best regards
> Stephan

Reply via email to