spring-cloud-function-adapter-azure-web v4.1.1 gives Error on sample project
umerckx opened this issue · 4 comments
Describe the bug
When using the sample project function-sample-azure-web and upgrading the dependency spring-cloud-function-adapter-azure-web from version 4.1.0-SNAPSHOT to version 4.1.1 the following exception occurs when calling http://localhost:7072/api/AzureWebAdapter/:
java.lang.NullPointerException: Cannot invoke "jakarta.servlet.ServletConfig.getServletContext()" because the return value of "jakarta.servlet.GenericServlet.getServletConfig()" is null [2024-05-08T12:47:17.378Z] at jakarta.servlet.GenericServlet.getServletContext(GenericServlet.java:113) [2024-05-08T12:47:17.378Z] at org.springframework.cloud.function.serverless.web.ServerlessMVC$ProxyFilterChain.<init>(ServerlessMVC.java:224) [2024-05-08T12:47:17.378Z] at org.springframework.cloud.function.serverless.web.ServerlessMVC.service(ServerlessMVC.java:167) [2024-05-08T12:47:17.378Z] at org.springframework.cloud.function.serverless.web.ServerlessMVC.service(ServerlessMVC.java:163) [2024-05-08T12:47:17.378Z] at org.springframework.cloud.function.adapter.azure.web.AzureWebProxyInvoker.execute(AzureWebProxyInvoker.java:128) [2024-05-08T12:47:17.378Z] at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [2024-05-08T12:47:17.379Z] at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) [2024-05-08T12:47:17.379Z] at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [2024-05-08T12:47:17.379Z] at java.base/java.lang.reflect.Method.invoke(Method.java:568) [2024-05-08T12:47:17.379Z] at com.microsoft.azure.functions.worker.broker.JavaMethodInvokeInfo.invoke(JavaMethodInvokeInfo.java:22) [2024-05-08T12:47:17.379Z] at com.microsoft.azure.functions.worker.broker.JavaMethodExecutor.execute(JavaMethodExecutor.java:22) [2024-05-08T12:47:17.379Z] at com.microsoft.azure.functions.worker.chain.FunctionExecutionMiddleware.invoke(FunctionExecutionMiddleware.java:19) [2024-05-08T12:47:17.379Z] at com.microsoft.azure.functions.worker.chain.InvocationChain.doNext(InvocationChain.java:21) [2024-05-08T12:47:17.380Z] at com.microsoft.azure.functions.worker.broker.JavaFunctionBroker.invoke(JavaFunctionBroker.java:133) [2024-05-08T12:47:17.380Z] at com.microsoft.azure.functions.worker.broker.JavaFunctionBroker.invokeMethod(JavaFunctionBroker.java:124) [2024-05-08T12:47:17.380Z] at com.microsoft.azure.functions.worker.handler.InvocationRequestHandler.execute(InvocationRequestHandler.java:34) [2024-05-08T12:47:17.380Z] at com.microsoft.azure.functions.worker.handler.InvocationRequestHandler.execute(InvocationRequestHandler.java:10) [2024-05-08T12:47:17.380Z] at com.microsoft.azure.functions.worker.handler.MessageHandler.handle(MessageHandler.java:44) [2024-05-08T12:47:17.380Z] at com.microsoft.azure.functions.worker.JavaWorkerClient$StreamingMessagePeer.lambda$onNext$0(JavaWorkerClient.java:94) [2024-05-08T12:47:17.381Z] at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539) [2024-05-08T12:47:17.381Z] at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264) [2024-05-08T12:47:17.381Z] at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) [2024-05-08T12:47:17.381Z] at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) [2024-05-08T12:47:17.381Z] at java.base/java.lang.Thread.run(Thread.java:833) [2024-05-08T12:47:17.421Z] Executed 'Functions.AzureWebAdapter' (Failed, Id=3c449865-5dd4-40e3-bb6c-3660aa2fbfc8, Duration=4492ms) [2024-05-08T12:47:17.421Z] System.Private.CoreLib: Exception while executing function: Functions.AzureWebAdapter. System.Private.CoreLib: Result: Failure Exception: NullPointerException: Cannot invoke "jakarta.servlet.ServletConfig.getServletContext()" because the return value of "jakarta.servlet.GenericServlet.getServletConfig()" is null Stack: java.lang.reflect.InvocationTargetException [2024-05-08T12:47:17.422Z] at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [2024-05-08T12:47:17.422Z] at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) [2024-05-08T12:47:17.422Z] at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [2024-05-08T12:47:17.422Z] at java.base/java.lang.reflect.Method.invoke(Method.java:568) [2024-05-08T12:47:17.422Z] at com.microsoft.azure.functions.worker.broker.JavaMethodInvokeInfo.invoke(JavaMethodInvokeInfo.java:22) [2024-05-08T12:47:17.422Z] at com.microsoft.azure.functions.worker.broker.JavaMethodExecutor.execute(JavaMethodExecutor.java:22) [2024-05-08T12:47:17.422Z] at com.microsoft.azure.functions.worker.chain.FunctionExecutionMiddleware.invoke(FunctionExecutionMiddleware.java:19) [2024-05-08T12:47:17.422Z] at com.microsoft.azure.functions.worker.chain.InvocationChain.doNext(InvocationChain.java:21) [2024-05-08T12:47:17.422Z] at com.microsoft.azure.functions.worker.broker.JavaFunctionBroker.invoke(JavaFunctionBroker.java:133) [2024-05-08T12:47:17.423Z] at com.microsoft.azure.functions.worker.broker.JavaFunctionBroker.invokeMethod(JavaFunctionBroker.java:124) [2024-05-08T12:47:17.423Z] at com.microsoft.azure.functions.worker.handler.InvocationRequestHandler.execute(InvocationRequestHandler.java:34) [2024-05-08T12:47:17.423Z] at com.microsoft.azure.functions.worker.handler.InvocationRequestHandler.execute(InvocationRequestHandler.java:10) [2024-05-08T12:47:17.423Z] at com.microsoft.azure.functions.worker.handler.MessageHandler.handle(MessageHandler.java:44) [2024-05-08T12:47:17.423Z] at com.microsoft.azure.functions.worker.JavaWorkerClient$StreamingMessagePeer.lambda$onNext$0(JavaWorkerClient.java:94) [2024-05-08T12:47:17.423Z] at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539) [2024-05-08T12:47:17.423Z] at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264) [2024-05-08T12:47:17.423Z] at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) [2024-05-08T12:47:17.423Z] at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) [2024-05-08T12:47:17.424Z] at java.base/java.lang.Thread.run(Thread.java:833) [2024-05-08T12:47:17.424Z] Caused by: java.lang.IllegalStateException: java.lang.NullPointerException: Cannot invoke "jakarta.servlet.ServletConfig.getServletContext()" because the return value of "jakarta.servlet.GenericServlet.getServletConfig()" is null [2024-05-08T12:47:17.424Z] at org.springframework.cloud.function.adapter.azure.web.AzureWebProxyInvoker.execute(AzureWebProxyInvoker.java:147) [2024-05-08T12:47:17.424Z] ... 19 more [2024-05-08T12:47:17.424Z] Caused by: java.lang.NullPointerException: Cannot invoke "jakarta.servlet.ServletConfig.getServletContext()" because the return value of "jakarta.servlet.GenericServlet.getServletConfig()" is null [2024-05-08T12:47:17.424Z] at jakarta.servlet.GenericServlet.getServletContext(GenericServlet.java:113) [2024-05-08T12:47:17.424Z] at org.springframework.cloud.function.serverless.web.ServerlessMVC$ProxyFilterChain.<init>(ServerlessMVC.java:224) [2024-05-08T12:47:17.424Z] at org.springframework.cloud.function.serverless.web.ServerlessMVC.service(ServerlessMVC.java:167) [2024-05-08T12:47:17.424Z] at org.springframework.cloud.function.serverless.web.ServerlessMVC.service(ServerlessMVC.java:163) [2024-05-08T12:47:17.424Z] at org.springframework.cloud.function.adapter.azure.web.AzureWebProxyInvoker.execute(AzureWebProxyInvoker.java:128) [2024-05-08T12:47:17.425Z] ... 19 more [2024-05-08T12:47:17.425Z] .