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

Java 9 Module name wrong for slf4j 2.x #1983

Closed
aschepp opened this issue Nov 21, 2023 · 4 comments
Closed

Java 9 Module name wrong for slf4j 2.x #1983

aschepp opened this issue Nov 21, 2023 · 4 comments
Assignees
Milestone

Comments

@aschepp
Copy link

aschepp commented Nov 21, 2023

Description

The module log4j-to-slf4j currently uses the following module-info.class:

module org.apache.logging.log4j.to.slf4j {
    requires java.base;
    requires org.apache.logging.log4j;
    requires slf4j-api;

    exports org.apache.logging.slf4j;

    provides org.apache.logging.log4j.spi.Provider with
        org.apache.logging.slf4j.SLF4JProvider;
}

This only works with slf4j 1.x, because the module name has changed with version 2.x of slf4j, it's now "org.slf4j".

https://github.com/qos-ch/slf4j/blob/master/slf4j-api/src/main/java9/module-info.java

Configuration

Version: 2.22.0

Operating system: Linux/Mac

JDK: Java 17

Logs

java.lang.module.FindException: Module slf4j-api not found, required by org.apache.logging.log4j.to.slf4j'.
@ppkarwasz
Copy link
Contributor

@aschepp,

Thank you for noticing.

We use BND to generate both our OSGi and JPMS descriptors. The problem is caused by the multi-release nature of slf4j-api 2.x. Our current version of BND does not support MRJs, hence the wrong file-based name ended up in the descriptor.

Version 1.7.36 of log4j-api used in release 2.21.1 is not an MRJ, so you can downgrade to log4j-to-slf4j version 2.21.1 as a workaround.

As soon as our CI build finishes a new corrected 2.23.0-SNAPSHOT version should be available. Can you check if it solves your problem? Feel free to reopen this issue if it doesn't.

@aschepp
Copy link
Author

aschepp commented Nov 21, 2023

Downgrade to 2.21.1 worked. Thanks for the quick help.

@cowwoc
Copy link

cowwoc commented Dec 4, 2023

@ppkarwasz 2.23.0-SNAPSHOT fixed the problem for me. When will you cut an official release?

@ppkarwasz
Copy link
Contributor

@cowwoc,

You can follow this discussion on dev. If the PMC agrees, I could stage a release in two weeks.

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

No branches or pull requests

3 participants