Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CORE-15310: Use custom SLF4J bundle in OSGi tests #6248

Merged
merged 1 commit into from
Jul 2, 2024

Conversation

vkolomeyko
Copy link
Contributor

The main principle is that net.corda.slf4jv1 bundle and slf4j.api should be mutually exclusive.

I.e. slf4j.api is used during production Workers run, including Combined Worker. Whereas net.corda.slf4jv1 bundle is used for any OSGi testing.

But these bundles should never be used together as this causes OSGi conflicts like:

"Uses constraint violation. Unable to resolve resource micrometer-core [micrometer-core [37](R 37.0)] because it is exposed to package 'org.slf4j.spi' from resources net.corda.slf4jv1 [net.corda.slf4jv1 [142](R 142.0)] and slf4j.api [slf4j.api [209](R 209.0)] via two dependency chains.

Chain 1:
  micrometer-core [micrometer-core [37](R 37.0)]
  import: (&(osgi.wiring.package=org.slf4j.spi)(version>=1.7.0)(!(version>=2.0.0)))
  |
  export: osgi.wiring.package: org.slf4j.spi
  net.corda.slf4jv1 [net.corda.slf4jv1 [142](R 142.0)]

Chain 2:
  micrometer-core [micrometer-core [37](R 37.0)]
  import: (&(osgi.wiring.package=org.slf4j)(version>=1.7.0)(!(version>=2.0.0)))
  |
  export: osgi.wiring.package=org.slf4j; uses:=org.slf4j.spi
  slf4j.api [slf4j.api [209](R 209.0)]
  import: (&(osgi.wiring.package=org.slf4j.spi)(version>=2.0.13)(!(version>=3.0.0)))
  |
  export: osgi.wiring.package: org.slf4j.spi
  slf4j.api [slf4j.api [209](R 209.0)]"

The main principle is that `net.corda.slf4jv1` bundle and `slf4j.api` should be mutually exclusive.

I.e. `slf4j.api` is used during production Workers run, including Combined Worker. Whereas `net.corda.slf4jv1` bundle is used for any OSGi testing.

But these bundles should never be used together as this causes OSGi conflicts like:
```
"Uses constraint violation. Unable to resolve resource micrometer-core [micrometer-core [37](R 37.0)] because it is exposed to package 'org.slf4j.spi' from resources net.corda.slf4jv1 [net.corda.slf4jv1 [142](R 142.0)] and slf4j.api [slf4j.api [209](R 209.0)] via two dependency chains.

Chain 1:
  micrometer-core [micrometer-core [37](R 37.0)]
  import: (&(osgi.wiring.package=org.slf4j.spi)(version>=1.7.0)(!(version>=2.0.0)))
  |
  export: osgi.wiring.package: org.slf4j.spi
  net.corda.slf4jv1 [net.corda.slf4jv1 [142](R 142.0)]

Chain 2:
  micrometer-core [micrometer-core [37](R 37.0)]
  import: (&(osgi.wiring.package=org.slf4j)(version>=1.7.0)(!(version>=2.0.0)))
  |
  export: osgi.wiring.package=org.slf4j; uses:=org.slf4j.spi
  slf4j.api [slf4j.api [209](R 209.0)]
  import: (&(osgi.wiring.package=org.slf4j.spi)(version>=2.0.13)(!(version>=3.0.0)))
  |
  export: osgi.wiring.package: org.slf4j.spi
  slf4j.api [slf4j.api [209](R 209.0)]"
```
Copy link

sonarcloud bot commented Jul 2, 2024

@corda-jenkins-ci02
Copy link
Contributor

Jenkins build for PR 6248 build 1

Build Successful:
Jar artifact version produced by this PR: 5.3.0.0-alpha-1719927549193
Helm chart version produced by this PR: 5.3.0-alpha.1719927549193
Helm chart pushed to: oci://corda-os-docker-dev.software.r3.com/helm-charts/pr-6248/corda
Helm chart Polaris score: 82

@vkolomeyko vkolomeyko marked this pull request as ready for review July 2, 2024 14:08
@vkolomeyko vkolomeyko requested review from a team as code owners July 2, 2024 14:08
@vkolomeyko
Copy link
Contributor Author

build e2e

@corda-jenkins-ci02
Copy link
Contributor

Building E2E Tests on PR-6248

@vkolomeyko vkolomeyko merged commit 6183cb0 into release/os/5.3 Jul 2, 2024
7 of 8 checks passed
@vkolomeyko vkolomeyko deleted the vkolomeyko/CORE-15310-slf4j-in-tests branch July 2, 2024 15:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants