Jarno Gabriel created LOG4J2-2834:
-------------------------------------
Summary: Log4j getCaller class is not found in Java 11
Key: LOG4J2-2834
URL: https://issues.apache.org/jira/browse/LOG4J2-2834
Project: Log4j 2
Issue Type: Bug
Components: API
Affects Versions: 2.13.2
Environment: *Java*
Java JDK 11.0.7
*IDE*
Eclipse 2020-03 (4.15.0)
*Windows*
Windows 1903 18362.778
Reporter: Jarno Gabriel
I can't seem to fix Log4j crashing when calling the `LogManager.getLogger()`
method. I found
[this|[https://stackoverflow.com/questions/52953483/logmanager-getlogger-is-unable-to-determine-class-name-on-java-11]]
thread and I included the `Multi-Release` property in the manifest file but
Log4J still crashes.
What I did was include Log4J in a library I wrote and then packaged that
library using the maven shade plugin and then I included my packaged library in
my actual application.
The error I'm getting:
{code:java}
Exception in thread "main" java.lang.UnsupportedOperationException: No class
provided, and an appropriate one cannot be found. at
org.apache.logging.log4j.LogManager.callerClass(LogManager.java:576) at
org.apache.logging.log4j.LogManager.getLogger(LogManager.java:601) at
org.apache.logging.log4j.LogManager.getLogger(LogManager.java:588){code}
The shade configuration in my pom file for the library:
{code:java}
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.2.3</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<filters>
<filter>
<artifact>:</artifact>
<excludes>
<exclude>META-INF/.SF</exclude>
<exclude>META-INF/.DSA</exclude>
<exclude>META-INF/*.RSA</exclude>
</excludes>
</filter>
</filters>
<transformers>
<transformer
implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<manifestEntries>
<Multi-Release>true</Multi-Release>
</manifestEntries>
</transformer>
<transformer
implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer"/>
</transformers>
<finalName>uber-${project.artifactId}-${project.version}</finalName>
</configuration>
</execution>
</executions>
</plugin>{code}
The manifest file in the library .jar file:
{code:java}
Manifest-Version: 1.0
Archiver-Version: Plexus Archiver
Created-By: Apache Maven 3.6.3
Build-Jdk: 11.0.7
Multi-Release: true{code}
--
This message was sent by Atlassian Jira
(v8.3.4#803005)