Skip to content

java.lang.ClassCastException: java.util.LinkedHashMap cannot be cast to example.Foo #8

@abrass

Description

@abrass

If I upload the *aws.jar over the Web-UI and run a test with following object:
{ "value" : "test"}

I get following error:

2017-07-30 11:06:57.701  INFO 1 --- [           main] lambdainternal.LambdaRTEntry             : Starting LambdaRTEntry on ip-10-15-139-119.eu-central-1.compute.internal with PID 1 (/var/runtime/lib/LambdaJavaRTEntry-1.0.jar started by sbx_user1059 in /)
2017-07-30 11:06:57.738  INFO 1 --- [           main] lambdainternal.LambdaRTEntry             : No active profile set, falling back to default profiles: default
2017-07-30 11:06:58.401  INFO 1 --- [           main] s.c.a.AnnotationConfigApplicationContext : Refreshing org.springframework.context.annotation.AnnotationConfigApplicationContext@71dac704: startup date [Sun Jul 30 11:06:58 UTC 2017]; root of context hierarchy
2017-07-30 11:07:06.839  INFO 1 --- [           main] o.s.j.e.a.AnnotationMBeanExporter        : Registering beans for JMX exposure on startup
2017-07-30 11:07:07.061  INFO 1 --- [           main] lambdainternal.LambdaRTEntry             : Started LambdaRTEntry in 11.817 seconds (JVM running for 13.198)
java.util.LinkedHashMap cannot be cast to example.Foo: java.lang.ClassCastException
java.lang.ClassCastException: java.util.LinkedHashMap cannot be cast to example.Foo
	at org.springframework.cloud.function.support.FluxFunction.lambda$apply$0(FluxFunction.java:42)
	at reactor.core.publisher.FluxMapFuseable$MapFuseableSubscriber.onNext(FluxMapFuseable.java:107)
	at reactor.core.publisher.FluxJust$WeakScalarSubscription.request(FluxJust.java:90)
	at reactor.core.publisher.FluxMapFuseable$MapFuseableSubscriber.request(FluxMapFuseable.java:159)
	at reactor.core.publisher.BlockingIterable$SubscriberIterator.onSubscribe(BlockingIterable.java:214)
	at reactor.core.publisher.FluxMapFuseable$MapFuseableSubscriber.onSubscribe(FluxMapFuseable.java:90)
	at reactor.core.publisher.FluxJust.subscribe(FluxJust.java:67)
	at reactor.core.publisher.FluxMapFuseable.subscribe(FluxMapFuseable.java:63)
	at reactor.core.publisher.BlockingIterable.iterator(BlockingIterable.java:80)
	at org.springframework.cloud.function.adapter.aws.SpringBootStreamHandler.result(SpringBootStreamHandler.java:62)
	at org.springframework.cloud.function.adapter.aws.SpringBootStreamHandler.handleRequest(SpringBootStreamHandler.java:57)

END RequestId: 31c28ac5-7517-11e7-b330-b95203dd99fc
REPORT RequestId: 31c28ac5-7517-11e7-b330-b95203dd99fc	Duration: 15000.87 ms	Billed Duration: 15000 ms 	Memory Size: 512 MB	Max Memory Used: 102 MB	
2017-07-30T11:07:09.730Z 31c28ac5-7517-11e7-b330-b95203dd99fc Task timed out after 15.00 seconds
java.lang.ClassCastException

Am I calling the function wrongly? Seems that the jackson parser cannot identify what object is coming and match it to LinkedHashMap.

If I start the jar locally I can call a post on http:/localhost:8080/function with payload {"value" : "test"} and get it in UPPERCASE as expected

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions