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

Module org.apache.logging.log4j.core does not declare uses RecyclerFactoryProvider #3250

Open
ppkarwasz opened this issue Nov 28, 2024 · 1 comment
Milestone

Comments

@ppkarwasz
Copy link
Contributor

Log4j Core version 3.0.0-beta3 does not have all the necessary JPMS service declaration, which causes the following exception to be thrown:

java.util.ServiceConfigurationError: org.apache.logging.log4j.kit.recycler.RecyclerFactoryProvider: module org.apache.logging.log4j.core does not declare `uses`
@ppkarwasz
Copy link
Contributor Author

To workaround the issue, users can implement their own ConfigurableInstanceFactoryPostProcessor that registers a RecyclerFactory bean:

public class Log4jCorePostProcessor implements ConfigurableInstanceFactoryPostProcessor {
    @Override
    public void postProcessFactory(ConfigurableInstanceFactory factory) {
        factory.registerBinding(Key.forClass(RecyclerFactory.class), () -> RecyclerFactoryProvider.getInstance()
                .createForEnvironment(null));
    }
}

and register the post-processor with ServiceLoader.

@ppkarwasz ppkarwasz added this to the 3.0.0-beta4 milestone Nov 28, 2024
ppkarwasz added a commit that referenced this issue Nov 29, 2024
All `ServiceLoader.load()` calls need a `uses` clause in the JPMS module descriptor.
This PR:

- Adds the missing `@ServiceConsumer` annotation to `CoreDefaultBundle`.
- To simplify code review, it places `@ServiceConsumer` on each class that makes a `ServiceLoader.load` call and only those classes.

Closes #3250
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

1 participant