Skip to content

logj4 3.0.0.beta3 with JPL + JPMS #3570

@kurtostfeld

Description

@kurtostfeld

Description

With a very simple test app, I get:

Exception in thread "main" org.apache.logging.log4j.plugins.di.spi.ReflectionException
	at [email protected]/org.apache.logging.log4j.plugins.di.spi.ReflectionAgent.invokeMethod(ReflectionAgent.java:84)
	at [email protected]/org.apache.logging.log4j.plugins.di.DefaultInstanceFactory.lambda$registerBundleMethod$13(DefaultInstanceFactory.java:306)
	at [email protected]/org.apache.logging.log4j.util.LazyUtil$SafeLazy.value(LazyUtil.java:113)
	at [email protected]/org.apache.logging.log4j.util.Lazy.get(Lazy.java:39)
	at [email protected]/org.apache.logging.log4j.plugins.di.InstanceFactory.getInstance(InstanceFactory.java:126)
	at [email protected]/org.apache.logging.log4j.plugins.di.DefaultInstanceFactory.lambda$getArgumentFactory$9(DefaultInstanceFactory.java:223)
	at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:197)
	at java.base/java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1708)
	at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509)
	at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499)
	at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:575)
	at java.base/java.util.stream.AbstractPipeline.evaluateToArrayNode(AbstractPipeline.java:260)
	at java.base/java.util.stream.ReferencePipeline.toArray(ReferencePipeline.java:616)
	at java.base/java.util.stream.ReferencePipeline.toArray(ReferencePipeline.java:622)
	at [email protected]/org.apache.logging.log4j.plugins.di.DefaultInstanceFactory.lambda$registerBundleMethod$13(DefaultInstanceFactory.java:305)
	at [email protected]/org.apache.logging.log4j.util.LazyUtil$SafeLazy.value(LazyUtil.java:113)
	at [email protected]/org.apache.logging.log4j.util.Lazy.get(Lazy.java:39)
	at [email protected]/org.apache.logging.log4j.plugins.di.InstanceFactory.getInstance(InstanceFactory.java:115)
	at [email protected]/org.apache.logging.log4j.core.LoggerContext.<init>(LoggerContext.java:149)
	at [email protected]/org.apache.logging.log4j.core.LoggerContext$Builder.build(LoggerContext.java:996)
	at [email protected]/org.apache.logging.log4j.core.selector.AbstractContextSelector.createContext(AbstractContextSelector.java:42)
	at [email protected]/org.apache.logging.log4j.core.selector.ClassLoaderContextSelector.locateContext(ClassLoaderContextSelector.java:231)
	at [email protected]/org.apache.logging.log4j.core.selector.ClassLoaderContextSelector.getContext(ClassLoaderContextSelector.java:149)
	at [email protected]/org.apache.logging.log4j.core.selector.ClassLoaderContextSelector.getContext(ClassLoaderContextSelector.java:132)
	at [email protected]/org.apache.logging.log4j.core.selector.ClassLoaderContextSelector.getContext(ClassLoaderContextSelector.java:126)
	at [email protected]/org.apache.logging.log4j.core.impl.Log4jContextFactory.getContext(Log4jContextFactory.java:151)
	at [email protected]/org.apache.logging.log4j.core.impl.Log4jContextFactory.getContext(Log4jContextFactory.java:49)
	at [email protected]/org.apache.logging.log4j.LogManager.getContext(LogManager.java:138)
	at [email protected]/org.apache.logging.log4j.LogManager.getLogger(LogManager.java:571)
	at [email protected]/org.apache.logging.log4j.LogManager.getLogger(LogManager.java:583)
	at [email protected]/demo.Main.main(Main.java:11)
Caused by: java.util.ServiceConfigurationError: org.apache.logging.log4j.kit.recycler.RecyclerFactoryProvider: module org.apache.logging.log4j.core does not declare `uses`
	at java.base/java.util.ServiceLoader.fail(ServiceLoader.java:593)
	at java.base/java.util.ServiceLoader.checkCaller(ServiceLoader.java:579)
	at java.base/java.util.ServiceLoader.<init>(ServiceLoader.java:507)
	at java.base/java.util.ServiceLoader.load(ServiceLoader.java:1654)
	at [email protected]/org.apache.logging.log4j.core.impl.CoreDefaultBundle.defaultRecyclerFactory(CoreDefaultBundle.java:125)
	at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
	at java.base/java.lang.reflect.Method.invoke(Method.java:580)
	at [email protected]/org.apache.logging.log4j.plugins.di.spi.ReflectionAgent.invokeMethod(ReflectionAgent.java:82)
	... 30 more

with this module-info.java

module demo.app {
    requires org.apache.logging.log4j;
    requires org.apache.logging.log4j.core;
    requires org.apache.logging.log4j.jpl;
}

with these dependencies:

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>org.apache.logging.log4j</groupId>
                <artifactId>log4j-bom</artifactId>
                <version>3.0.0-beta3</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <dependencies>
        <dependency>
            <groupId>org.apache.logging.log4j</groupId>
            <artifactId>log4j-core</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.logging.log4j</groupId>
            <artifactId>log4j-config-yaml</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.logging.log4j</groupId>
            <artifactId>log4j-jpl</artifactId>
        </dependency>
    </dependencies>

Configuration

Version: 3.0.0-beta3

Operating system: MacOS M4

JDK: JDK 17/21

Logs

Included in main section.

Reproduction

Perfectly reproducible.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions