AWS Lambda Java:Lambda无法解压缩文件 [英] AWS Lambda Java: Lambda was not able to unzip the file
问题描述
我正在尝试将Java与AWS Lambda一起使用.我创建了一个具有所有依赖项的jar文件(使用maven-assembly-plugin).上传后,我无法调用lambda.我收到错误Calling the Invoke API failed with message: Lambda was not able to unzip the file
. jar文件为11 MB.我可以用java -jar
I'm trying to use Java with AWS Lambda. I created a jar file with all dependencies (using maven-assembly-plugin). Upon uploading, I cannot call the lambda. I receive the error Calling the Invoke API failed with message: Lambda was not able to unzip the file
. The jar file is 11 MB. I can execute the jar with java -jar
推荐答案
maven-assemply-plugin
输出zip
,而不是jar
. (我什至不知道有什么区别!)
maven-assemply-plugin
needs to be told to output a zip
, not a jar
. (I didn't even know there was a difference!)
将此添加到其配置中:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
...
<configuration>
...
<formats>
<format>zip</format>
</formats>
</configuration>
</plugin>
这篇关于AWS Lambda Java:Lambda无法解压缩文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!