You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@karaf.apache.org by Steinar Bang <sb...@dod.no> on 2024/06/25 19:07:25 UTC
Re: How to make spifly run at run-level 40 instead of the default run-level 80?
>>>>> Steinar Bang <sb...@dod.no>:
> One other workaround could have been running everything at run-level 80
> and have a component depending on the SPI services of liquibase. The
> problem with that, however, is that the services have cardinality
> multiple, so there is no way for a component to know when they are
> finished starting.
> I'm still thinking, but I take all ideas, and suggestions.
Another workaround turned out to be to downgrade liquibase's SPI Fly to 1.3.6.
Then shiro-core pulls in SPI Fly 1.3.7 on run-level 80 and liquibase
start the SPI Fly 1.3.6 bundle on run-level 40.
Then I get this:
karaf@root()> bundle:list -t 35 | grep -i spi
88 │ Active │ 40 │ 1.3.6 │ Apache Aries SPI Fly Dynamic Weaving Bundle
196 │ Active │ 80 │ 1.3.7 │ Apache Aries SPI Fly Dynamic Weaving Bundle
karaf@root()>
But other than that things seems to be working perfectly.
I have removed <Require-Capability> from my liquibase-using bundles,
because the liquibase-core bundle itself has <Require-Capability>
https://github.com/liquibase/liquibase/blob/master/liquibase-standard/pom.xml#L252
matching its <Provide-Capability>
https://github.com/liquibase/liquibase/blob/master/liquibase-standard/pom.xml#L217
It just needs an SPI Fly at the run level it is started on to make them
all available...
But I would be happier if I could make it just be SPI Fly 1.3.7...
So, @JB...? Is there a way to "force" the run level for a particular bundle?
Re: How to make spifly run at run-level 40 instead of the default run-level 80?
Posted by Steinar Bang <sb...@dod.no>.
>>>>> João Assunção <jo...@exploitsys.com>:
> Hello Steinar.
> I suggest checking out the featuresProcessing capability
> in karaf-maven-plugin. Not sure if it can achieve your objective...
> For example I have this in karaf-maven-plugin:
> ...
> <featuresProcessing>${project.basedir}/features-processing.xml</featuresProcessing>
> ...
> and use the following features-processing.xml to replace a bundle
Thanks! I looked into this... but I wasn't sure if changing the
start-level for an existing bundle is what it was intended for... or even
if it would work.
But I have had real success with lowering the start level of
spifly.dynamic.bundle 1.3.6 to something lower than the liquibase-core
bundle (which starts at start level 40).
So I have created a Jira: https://issues.apache.org/jira/browse/KARAF-7843
And also a PR to do what the Jira says.
I think what was happening when I started spifly.dynamic.bundle 1.3.7 as
a bundle in my feature, it was initially started at the requested start
level, but then it was evicted when shiro loads the spifly feature, and
replaced with the spifly.dynamic.bundle 1.3.7 at start level 80.
Re: How to make spifly run at run-level 40 instead of the default run-level 80?
Posted by João Assunção <jo...@exploitsys.com>.
Hello Steinar.
I suggest checking out the featuresProcessing capability
in karaf-maven-plugin. Not sure if it can achieve your objective...
For example I have this in karaf-maven-plugin:
...
<featuresProcessing>${project.basedir}/features-processing.xml</featuresProcessing>
...
and use the following features-processing.xml to replace a bundle
<?xml version="1.0" encoding="UTF-8"?>
> <featuresProcessing xmlns="
> http://karaf.apache.org/xmlns/features-processing/v1.0.0" xmlns:f="
> http://karaf.apache.org/xmlns/features/v1.6.0">
>
> <bundleReplacements>
> <bundle
> originalUri="mvn:org.apache.felix/org.apache.felix.fileinstall/3.6.6"
> replacement="mvn:org.apache.felix/org.apache.felix.fileinstall/3.6.4"
> mode="maven" />
> </bundleReplacements>
>
> </featuresProcessing>
>
Check the following xsd for more options:
https://github.com/apache/karaf/blob/main/features/core/src/main/resources/org/apache/karaf/features/karaf-features-processing-1.0.0.xsd
Regards,
João Assunção
Email: joao.assuncao@exploitsys.com
Web: www.exploitsys.com
On Tue, Jun 25, 2024 at 8:10 PM Steinar Bang <sb...@dod.no> wrote:
> >>>>> Steinar Bang <sb...@dod.no>:
>
> >> One other workaround could have been running everything at run-level 80
> >> and have a component depending on the SPI services of liquibase. The
> >> problem with that, however, is that the services have cardinality
> >> multiple, so there is no way for a component to know when they are
> >> finished starting.
>
> >> I'm still thinking, but I take all ideas, and suggestions.
>
> > Another workaround turned out to be to downgrade liquibase's SPI Fly to
> 1.3.6.
>
> > Then shiro-core pulls in SPI Fly 1.3.7 on run-level 80 and liquibase
> > start the SPI Fly 1.3.6 bundle on run-level 40.
>
> > Then I get this:
> > karaf@root()> bundle:list -t 35 | grep -i spi
> > 88 │ Active │ 40 │ 1.3.6 │ Apache Aries SPI Fly
> Dynamic Weaving Bundle
> > 196 │ Active │ 80 │ 1.3.7 │ Apache Aries SPI Fly
> Dynamic Weaving Bundle
> > karaf@root()>
>
> > But other than that things seems to be working perfectly.
>
> > I have removed <Require-Capability> from my liquibase-using bundles,
> > because the liquibase-core bundle itself has <Require-Capability>
> >
> https://github.com/liquibase/liquibase/blob/master/liquibase-standard/pom.xml#L252
> > matching its <Provide-Capability>
> >
> https://github.com/liquibase/liquibase/blob/master/liquibase-standard/pom.xml#L217
>
> > It just needs an SPI Fly at the run level it is started on to make them
> > all available...
>
> > But I would be happier if I could make it just be SPI Fly 1.3.7...
>
> > So, @JB...? Is there a way to "force" the run level for a particular
> bundle?
>
> Alternatively: is there a way to set the run level of a feature you
> depend on?
>
> If so, then my liquibase feature could just depend on the karaf spifly
> feature and set its run-level to be 40.
>
> And I could simplify the liquibase-karaf-feature even more.
>
>
>
Re: How to make spifly run at run-level 40 instead of the default run-level 80?
Posted by Steinar Bang <sb...@dod.no>.
Ok, now I've read the docs: spifly.dynamic.bundle is intended to start
at a low start level, because it needs to be active before any bundles
it is to start SPI services in are started:
https://aries.apache.org/documentation/modules/spi-fly.html#_dynamic_weaving_bundle
I have created a Jira: https://issues.apache.org/jira/browse/KARAF-7843
I have created a PR that is also mentioned in a comment in the Jira:
https://github.com/apache/karaf/pull/1852
Re: How to make spifly run at run-level 40 instead of the default run-level 80?
Posted by Steinar Bang <sb...@dod.no>.
>>>>> Steinar Bang <sb...@dod.no>:
> Alternatively: is there a way to set the run level of a feature you
> depend on?
> If so, then my liquibase feature could just depend on the karaf spifly
> feature and set its run-level to be 40.
> And I could simplify the liquibase-karaf-feature even more.
I tried two things.
First (with no success), I tried setting start-level on the feature
dependency in src/main/feature/feature.xml (the template feature file)
<feature name="liquibase-core" start-level="${liquibase-core.start.level}" version="${liquibase.version}">
<feature>aries-proxy</feature>
<feature start-level="${liquibase-core.start.level}">spifly</feature>
</feature>
That didn't work. The start-level attribute was stripped from target/feature/feature.xml
Then some success: I set prerequisite="true" on the feature dependency.
<feature name="liquibase-core" start-level="${liquibase-core.start.level}" version="${liquibase.version}">
<feature>aries-proxy</feature>
<feature prerequisite="true">spifly</feature>
</feature>
Then liquibase ran fine on initial feature install.
But spifly was still running on level 80:
karaf@root()> bundle:list -t 35 | grep -i spi
62 │ Active │ 80 │ 1.3.7 │ Apache Aries SPI Fly Dynamic Weaving Bundle
karaf@root()>
Which meant that it probably wouldn't work on a karaf restart (and it
didn't).
To put it simply: all liquibase SPI services needs to be activated when
the first DataSource created by jdbc-config arrives.
And jdbc-config is running on level 80:
karaf@root()> bundle:list -t 34 | grep -i "jdbc config"
126 │ Active │ 80 │ 1.5.7 │ OPS4J Pax JDBC Config
karaf@root()>
(So far I have one workaround: install spifly 1.3.6 as a bundle on start-level=40)
(then it doesn't matter that something else loads spifly 1.3.7 on
start-level=80, it isn't used by liquibase)
Re: How to make spifly run at run-level 40 instead of the default run-level 80?
Posted by Steinar Bang <sb...@dod.no>.
>>>>> Steinar Bang <sb...@dod.no>:
>> One other workaround could have been running everything at run-level 80
>> and have a component depending on the SPI services of liquibase. The
>> problem with that, however, is that the services have cardinality
>> multiple, so there is no way for a component to know when they are
>> finished starting.
>> I'm still thinking, but I take all ideas, and suggestions.
> Another workaround turned out to be to downgrade liquibase's SPI Fly to 1.3.6.
> Then shiro-core pulls in SPI Fly 1.3.7 on run-level 80 and liquibase
> start the SPI Fly 1.3.6 bundle on run-level 40.
> Then I get this:
> karaf@root()> bundle:list -t 35 | grep -i spi
> 88 │ Active │ 40 │ 1.3.6 │ Apache Aries SPI Fly Dynamic Weaving Bundle
> 196 │ Active │ 80 │ 1.3.7 │ Apache Aries SPI Fly Dynamic Weaving Bundle
> karaf@root()>
> But other than that things seems to be working perfectly.
> I have removed <Require-Capability> from my liquibase-using bundles,
> because the liquibase-core bundle itself has <Require-Capability>
> https://github.com/liquibase/liquibase/blob/master/liquibase-standard/pom.xml#L252
> matching its <Provide-Capability>
> https://github.com/liquibase/liquibase/blob/master/liquibase-standard/pom.xml#L217
> It just needs an SPI Fly at the run level it is started on to make them
> all available...
> But I would be happier if I could make it just be SPI Fly 1.3.7...
> So, @JB...? Is there a way to "force" the run level for a particular bundle?
Alternatively: is there a way to set the run level of a feature you
depend on?
If so, then my liquibase feature could just depend on the karaf spifly
feature and set its run-level to be 40.
And I could simplify the liquibase-karaf-feature even more.