【发布时间】:2019-11-01 18:47:29
【问题描述】:
java新手。
我用 java 8 编译过
javac HelloWorld.java --release 8
并将编译后的文件作为 aws lambda 代码上传。
为什么我在 aws lambda 中运行时会出现错误?
public class HelloWorld
{
public static void main(String[] args)
{
System.out.println("Hello, World");
}
}
错误
An error occurred during JSON parsing: java.lang.RuntimeException
java.lang.RuntimeException: An error occurred during JSON parsing
Caused by: java.io.UncheckedIOException: com.fasterxml.jackson.databind.JsonMappingException: Can not deserialize instance of java.lang.String out of START_OBJECT token
at [Source: lambdainternal.util.NativeMemoryAsInputStream@ae45eb6; line: 1, column: 1]
Caused by: com.fasterxml.jackson.databind.JsonMappingException: Can not deserialize instance of java.lang.String out of START_OBJECT token
at [Source: lambdainternal.util.NativeMemoryAsInputStream@ae45eb6; line: 1, column: 1]
at com.fasterxml.jackson.databind.JsonMappingException.from(JsonMappingException.java:148)
【问题讨论】:
-
注意:您应该遵循 Java 命名约定:类名是用 PascalCase 编写的。
helloWorld应该是HelloWorld。 -
@MCEmperor 谢谢。我这样做了,但同样的错误。已更新。
-
在非 AWS 世界中,您的程序看起来很完美。 :) 看看你是否发现它相关stackoverflow.com/questions/35545642/…
-
可能需要实现RequestHandler并重写handleRequest函数docs.aws.amazon.com/toolkit-for-eclipse/v1/user-guide/…
标签: java amazon-web-services aws-lambda