aws / aws/serverless-java-container
java.lang.ClassNotFoundException when debug using aws-toolkit-jetbrains in IntelliJ
- 主要语言
- Java
- 星标
- 1.6k
- 派生
- 574
- PR 合并指标
- 30 天内没有已合并 PR
描述
* Framework version: 1.4
* Implementations: Spring Boot2
## Scenario
Debug from StreamLambdaHandler using the toolkit in IntelliJ, java.lang.ClassNotFoundException: com.amazonaws.serverless.sample.springboot2.StreamLambdaHandler will occur
## Expected behavior
Debug to desired breakpoint in IntelliJ
## Actual behavior
java.lang.ClassNotFoundException: com.amazonaws.serverless.sample.springboot2.StreamLambdaHandler will occur
## Steps to reproduce
1. git clone the sample project
2. Open Java class StreamLambdaHandler and click the lambda icon to debug the code.
3. Use default event template of 'API Gateway AWS Proxy' as input, others set as default.
4. Error output in console.
## Full log output
/usr/local/bin/sam local invoke --template /Users/ryan/Documents/WorkSpace/Java/aws/lambda/pet-store/src/main/.aws-sam/build/template.yaml --event "/private/var/folders/vf/msvny93n2990vpxj3gvw2lb00000gn/T/[Local] StreamLambdaHandler-event.json" --debug-port 53272
Invoking com.amazonaws.serverless.sample.springboot2.StreamLambdaHandler (java8)
2019-11-25 20:12:29 Found credentials in environment variables.
Fetching lambci/lambda:java8 Docker container image......
Mounting /Users/ryan/Documents/WorkSpace/Java/aws/lambda/pet-store/src/main/.aws-sam/build/Function as /var/task:ro,delegated inside runtime container
Connected to the target VM, address: 'localhost:53272', transport: 'socket'
START RequestId: 04e64b0e-d63e-1dda-7e9f-801bd72b2989 Version: $LATEST
java.lang.ClassNotFoundException: com.amazonaws.serverless.sample.springboot2.StreamLambdaHandler
at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:348)
Exception in thread "main" java.lang.Error: java.lang.RuntimeException: java.lang.RuntimeException: Unexpected status code from invocation/response: 299
at lambdainternal.AWSLambda.(AWSLambda.java:66)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:348)
at lambdainternal.LambdaRTEntry.main(LambdaRTEntry.java:114)
Caused by: java.lang.RuntimeException: java.lang.RuntimeException: Unexpected status code from invocation/response: 299
at lambdainternal.LambdaRuntime.reportDone(LambdaRuntime.java:219)
at lambdainternal.AWSLambda.startRuntime(AWSLambda.java:318)
at lambdainternal.AWSLambda.(AWSLambda.java:64)
... 3 more
Caused by: java.lang.RuntimeException: Unexpected status code from invocation/response: 299
at lambdainternal.LambdaRuntime.reportDone(LambdaRuntime.java:216)
... 5 more
Disconnected from the target VM, address: 'localhost:53272', transport: 'socket'
贡献指南
调研方向
Reproduce the issue by opening StreamLambdaHandler in IntelliJ and running the default API Gateway AWS Proxy event through the shown sam local invoke command. Trace how the built Function directory is assembled and how the toolkit resolves com.amazonaws.serverless.sample.springboot2.StreamLambdaHandler. Done means the debug invocation loads the class and reaches the selected breakpoint without ClassNotFoundException.
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- aws, java, spring-boot
- 领域
- api, backend, devtools
- Issue 类型
- 缺陷
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 35/100