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
To help us debug your issue fill in the basic information below using the options provided
Serverless Java Container version: 1.10
Implementations:Struts2
Framework version:Struts 6.0.3
Frontend service: None (plain Lambda exercises the issue)
Deployment method:SAM
Scenario
Build and run the struts sample
Expected behavior
sam local invoke works, the function works deployed to Lambda
Actual behavior
Error finding the required classes in the built ZIP file
Steps to reproduce
cd samples/struts/pet-store
sam build
Populate test-event.json with content from below
Note: I had to correct the Handler property of the function in the SAM template to even get this far. The correct handler string is com.amazonaws.serverless.proxy.struts2.Struts2LambdaHandler::handleRequest
sam local invoke -e test-event.json
Full log output
Baseline (no changes to struts.xml)
Caused by: Unable to load bean: type:org.apache.struts2.rest.handler.ContentTypeHandler class:org.apache.struts2.rest.handler.JacksonLibHandler - bean - file:/var/task/struts.xml:26:70
at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.register(XmlConfigurationProvider.java:274)
at org.apache.struts2.config.StrutsXmlConfigurationProvider.register(StrutsXmlConfigurationProvider.java:98)
at com.opensymphony.xwork2.config.impl.DefaultConfiguration.reloadContainer(DefaultConfiguration.java:167)
at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:66)
... 22 more
Caused by: java.lang.ClassNotFoundException: org.apache.struts2.rest.handler.JacksonLibHandler. Current classpath: file:/var/task/:file:/var/task/lib/asm-9.2.jar:file:/var/task/lib/asm-analysis-9.2.jar:file:/var/task/lib/asm-commons-9.2.jar:file:/var/task/lib/asm-tree-9.2.jar:file:/var/task/lib/aws-lambda-java-core-1.2.1.jar:file:/var/task/lib/aws-lambda-java-log4j2-1.5.1.jar:file:/var/task/lib/aws-serverless-java-container-core-1.8.2.jar:file:/var/task/lib/aws-serverless-java-container-struts2-1.8.2.jar:file:/var/task/lib/classmate-1.3.4.jar:file:/var/task/lib/commons-codec-1.11.jar:file:/var/task/lib/commons-fileupload-1.4.jar:file:/var/task/lib/commons-io-2.2.jar:file:/var/task/lib/commons-lang3-3.10.jar:file:/var/task/lib/commons-logging-1.2.jar:file:/var/task/lib/freemarker-2.3.31.jar:file:/var/task/lib/hibernate-validator-6.1.7.Final.jar:file:/var/task/lib/httpclient-4.5.13.jar:file:/var/task/lib/httpcore-4.4.13.jar:file:/var/task/lib/httpmime-4.5.13.jar:file:/var/task/lib/jackson-annotations-2.13.4.jar:file:/var/task/lib/jackson-core-2.13.4.jar:file:/var/task/lib/jackson-databind-2.13.4.jar:file:/var/task/lib/jackson-module-afterburner-2.13.3.jar:file:/var/task/lib/jakarta.activation-1.2.2.jar:file:/var/task/lib/jakarta.validation-api-2.0.2.jar:file:/var/task/lib/javassist-3.20.0-GA.jar:file:/var/task/lib/javax.servlet-api-3.1.0.jar:file:/var/task/lib/javax.ws.rs-api-2.1.jar:file:/var/task/lib/jboss-logging-3.3.2.Final.jar:file:/var/task/lib/jsp-api-2.0.jar:file:/var/task/lib/log4j-api-2.19.0.jar:file:/var/task/lib/log4j-core-2.19.0.jar:file:/var/task/lib/log4j-slf4j-impl-2.19.0.jar:file:/var/task/lib/objenesis-3.2.jar:file:/var/task/lib/ognl-3.1.29.jar:file:/var/task/lib/servlet-api-2.4.jar:file:/var/task/lib/slf4j-api-1.7.36.jar:file:/var/task/lib/struts2-aws-lambda-support-plugin-1.4.0.jar:file:/var/task/lib/struts2-bean-validation-plugin-6.0.3.jar:file:/var/task/lib/struts2-convention-plugin-6.0.3.jar:file:/var/task/lib/struts2-core-2.5.30.jar:file:/var/task/lib/struts2-rest-plugin-6.0.3.jar:file:/var/task/lib/validation-api-2.0.1.Final.jar:file:/var/task/lib/xstream-1.4.19.jar
at lambdainternal.CustomerClassLoader.findClass(CustomerClassLoader.java:63)
at java.base/java.lang.ClassLoader.loadClass(Unknown Source)
at java.base/java.lang.ClassLoader.loadClass(Unknown Source)
at com.opensymphony.xwork2.util.ClassLoaderUtil.loadClass(ClassLoaderUtil.java:179)
at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.register(XmlConfigurationProvider.java:247)
... 25 more
END RequestId: 693f3245-d782-4d96-82bd-30557b5438cc
REPORT RequestId: 693f3245-d782-4d96-82bd-30557b5438cc Init Duration: 0.14 ms Duration: 1695.86 ms Billed Duration: 1696 ms Memory Size: 512 MB Max Memory Used: 512 MB
{"statusCode":502,"multiValueHeaders":{"Content-Type":["application/json"]},"body":"{\"message\":\"Gateway timeout\"}","isBase64Encoded":false}% (samcli38) greenwd@dev-dsk-greenwd-2c-523a372f] ~/workspace/blink-profiling/src/LambdaSnapStartProfilingTools/snapstart-profiling-sam
Analysis
looked through the ZIP and I think JacksonLibHandler is expected to be in the JAR lib/struts2-rest-plugin-6.0.3.jar
unpacking that JAR, I don't see that class (see below)
Caused by: java.lang.ClassNotFoundException: com.fasterxml.jackson.dataformat.xml.XmlMapper. Current classpath: file:/var/task/:file:/var/task/lib/asm-9.2.jar:file:/var/task/lib/asm-analysis-9.2.jar:file:/var/task/lib/asm-commons-9.2.jar:file:/var/task/lib/asm-tree-9.2.jar:file:/var/task/lib/aws-lambda-java-core-1.2.1.jar:file:/var/task/lib/aws-lambda-java-log4j2-1.5.1.jar:file:/var/task/lib/aws-serverless-java-container-core-1.8.2.jar:file:/var/task/lib/aws-serverless-java-container-struts2-1.8.2.jar:file:/var/task/lib/classmate-1.3.4.jar:file:/var/task/lib/commons-codec-1.11.jar:file:/var/task/lib/commons-fileupload-1.4.jar:file:/var/task/lib/commons-io-2.2.jar:file:/var/task/lib/commons-lang3-3.10.jar:file:/var/task/lib/commons-logging-1.2.jar:file:/var/task/lib/freemarker-2.3.31.jar:file:/var/task/lib/hibernate-validator-6.1.7.Final.jar:file:/var/task/lib/httpclient-4.5.13.jar:file:/var/task/lib/httpcore-4.4.13.jar:file:/var/task/lib/httpmime-4.5.13.jar:file:/var/task/lib/jackson-annotations-2.13.4.jar:file:/var/task/lib/jackson-core-2.13.4.jar:file:/var/task/lib/jackson-databind-2.13.4.jar:file:/var/task/lib/jackson-module-afterburner-2.13.3.jar:file:/var/task/lib/jakarta.activation-1.2.2.jar:file:/var/task/lib/jakarta.validation-api-2.0.2.jar:file:/var/task/lib/javassist-3.20.0-GA.jar:file:/var/task/lib/javax.servlet-api-3.1.0.jar:file:/var/task/lib/javax.ws.rs-api-2.1.jar:file:/var/task/lib/jboss-logging-3.3.2.Final.jar:file:/var/task/lib/jsp-api-2.0.jar:file:/var/task/lib/log4j-api-2.19.0.jar:file:/var/task/lib/log4j-core-2.19.0.jar:file:/var/task/lib/log4j-slf4j-impl-2.19.0.jar:file:/var/task/lib/objenesis-3.2.jar:file:/var/task/lib/ognl-3.1.29.jar:file:/var/task/lib/servlet-api-2.4.jar:file:/var/task/lib/slf4j-api-1.7.36.jar:file:/var/task/lib/struts2-aws-lambda-support-plugin-1.4.0.jar:file:/var/task/lib/struts2-bean-validation-plugin-6.0.3.jar:file:/var/task/lib/struts2-convention-plugin-6.0.3.jar:file:/var/task/lib/struts2-core-2.5.30.jar:file:/var/task/lib/struts2-rest-plugin-6.0.3.jar:file:/var/task/lib/validation-api-2.0.1.Final.jar:file:/var/task/lib/xstream-1.4.19.jar
at lambdainternal.CustomerClassLoader.findClass(CustomerClassLoader.java:63)
at java.base/java.lang.ClassLoader.loadClass(Unknown Source)
at java.base/java.lang.ClassLoader.loadClass(Unknown Source)
... 72 more
it would appear that JacksonLibHandler did some sort of multiplexing logic across both the XML and JSON handlers? and that directing Struts at one or the other doesn't help.
To help us debug your issue fill in the basic information below using the options provided
Serverless Java Container version:
1.10
Implementations:
Struts2
Framework version:
Struts 6.0.3
Frontend service: None (plain Lambda exercises the issue)
Deployment method:
SAM
Scenario
Build and run the
struts
sampleExpected behavior
sam local invoke
works, the function works deployed to LambdaActual behavior
Error finding the required classes in the built ZIP file
Steps to reproduce
cd samples/struts/pet-store
sam build
test-event.json
with content from belowHandler
property of the function in theSAM
template to even get this far. The correct handler string iscom.amazonaws.serverless.proxy.struts2.Struts2LambdaHandler::handleRequest
sam local invoke -e test-event.json
Full log output
Baseline (no changes to struts.xml)
Analysis
JacksonLibHandler
is expected to be in the JARlib/struts2-rest-plugin-6.0.3.jar
JacksonJsonHandler
andJacksonXmlHandler
attempt 2: modify bean
JacksonLibHandler
, like so:sam local invoke
againJacksonLibHandler
did some sort of multiplexing logic across both the XML and JSON handlers? and that directing Struts at one or the other doesn't help.test-event.json
The text was updated successfully, but these errors were encountered: