quarkusio / quarkus-quickstarts

Quarkus quickstart code
https://quarkus.io
Apache License 2.0
1.94k stars 1.45k forks source link

Google function run throws java.lang.NullPointerException #691

Open binojvr opened 3 years ago

binojvr commented 3 years ago

Followed steps mentioned in https://quarkus.io/guides/gcp-functions

Run the following commands from two terminals

java -jar java-function-invoker-1.0.0-beta1.jar --classpath target/google-cloud-functions-quickstart-1.0-SNAPSHOT-runner.jar --target org.acme.quickstart.RawBackgroundFunctionPubSubTest

curl localhost:8080 -d '{"data":{"greeting":"world"}}'

Following is the log. It seems Injection deosnt work properly

2020-10-12 15:00:57.337:INFO::main: Logging initialized @116ms to org.eclipse.jetty.util.log.StdErrLog 2020-10-12 15:00:57.399:INFO:oejs.Server:main: jetty-9.4.26.v20200117; built: 2020-01-17T12:35:33.676Z; git: 7b38981d25d14afb4a12ff1f2596756144edf695; jvm 14.0.2+12-46 2020-10-12 15:00:57.420:INFO:oejsh.ContextHandler:main: Started o.e.j.s.ServletContextHandler@47ef968d{/,null,AVAILABLE} 2020-10-12 15:00:57.433:INFO:oejs.AbstractConnector:main: Started ServerConnector@1e643faf{HTTP/1.1,[http/1.1]}{0.0.0.0:8080} 2020-10-12 15:00:57.434:INFO:oejs.Server:main: Started @215ms Oct 12, 2020 3:00:57 PM com.google.cloud.functions.invoker.runner.Invoker logServerInfo INFO: Serving function... Oct 12, 2020 3:00:57 PM com.google.cloud.functions.invoker.runner.Invoker logServerInfo INFO: Function: org.acme.quickstart.RawBackgroundFunctionPubSubTest Oct 12, 2020 3:00:57 PM com.google.cloud.functions.invoker.runner.Invoker logServerInfo INFO: URL: http://localhost:8080/ PubSub event: {"greeting":"world"} Oct 12, 2020 3:01:01 PM com.google.cloud.functions.invoker.NewBackgroundFunctionExecutor service WARNING: Failed to execute org.acme.quickstart.RawBackgroundFunctionPubSubTest java.lang.NullPointerException at org.acme.quickstart.RawBackgroundFunctionPubSubTest.accept(RawBackgroundFunctionPubSubTest.java:20) at com.google.cloud.functions.invoker.NewBackgroundFunctionExecutor$RawFunctionExecutor.serviceLegacyEvent(NewBackgroundFunctionExecutor.java:209) at com.google.cloud.functions.invoker.NewBackgroundFunctionExecutor.serviceLegacyEvent(NewBackgroundFunctionExecutor.java:343) at com.google.cloud.functions.invoker.NewBackgroundFunctionExecutor.service(NewBackgroundFunctionExecutor.java:304) at javax.servlet.http.HttpServlet.service(HttpServlet.java:790) at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:755) at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:547) at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:233) at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1297) at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:188) at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:485) at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:186) at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1212) at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141) at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:127) at com.google.cloud.functions.invoker.runner.Invoker$NotFoundHandler.handle(Invoker.java:450) at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:127) at org.eclipse.jetty.server.Server.handle(Server.java:500) at org.eclipse.jetty.server.HttpChannel.lambda$handle$1(HttpChannel.java:383) at org.eclipse.jetty.server.HttpChannel.dispatch(HttpChannel.java:547) at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:375) at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:270) at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:311) at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:103) at org.eclipse.jetty.io.ChannelEndPoint$2.run(ChannelEndPoint.java:117) at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:806) at org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.run(QueuedThreadPool.java:938) at java.base/java.lang.Thread.run(Thread.java:832)

binojvr commented 3 years ago

Please close/delete the issue. This is CDI issue. I have seen another thread. I am following same to fix this