Sourabh Rawat
01/10/2021, 6:37 AMWARNING: A HTTP GET method, public final java.lang.Object com.example.demo.FooController.bar(java.lang.String,kotlin.coroutines.Continuation), should not consume any entity.
WARNING: Parameter 1 of type kotlin.coroutines.Continuation<? super java.lang.String> from public final java.lang.Object com.example.demo.FooController.foobar(kotlin.coroutines.Continuation<? super java.lang.String>) is not resolvable to a concrete type.
WARNING: A HTTP GET method, public final java.lang.Object com.example.demo.FooController.foobar(kotlin.coroutines.Continuation), should not consume any entity.
2021-01-10 11:51:30.715 ERROR 20636 --- [nio-8080-exec-1] o.a.c.c.C.[.[.[.[.e.demo.JerseyConfig] : Servlet.service() for servlet [com.example.demo.JerseyConfig] in context with path [] threw exception [java.lang.NullPointerException] with root cause
java.lang.NullPointerException: null
at kotlinx.coroutines.CoroutineScopeKt.coroutineScope(CoroutineScope.kt:193) ~[kotlinx-coroutines-core-jvm-1.4.2.jar:na]
at com.example.demo.FooController.bar(FooController.kt:36) ~[main/:na]
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:na]
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:na]
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:na]
at java.base/java.lang.reflect.Method.invoke(Method.java:566) ~[na:na]
Code:
@GET
@Path("{name}")
@Produces(MediaType.APPLICATION_JSON)
suspend fun bar(@PathParam("name") name: String): Bar = coroutineScope {
val foo = async { Bar(name) }
foo.await()
}
wakingrufus
01/11/2021, 10:27 PMsuspend
and start a blocking coroutine context within the methodJonas Bark
01/14/2021, 3:03 PMwakingrufus
01/14/2021, 3:08 PMBen Madore
01/15/2021, 11:15 PM