Can't get CoreUtilites Example running (JDK 11) #67
Description
Hey 👋🏻
I'm trying to enrich my existing AWS Lambda Java setup with the structured logging functionality. However, I'm failing to get it running with Java 11.
To confirm that it's not something project-specific I forked this sample project and tried to run the helloworld.App
on a Java 11 default AWS Lambda runtime and get the following error:
Error loading class helloworld.App: java.lang.ExceptionInInitializerError
java.lang.ExceptionInInitializerError
at java.base/java.lang.Class.forName0(Native Method)
at java.base/java.lang.Class.forName(Unknown Source)
Caused by: java.lang.UnsupportedOperationException: No class provided, and an appropriate one cannot be found.
at org.apache.logging.log4j.LogManager.callerClass(LogManager.java:573)
at org.apache.logging.log4j.LogManager.getLogger(LogManager.java:598)
at org.apache.logging.log4j.LogManager.getLogger(LogManager.java:585)
at helloworld.App.<clinit>(App.java:37)
... 2 more
Some basic research pointed me to this issue https://issues.apache.org/jira/browse/LOG4J2-2834 that mentions a fix by adding Multi-Release:true
to the Manifest.md
.
I tried to add this by enriching the transformer setup but still get the same issue when running the sample Lambda of this repo.
What's weird is that this issue seems to only occur on the AWS Lambda runtime. If I manually add the Lambda handler as the Main-Class
with a basic main
method that invokes the function, and run java -jar target/...
I don't see this exception locally.
Reproducible example: https://github.com/rieckpil/aws-lambda-powertools-examples
With a java8.al2
runtime it works fine, but I'd like to avoid downgrading all my lambdas to Java 8 in 2022 😅
Any ideas?