Skip to content
This repository was archived by the owner on Feb 23, 2023. It is now read-only.
This repository was archived by the owner on Feb 23, 2023. It is now read-only.

Can't get CoreUtilites Example running (JDK 11) #67

Closed
@rieckpil

Description

@rieckpil

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?

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