You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A servlet class should be loaded by the application class loader. The current approach here loads it with the system class loader. This causes resource lookups inside a servlet to fail as the system class loader does not know anything about the resources on the application classpath.
Expected behavior
The system class loader is not used to load the servlet.
Actual behavior
The system class loader is used, is this what AwsServletContext.getClassLoader causes? Not sure why it would use the system class loader there. Can it just be changed?
The text was updated successfully, but these errors were encountered:
--- a/aws-serverless-java-container-core/src/main/java/com/amazonaws/serverless/proxy/internal/servlet/AwsServletContext.java
+++ b/aws-serverless-java-container-core/src/main/java/com/amazonaws/serverless/proxy/internal/servlet/AwsServletContext.java
@@ -545,9 +545,7 @@ public class AwsServletContext
@Override
public ClassLoader getClassLoader() {
- // for the time being we return the default class loader. We may want to let developers override this int the
- // future.
- return ClassLoader.getSystemClassLoader();
+ return getClass().getClassLoader();
}
Artur-
added a commit
to Artur-/aws-serverless-java-container
that referenced
this issue
Apr 28, 2023
Serverless Java Container version:
1.9.1
Implementations:
Spring Boot 2
Framework version:
SpringBoot 2.7.5
Frontend service:
HTTP API
Deployment method:
SAM
Scenario
A servlet class should be loaded by the application class loader. The current approach here loads it with the system class loader. This causes resource lookups inside a servlet to fail as the system class loader does not know anything about the resources on the application classpath.
Expected behavior
The system class loader is not used to load the servlet.
Actual behavior
The system class loader is used, is this what
AwsServletContext.getClassLoader
causes? Not sure why it would use the system class loader there. Can it just be changed?The text was updated successfully, but these errors were encountered: