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 2021/04/08 18:29:50 UTC
Is there a command that can list the availability of a package
I would like to find out what version of package org.apache.commons.lang3.builder
is available in the karaf 4.3.1 runtime?
Is there a karaf shell command that provide this information?
The problem I'm encountering is that when I build this bundle[1] with
the karaf 4.3.1 BoM, I get the following error when trying to load a
feature[2] that loads a different bundle[3] that in turn loads the [1]
bundle, I get this error:
https://gist.github.com/steinarb/b1d76bd2698e7831d6ef7478399bb35a
If I build [1] with the 4.3.0 or 4.2.11 BoM and then build the
intermediate bundle[3] against that snapshot, and then builds
authservice[4], then feature [2] loads fine.
The interesting bit from the failing integration test, is this at the
end:
https://gist.github.com/steinarb/b1d76bd2698e7831d6ef7478399bb35a#file-authservice-integration-test-L214
If I diff the manifest of beans.immutable built with 4.2.11 or 4.3.0 BoM
against the maniest of beans.immutable built with the 4.3.1 BoM, the
difference is this:
b@lorenzo:~/workspaces/ws03/authservice$ diff -u /tmp/immutable-bean-manifest-mf-01 /tmp/immutable-bean-manifest-mf-02
--- /tmp/immutable-bean-manifest-mf-01 2021-04-08 18:37:30.638799307 +0200
+++ /tmp/immutable-bean-manifest-mf-02 2021-04-08 18:36:25.871626006 +0200
@@ -1,5 +1,5 @@
Manifest-Version: 1.0
-Bnd-LastModified: 1617899815331
+Bnd-LastModified: 1617899489360
Build-Jdk-Spec: 11
Bundle-Description: Common code for Java beans
Bundle-License: http://www.apache.org/licenses/LICENSE-2.0
@@ -9,7 +9,6 @@
Bundle-Version: 1.1.0.SNAPSHOT
Created-By: Apache Maven Bundle Plugin
Export-Package: no.priv.bang.beans.immutable;version="1.1.0"
-Import-Package: org.apache.commons.lang3.builder;version="[3.11,4)"
+Import-Package: org.apache.commons.lang3.builder;version="[3.12,4)"
Require-Capability: osgi.ee;filter:="(&(osgi.ee=JavaSE)(version=1.8))"
Tool: Bnd-5.1.1.202006162103
Ie. when building with BoM 4.3.1 the minimum version of
org.apache.commons.lang3.builder becomes 3.12.
Note that, if I build [1] against the 4.3.1 BoM and loads it directly
from the karaf 4.3.1 command line, it loads fine:
karaf@root()> feature:repo-add mvn:no.priv.bang.beans/karaf/LATEST/xml/features
Adding feature url mvn:no.priv.bang.beans/karaf/LATEST/xml/features
karaf@root()> feature:install beans-immutable
karaf@root()>
So presumably a naked karaf 4.3.1 has org.apache.commons.lang3.builder 3.12?
Is it possible for a dependency to somehow pull in an older version of
the bundle and replace the built-in bundle?
(I'll look for other users of org.apache.commons.lang3.builder to see if
I have forgotten to upgrade it)
(Anyway, this is not a showstopper, since I can work around it by building [1]
against the 4.3.0 BoM, but it's a weirdness and I don't like that...)
Thanks!
- Steinar
References:
[1] <https://github.com/steinarb/beans/tree/master/beans.immutable>
[2] <https://github.com/steinarb/authservice/blob/master/karaf/src/main/filtered-resources/feature.xml#L47>
[3] <https://github.com/steinarb/osgi-service/tree/master/osgiservice.users>
[5] <https://github.com/steinarb/authservice>
Re: Is there a command that can list the availability of a package
Posted by Steinar Bang <sb...@dod.no>.
>>>>> Steinar Bang <sb...@dod.no>:
>>>>> JB Onofré <jb...@nanthrax.net>:
>>> If you can share your project, I can take a look.
>> Several projects.
To make it simple (since karaf.version is current 4.3.0 they should all build):
git clone https://github.com/steinarb/beans.git
cd beans
git remote add scratch https://github.com/steinarb/scratch.git
git fetch scratch
git checkout beans/on-karaf-43x
mvn install
cd ..
git clone https://github.com/steinarb/adapters-for-osgi-services.git
cd adapters-for-osgi-services
git remote add scratch https://github.com/steinarb/scratch.git
git fetch scratch
git checkout adapters-for-osgi-services/on-karaf-430
mvn install
cd ..
git clone https://github.com/steinarb/servlet.git
cd servlet
git remote add scratch https://github.com/steinarb/scratch.git
git fetch scratch
git checkout servlet/on-karaf-430
mvn install
cd ..
git clone https://github.com/steinarb/osgi-service.git
cd osgi-service
git remote add scratch https://github.com/steinarb/scratch.git
git fetch scratch
git checkout osgi-service/on-karaf-43x
mvn install
cd ..
git clone https://github.com/steinarb/authservice.git
cd authservice
git remote add scratch https://github.com/steinarb/scratch.git
git fetch scratch
git checkout authservice/on-karaf-430
mvn install
cd ..
Re: Is there a command that can list the availability of a package
Posted by Steinar Bang <sb...@dod.no>.
>>>>> Steinar Bang <sb...@dod.no>:
> Several projects.
> The failing application is this one (all in-work branches are in the scratch repository):
> https://github.com/steinarb/authservice
> karaf-4.3.x branch: https://github.com/steinarb/scratch/tree/authservice/on-karaf-430
> It depends on the following bundles/features that all have been bumped to karaf 4.3:
> https://github.com/steinarb/beans
> karaf-4.3.x branch: https://github.com/steinarb/scratch/tree/beans/on-karaf-43x
> https://github.com/steinarb/adapters-for-osgi-services
> karaf-4.3.x branch: https://github.com/steinarb/scratch/tree/adapters-for-osgi-services/on-karaf-430
> https://github.com/steinarb/servlet
> karaf-4.3.x branch: https://github.com/steinarb/scratch/tree/servlet/on-karaf-430
> https://github.com/steinarb/osgi-service
> karaf-4.3.x branch: https://github.com/steinarb/scratch/tree/osgi-service/on-karaf-43x
> If you clone the actual projects, add the scratch repository using
> git remote add scratch https://github.com/steinarb/scratch.git
> and check the 4.3 branch out from there.
I forgot the fetch, ie. in all repos after clone, you have to do
git remote add scratch https://github.com/steinarb/scratch.git
git fetch scratch
and then "git checkout" the appropriate branch
(the setup works for me, but I can see how this would be confusing for
others...:-) )
Re: Is there a command that can list the availability of a package
Posted by Steinar Bang <sb...@dod.no>.
>>>>> Steinar Bang <sb...@dod.no>:
>>>>> JB Onofré <jb...@nanthrax.net>:
>> Log service is provided by Karaf (pax logging actually).
> Ok. Good! :-)
Back in ancient OSGi (2006-2008), one problem that would sometimes
appear and be very hard to debug would be that the same class could be
loaded several times by different class loaders and when two differently
loaded instances of the same class met things would clash and look very
confusing in stack traces and debuggers, ie stuff like
com.blah.SomeClass is not the same as com.blah.SomeClass
I can't remember encountering this problem since I came back to OSGi in
2013/2014, and I know I haven't seen it since starting to use karaf in
2016, so I thought it was a thing of the past.
But could it be that I load the LogService the wrong way, so that it
doesn't match up with the service offered by karaf?
(Just a hypothesis... and not a likely one...)
Re: Is there a command that can list the availability of a package
Posted by Steinar Bang <sb...@dod.no>.
>>>>> Jean-Baptiste Onofre <jb...@nanthrax.net>:
[snip!]
> ** And there’s the issue ! **
> The right provide capability should be:
> Provide-Capability = osgi.service;effective:=active;:List<String>="org.osgi.service.log.LogService, org.osgi.service.log.LoggerFactory,org.ops4j.pax.logging.PaxLoggingService,org.osgi.service.cm.ManagedService";uses=org.osgi.service.log
> You can see that the correct syntax should use List<String>.
Right, it won't be parsed as a list, just as a string?
> It’s the issue that I fixed on the maven-bundle-plugin. Karaf 4.3.0 uses Pax Logging 2.0.6 that used an "old" maven-bundle-plugin version.
Ok.
> Karaf 4.3.1 upgraded to Pax Logging 2.0.8. Pax Logging 2.0.8 uses maven-bundle-plugin 5.1.1 which is buggy and doesn’t generate cleanly provide-capability header.
> I will update Pax * projects to use maven-bundle-plugin 5.1.2 and cut the releases.
Right! I will bump to maven-bundle-plugin 5.1.2 in my own projects, as well!
> I will move forward quickly on 4.3.2 (I’m creating the Jira).
Great! :-)
> Sorry for the inconvenience !
No worries! :-)
I am, as always, impressed by your ability to debug tricky issues, and
your truly amazing ability to get stuff done!
- Steinar
Re: Is there a command that can list the availability of a package
Posted by Jean-Baptiste Onofre <jb...@nanthrax.net>.
I just checked with 4.3.1 vanilla at runtime:
1. OSGi log service package are correctly exported by pax-logging-api:
org.osgi.service.log.admin x 1.0.0 x 5 x org.ops4j.pax.logging.pax-logging-api
org.osgi.service.log.stream x 1.0.0 x 5 x org.ops4j.pax.logging.pax-logging-api
org.osgi.service.log x 1.4.0 x 5 x org.ops4j.pax.logging.pax-logging-api
2. LogService class is preset and exported by pax-logging-api bundle:
org/osgi/service/log/LogService.class | exported: true
3. LogService is registered by pax-logging-log4j2 bundle:
objectClass = [org.osgi.service.log.LogService, org.osgi.service.log.LoggerFactory, org.ops4j.pax.logging.PaxLoggingService]
service.bundleid = 6
service.id = 11
service.ranking = 1
service.scope = bundle
4. Pax-logging-log4j2 bundle has the LogService service in the provided capability:
Provide-Capability = osgi.service;effective:=active;objectClass="org.osgi.service.log.LogService,org.osgi.service.log.LoggerFactory,org.ops4j.pax.logging.PaxLoggingService, org.osgi.service.cm.ManagedService";uses=org.osgi.service.log
** And there’s the issue ! **
The right provide capability should be:
Provide-Capability = osgi.service;effective:=active;:List<String>="org.osgi.service.log.LogService, org.osgi.service.log.LoggerFactory,org.ops4j.pax.logging.PaxLoggingService,org.osgi.service.cm.ManagedService";uses=org.osgi.service.log
You can see that the correct syntax should use List<String>.
It’s the issue that I fixed on the maven-bundle-plugin. Karaf 4.3.0 uses Pax Logging 2.0.6 that used an "old" maven-bundle-plugin version.
Karaf 4.3.1 upgraded to Pax Logging 2.0.8. Pax Logging 2.0.8 uses maven-bundle-plugin 5.1.1 which is buggy and doesn’t generate cleanly provide-capability header.
I will update Pax * projects to use maven-bundle-plugin 5.1.2 and cut the releases.
I will move forward quickly on 4.3.2 (I’m creating the Jira).
Sorry for the inconvenience !
Thanks
Regards
JB
> Le 10 avr. 2021 à 17:35, Steinar Bang <sb...@dod.no> a écrit :
>
>>>>>> Steinar Bang <sb...@dod.no>:
>
>> To trigger the issue, clone and build the projects below as indicated,
>> and then bump the karaf version in authservice/pom.xml to 4.3.1 and do
>> "mvn clean install" in authservice, which will fail in the pax exam
>> integration test because LogService isn't found:
>
> Some results of my own experimentation
> 1. Building authservice with karaf.version 4.3.0 works, including the
> pax exam test
> 2. The authservice built with karaf.version 4.3.0 loads fine in karaf 4.3.0
> 3. The authservice built with karaf.version 4.3.0 fails to load in
> karaf 4.3.1 (I get the LogService is missing error)
> 4. The *.xml files in ~/.m2/repository/no/priv/bang/authservice/ does
> not contain the string LogService, whether built with karaf.version
> 4.3.0 or 4.3.1
> 5. The manifest.mf of one of the failing bundles,
> authservice.db.liquibase.test-1.13.0-SNAPSHOT.jar, does contain the
> following header, both when built with 4.3.0 and 4.3.1
> Require-Capability: osgi.ee;filter:="(&(osgi.ee=JavaSE)(version=1.8))"
> ,osgi.extender;filter:="(&(osgi.extender=osgi.component)(version>=1.4
> .0)(!(version>=2.0.0)))",osgi.service;effective:=active;filter:="(obj
> ectClass=org.osgi.service.log.LogService)"
> 6. The manifest.mf of authservice.db.liquibase.test-1.13.0-SNAPSHOT.jar
> only differs in the timestamp of the header Bnd-Lastmodified between
> being built with karaf.version 4.3.0 and 4.3.1
> 7. Building authservice with karaf.version 4.3.1 fails in the pax exam
> integration test, because a lot of the bundles fail because they
> can't find LogService
> 8. The OSGI-INF/no.priv.bang.authservice.db.liquibase.test.TestLiquibaseRunner.xml
> file inside authservice.db.liquibase.test-1.13.0-SNAPSHOT.jar is
> identical when built with karaf.version 4.3.0 and 4.3.1 and
> references the LogService
> https://gist.github.com/steinarb/bb63ffe251a728bdf8588df928d41c54
>
> So I *think* this means that the LogService is available in karaf 4.3.0
> but not available in 4.3.1.
>
> I.e. a runtime issue and not a build issue.
>
> But I am far from sure...:-)
>
>
>
>
>
>
>
>
>
>
>
>
>
>
Re: Is there a command that can list the availability of a package
Posted by Steinar Bang <sb...@dod.no>.
>>>>> Steinar Bang <sb...@dod.no>:
> To trigger the issue, clone and build the projects below as indicated,
> and then bump the karaf version in authservice/pom.xml to 4.3.1 and do
> "mvn clean install" in authservice, which will fail in the pax exam
> integration test because LogService isn't found:
Some results of my own experimentation
1. Building authservice with karaf.version 4.3.0 works, including the
pax exam test
2. The authservice built with karaf.version 4.3.0 loads fine in karaf 4.3.0
3. The authservice built with karaf.version 4.3.0 fails to load in
karaf 4.3.1 (I get the LogService is missing error)
4. The *.xml files in ~/.m2/repository/no/priv/bang/authservice/ does
not contain the string LogService, whether built with karaf.version
4.3.0 or 4.3.1
5. The manifest.mf of one of the failing bundles,
authservice.db.liquibase.test-1.13.0-SNAPSHOT.jar, does contain the
following header, both when built with 4.3.0 and 4.3.1
Require-Capability: osgi.ee;filter:="(&(osgi.ee=JavaSE)(version=1.8))"
,osgi.extender;filter:="(&(osgi.extender=osgi.component)(version>=1.4
.0)(!(version>=2.0.0)))",osgi.service;effective:=active;filter:="(obj
ectClass=org.osgi.service.log.LogService)"
6. The manifest.mf of authservice.db.liquibase.test-1.13.0-SNAPSHOT.jar
only differs in the timestamp of the header Bnd-Lastmodified between
being built with karaf.version 4.3.0 and 4.3.1
7. Building authservice with karaf.version 4.3.1 fails in the pax exam
integration test, because a lot of the bundles fail because they
can't find LogService
8. The OSGI-INF/no.priv.bang.authservice.db.liquibase.test.TestLiquibaseRunner.xml
file inside authservice.db.liquibase.test-1.13.0-SNAPSHOT.jar is
identical when built with karaf.version 4.3.0 and 4.3.1 and
references the LogService
https://gist.github.com/steinarb/bb63ffe251a728bdf8588df928d41c54
So I *think* this means that the LogService is available in karaf 4.3.0
but not available in 4.3.1.
I.e. a runtime issue and not a build issue.
But I am far from sure...:-)
Re: Is there a command that can list the availability of a package
Posted by Steinar Bang <sb...@dod.no>.
>>>>> Steinar Bang <sb...@dod.no>:
>>>>> Jean-Baptiste Onofre <jb...@nanthrax.net>:
>> I will try to find some time during the week end to take a look on your projects.
> Thanks!
To trigger the issue, clone and build the projects below as indicated,
and then bump the karaf version in authservice/pom.xml to 4.3.1 and do
"mvn clean install" in authservice, which will fail in the pax exam
integration test because LogService isn't found:
git clone https://github.com/steinarb/beans.git
cd beans
git remote add scratch https://github.com/steinarb/scratch.git
git fetch scratch
git checkout beans/on-karaf-43x
mvn install
cd ..
git clone https://github.com/steinarb/adapters-for-osgi-services.git
cd adapters-for-osgi-services
git remote add scratch https://github.com/steinarb/scratch.git
git fetch scratch
git checkout adapters-for-osgi-services/on-karaf-430
mvn install
cd ..
git clone https://github.com/steinarb/servlet.git
cd servlet
git remote add scratch https://github.com/steinarb/scratch.git
git fetch scratch
git checkout servlet/on-karaf-430
mvn install
cd ..
git clone https://github.com/steinarb/osgi-service.git
cd osgi-service
git remote add scratch https://github.com/steinarb/scratch.git
git fetch scratch
git checkout osgi-service/on-karaf-43x
mvn install
cd ..
git clone https://github.com/steinarb/authservice.git
cd authservice
git remote add scratch https://github.com/steinarb/scratch.git
git fetch scratch
git checkout authservice/on-karaf-430
mvn install
cd ..
Re: Is there a command that can list the availability of a package
Posted by Steinar Bang <sb...@dod.no>.
>>>>> Steinar Bang <sb...@dod.no>:
> I will keep digging myself, and post here what I find.
> The first thing I will look at is the feature repo namespaces.
Here are the results of a recursive grep for "xmlns" in files named
feature.xml (i.e. both template files for karaf-maven-plugin and
handwriten feature repos) across all eclipse workspaces on my dev
machine (57 users of namespace v1.4.0 and 2 users of namespace v1.5.0):
https://gist.github.com/steinarb/ecca311ae8be63135584ae8a292aad61
Re: Is there a command that can list the availability of a package
Posted by Steinar Bang <sb...@dod.no>.
>>>>> Jean-Baptiste Onofre <jb...@nanthrax.net>:
> However, I still doubt it’s caused by a change between Karaf 4.3.0 and 4.3.1 at runtime level.
> I think it’s build time related (build/MANIFEST, features, custom assembly, …).
Ok.
(I shouldn't have tried to change so many things at the same time, but
once I had started on the cleanup, it was hard to stop...)
> I will try to find some time during the week end to take a look on your projects.
Thanks!
I will keep digging myself, and post here what I find.
The first thing I will look at is the feature repo namespaces.
Re: Is there a command that can list the availability of a package
Posted by Jean-Baptiste Onofre <jb...@nanthrax.net>.
It’s hard to say the root cause without checking in your project.
However, I still doubt it’s caused by a change between Karaf 4.3.0 and 4.3.1 at runtime level.
I think it’s build time related (build/MANIFEST, features, custom assembly, …).
I will try to find some time during the week end to take a look on your projects.
Regards
JB
> Le 10 avr. 2021 à 08:28, Steinar Bang <sb...@dod.no> a écrit :
>
>>>>>> Jean-Baptiste Onofre <jb...@nanthrax.net>:
>
>> Even if the code don’t change, changing the maven plugin can change the generated MANIFEST.
>
> Yes, but that's the maven-bundle-plugin...?
> Because that doesn't change between work and not work.
>
> Or does the karaf-bundle-plugin also touch the manifest?
> I thought I used it only for feature generation?
>
>> For instance, "old" maven plugin version didn’t generate requirement header.
>
> Right. I have been using various versions of the maven-bundle-plugin in
> the projects (basically, the newest version when I started the project).
>
> I bumped them all to 5.1.1 a little while back, as part of a cleanup
> prior to moving to karaf 4.3.x (bumped maven plugin versions, and junit
> jupiter versions, mockito, assertj, etc. ie. anything related to tests),
> and cleaned up and removed all unneccessary dependencies I could find (a
> lot of cut and past in maven config when creating new projects...).
>
> But I have tested each step, i.e. tested that the feature still loads
> after the change. And all features now have a pax exam feature load
> test (because they are now simple).
>
> And those tests all started failing when moving from 4.3.0 to 4.3.1 for
> all bundles that somehow referenced LogService.
>
> Of course moving from 4.3.0 to 4.3.1 also affected the karaf runtime
> used in the pax exam tests, so maybe what I saw wasn't a change in what
> was built, but instead a change of running what I have on karaf 4.3.1...?
>
>> Another possible change is about the feature namespace you use. If you use feature xmlns 1.3 or 1.4, services requirement are checked. It’s not the case with previous namespace version.
>
> Hm... some feature repos have templates, and some of them have
> namespaces, I think...? Some of the templates do not have namespaces, I
> think...?
>
> What does the karaf-maven-plugin do with namespace on the template? Keep
> it? Replace it?
>
> Some feature repos are completely generated by the karaf-maven-plugin
> and they will get whatever namespace the plugin decide to use.
>
> Many of my multimodule projects also have a handwritten aggregate
> feature repo. If the aggregate feature repos a have namspace it's
> probably an old one that have been copy/pasted to newer projects.
>
>> It’s control by the serviceRequirements property in etc/org.apache.karaf.features.cfg. We use "default" by default ( ;) ), meaning that service requirements are ignored for old features namespace.
>
> Hm... are you saying that if my feature repos use an old features
> namespace, karaf 4.3.1 doesn't see that the feature needs the
> LogService?
>
Re: Is there a command that can list the availability of a package
Posted by Steinar Bang <sb...@dod.no>.
>>>>> Jean-Baptiste Onofre <jb...@nanthrax.net>:
> Even if the code don’t change, changing the maven plugin can change the generated MANIFEST.
Yes, but that's the maven-bundle-plugin...?
Because that doesn't change between work and not work.
Or does the karaf-bundle-plugin also touch the manifest?
I thought I used it only for feature generation?
> For instance, "old" maven plugin version didn’t generate requirement header.
Right. I have been using various versions of the maven-bundle-plugin in
the projects (basically, the newest version when I started the project).
I bumped them all to 5.1.1 a little while back, as part of a cleanup
prior to moving to karaf 4.3.x (bumped maven plugin versions, and junit
jupiter versions, mockito, assertj, etc. ie. anything related to tests),
and cleaned up and removed all unneccessary dependencies I could find (a
lot of cut and past in maven config when creating new projects...).
But I have tested each step, i.e. tested that the feature still loads
after the change. And all features now have a pax exam feature load
test (because they are now simple).
And those tests all started failing when moving from 4.3.0 to 4.3.1 for
all bundles that somehow referenced LogService.
Of course moving from 4.3.0 to 4.3.1 also affected the karaf runtime
used in the pax exam tests, so maybe what I saw wasn't a change in what
was built, but instead a change of running what I have on karaf 4.3.1...?
> Another possible change is about the feature namespace you use. If you use feature xmlns 1.3 or 1.4, services requirement are checked. It’s not the case with previous namespace version.
Hm... some feature repos have templates, and some of them have
namespaces, I think...? Some of the templates do not have namespaces, I
think...?
What does the karaf-maven-plugin do with namespace on the template? Keep
it? Replace it?
Some feature repos are completely generated by the karaf-maven-plugin
and they will get whatever namespace the plugin decide to use.
Many of my multimodule projects also have a handwritten aggregate
feature repo. If the aggregate feature repos a have namspace it's
probably an old one that have been copy/pasted to newer projects.
> It’s control by the serviceRequirements property in etc/org.apache.karaf.features.cfg. We use "default" by default ( ;) ), meaning that service requirements are ignored for old features namespace.
Hm... are you saying that if my feature repos use an old features
namespace, karaf 4.3.1 doesn't see that the feature needs the
LogService?
Re: Is there a command that can list the availability of a package
Posted by Jean-Baptiste Onofre <jb...@nanthrax.net>.
Even if the code don’t change, changing the maven plugin can change the generated MANIFEST.
For instance, "old" maven plugin version didn’t generate requirement header.
Another possible change is about the feature namespace you use. If you use feature xmlns 1.3 or 1.4, services requirement are checked. It’s not the case with previous namespace version.
It’s control by the serviceRequirements property in etc/org.apache.karaf.features.cfg. We use "default" by default ( ;) ), meaning that service requirements are ignored for old features namespace.
Regards
JB
> Le 9 avr. 2021 à 19:32, Steinar Bang <sb...@dod.no> a écrit :
>
>>>>>> JB Onofré <jb...@nanthrax.net>:
>
>> Log service is provided by Karaf (pax logging actually).
>
> Ok. Good! :-)
>
>> Can you check your bundle or feature requirement when you build it ? I suspect more a new requirement in your bundle/feature.
>
> That may be. But there are no code changes between working and not
> working,
>
> The only change is karaf.version from 4.3.0 to 4.3.1.
>
>> I also recommend to upgrade to maven-bundle-plugin 5.1.2 as it fixes an important issue.
>
> Ok, I will do.
>
>> If you can share your project, I can take a look.
>
> Several projects.
>
> The failing application is this one (all in-work branches are in the scratch repository):
> https://github.com/steinarb/authservice
> karaf-4.3.x branch: https://github.com/steinarb/scratch/tree/authservice/on-karaf-430
>
> It depends on the following bundles/features that all have been bumped to karaf 4.3:
> https://github.com/steinarb/beans
> karaf-4.3.x branch: https://github.com/steinarb/scratch/tree/beans/on-karaf-43x
>
> https://github.com/steinarb/adapters-for-osgi-services
> karaf-4.3.x branch: https://github.com/steinarb/scratch/tree/adapters-for-osgi-services/on-karaf-430
>
> https://github.com/steinarb/servlet
> karaf-4.3.x branch: https://github.com/steinarb/scratch/tree/servlet/on-karaf-430
>
> https://github.com/steinarb/osgi-service
> karaf-4.3.x branch: https://github.com/steinarb/scratch/tree/osgi-service/on-karaf-43x
>
> If you clone the actual projects, add the scratch repository using
> git remote add scratch https://github.com/steinarb/scratch.git
> and check the 4.3 branch out from there.
>
Re: Is there a command that can list the availability of a package
Posted by Steinar Bang <sb...@dod.no>.
>>>>> JB Onofré <jb...@nanthrax.net>:
> Log service is provided by Karaf (pax logging actually).
Ok. Good! :-)
> Can you check your bundle or feature requirement when you build it ? I suspect more a new requirement in your bundle/feature.
That may be. But there are no code changes between working and not
working,
The only change is karaf.version from 4.3.0 to 4.3.1.
> I also recommend to upgrade to maven-bundle-plugin 5.1.2 as it fixes an important issue.
Ok, I will do.
> If you can share your project, I can take a look.
Several projects.
The failing application is this one (all in-work branches are in the scratch repository):
https://github.com/steinarb/authservice
karaf-4.3.x branch: https://github.com/steinarb/scratch/tree/authservice/on-karaf-430
It depends on the following bundles/features that all have been bumped to karaf 4.3:
https://github.com/steinarb/beans
karaf-4.3.x branch: https://github.com/steinarb/scratch/tree/beans/on-karaf-43x
https://github.com/steinarb/adapters-for-osgi-services
karaf-4.3.x branch: https://github.com/steinarb/scratch/tree/adapters-for-osgi-services/on-karaf-430
https://github.com/steinarb/servlet
karaf-4.3.x branch: https://github.com/steinarb/scratch/tree/servlet/on-karaf-430
https://github.com/steinarb/osgi-service
karaf-4.3.x branch: https://github.com/steinarb/scratch/tree/osgi-service/on-karaf-43x
If you clone the actual projects, add the scratch repository using
git remote add scratch https://github.com/steinarb/scratch.git
and check the 4.3 branch out from there.
Re: Is there a command that can list the availability of a package
Posted by JB Onofré <jb...@nanthrax.net>.
Log service is provided by Karaf (pax logging actually). Can you check your bundle or feature requirement when you build it ? I suspect more a new requirement in your bundle/feature.
I also recommend to upgrade to maven-bundle-plugin 5.1.2 as it fixes an important issue.
If you can share your project, I can take a look.
Regards
JB
> Le 9 avr. 2021 à 18:26, Steinar Bang <sb...@dod.no> a écrit :
>
>
>>
>>>>>> Jean-Baptiste Onofre <jb...@nanthrax.net>:
>
>> Hi,
>> I don’t see how it’s related to BoM: your missing requirement is at runtime, not build time. Maybe you change the maven-bundle-plugin version ?
>
> I actually have bumped the maven-bundle-plugin version to 5.1.1 on all
> affected projects.
>
> But bumping maven-bundle-plugin didn't affect if the features in
> question loads or not, but switching between 4.3.0 and 4.3.1 in the
> karaf version makes a difference.
>
> (I've done a lot of trial and error and git-bisect to find out what made
> things fail)
>
> Of course switching between karaf versions now does two things:
> 1. switch the BoM
> 2. switch the karaf-maven-plugin, and thereby affects the feature repo
> generation of feature repos of the individual bundles
>
> And it may be the latter that has an effect...?
>
> Anyway I now have rolled back to karaf.version 4.3.0 for all builds and
> the resulting feature loads fine in karaf 4.3.0, but gets a missing
> LogService in karaf 4.3.1.
>
>> Let me explain: the requirement is NOT a missing package, but a missing service (osgi.service; effective:=active).
>
> Yes I saw that, I just couldn't figure out what the problem was,
> because:
> 1. There was no version indication on the service requirement (which I
> e.g. got when trying to run bundles built with LogService 1.4 on
> karaf 4.2.11)
> 2. I thought the LogService always would be present in karaf so I
> couldn't understand why it would be missing...?
>
>> Your bundle header contains a requirement (in the MANIFEST) like Require-Service.
>
>> If you use pax-logging-log4j2 (2.0.8 for instance), it provides this capability:
>
>> Provide-Capability: osgi.service;effective:=active;objectClass="org.os
>> gi.service.log.LogService,org.osgi.service.log.LoggerFactory,org.ops4
>> j.pax.logging.PaxLoggingService,org.osgi.service.cm.ManagedService";u
>> ses="org.osgi.service.log"
>
>> A simple workaround is to say to and to not generate the Require-Service requirement (if you use scr it’s with norequirement option on -dsannotation).
>
> Hm... but I *do* have LogService SCR injections into my components and I
> use the LogService in my code.
>
> Is the LogService no longer a part of karaf?
>
>> You can also provide the capability in a feature (assuming you don’t use pax-logging-log4j2).
>
> Hm... do I need to reference a feature from pax-logging-log4j to get the
> LogService?
>
> Thanks!
>
>
> - Steinar
>
Re: Is there a command that can list the availability of a package
Posted by Steinar Bang <sb...@dod.no>.
>>>>> Jean-Baptiste Onofre <jb...@nanthrax.net>:
> Hi,
> I don’t see how it’s related to BoM: your missing requirement is at runtime, not build time. Maybe you change the maven-bundle-plugin version ?
I actually have bumped the maven-bundle-plugin version to 5.1.1 on all
affected projects.
But bumping maven-bundle-plugin didn't affect if the features in
question loads or not, but switching between 4.3.0 and 4.3.1 in the
karaf version makes a difference.
(I've done a lot of trial and error and git-bisect to find out what made
things fail)
Of course switching between karaf versions now does two things:
1. switch the BoM
2. switch the karaf-maven-plugin, and thereby affects the feature repo
generation of feature repos of the individual bundles
And it may be the latter that has an effect...?
Anyway I now have rolled back to karaf.version 4.3.0 for all builds and
the resulting feature loads fine in karaf 4.3.0, but gets a missing
LogService in karaf 4.3.1.
> Let me explain: the requirement is NOT a missing package, but a missing service (osgi.service; effective:=active).
Yes I saw that, I just couldn't figure out what the problem was,
because:
1. There was no version indication on the service requirement (which I
e.g. got when trying to run bundles built with LogService 1.4 on
karaf 4.2.11)
2. I thought the LogService always would be present in karaf so I
couldn't understand why it would be missing...?
> Your bundle header contains a requirement (in the MANIFEST) like Require-Service.
> If you use pax-logging-log4j2 (2.0.8 for instance), it provides this capability:
> Provide-Capability: osgi.service;effective:=active;objectClass="org.os
> gi.service.log.LogService,org.osgi.service.log.LoggerFactory,org.ops4
> j.pax.logging.PaxLoggingService,org.osgi.service.cm.ManagedService";u
> ses="org.osgi.service.log"
> A simple workaround is to say to and to not generate the Require-Service requirement (if you use scr it’s with norequirement option on -dsannotation).
Hm... but I *do* have LogService SCR injections into my components and I
use the LogService in my code.
Is the LogService no longer a part of karaf?
> You can also provide the capability in a feature (assuming you don’t use pax-logging-log4j2).
Hm... do I need to reference a feature from pax-logging-log4j to get the
LogService?
Thanks!
- Steinar
Re: Is there a command that can list the availability of a package
Posted by Jean-Baptiste Onofre <jb...@nanthrax.net>.
Hi,
I don’t see how it’s related to BoM: your missing requirement is at runtime, not build time. Maybe you change the maven-bundle-plugin version ?
Let me explain: the requirement is NOT a missing package, but a missing service (osgi.service; effective:=active).
Your bundle header contains a requirement (in the MANIFEST) like Require-Service.
If you use pax-logging-log4j2 (2.0.8 for instance), it provides this capability:
Provide-Capability: osgi.service;effective:=active;objectClass="org.os
gi.service.log.LogService,org.osgi.service.log.LoggerFactory,org.ops4
j.pax.logging.PaxLoggingService,org.osgi.service.cm.ManagedService";u
ses="org.osgi.service.log"
A simple workaround is to say to and to not generate the Require-Service requirement (if you use scr it’s with norequirement option on -dsannotation).
You can also provide the capability in a feature (assuming you don’t use pax-logging-log4j2).
Regards
JB
> Le 8 avr. 2021 à 21:57, Steinar Bang <sb...@dod.no> a écrit :
>
> Update: I think there is something strange with the 4.3.1 BoM, because
> if I build with it, I get a problem with finding the org.osgi.service.LogService:
>
> Caused by: org.apache.felix.resolver.reason.ReasonException: Unable to resolve no.priv.bang.authservice.users/1.13.0.SNAPSHOT: missing requirement [no.priv.bang.authservice.users/1.13.0.SNAPSHOT] osgi.service; effective:=active; filter:="(objectClass=org.osgi.service.log.LogService)"
> at org.apache.felix.resolver.Candidates$MissingRequirementError.toException(Candidates.java:1341)
> ... 17 more
>
> Which is strange because the LogService dependency doesn't come from the
> BoM, and besides, this is a service that should always be present.
>
> Also, this error doesn't have any version constraints so it isn't that
> the correct version is available.
>
> So I'm moving back to building with the 4.3.0 BoM.
>
Re: Is there a command that can list the availability of a package
Posted by Steinar Bang <sb...@dod.no>.
Update: I think there is something strange with the 4.3.1 BoM, because
if I build with it, I get a problem with finding the org.osgi.service.LogService:
Caused by: org.apache.felix.resolver.reason.ReasonException: Unable to resolve no.priv.bang.authservice.users/1.13.0.SNAPSHOT: missing requirement [no.priv.bang.authservice.users/1.13.0.SNAPSHOT] osgi.service; effective:=active; filter:="(objectClass=org.osgi.service.log.LogService)"
at org.apache.felix.resolver.Candidates$MissingRequirementError.toException(Candidates.java:1341)
... 17 more
Which is strange because the LogService dependency doesn't come from the
BoM, and besides, this is a service that should always be present.
Also, this error doesn't have any version constraints so it isn't that
the correct version is available.
So I'm moving back to building with the 4.3.0 BoM.