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 <[email protected]> a écrit :
> 
>>>>>> Steinar Bang <[email protected]>:
> 
>> 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...:-)
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 

Reply via email to