4 Replies Latest reply on Sep 29, 2016 6:28 AM by Dhamodharan Devarajan

    IllegalArgumentException - 'No servlet context to dispatch to' error in undertow for async servlet

    Dhamodharan Devarajan Newbie

      I am getting the below error when undertow tries to dispatch the httpresponse.

       

       

           java.lang.IllegalArgumentException: UT010046: No servlet context at  to dispatch to   

           at io.undertow.servlet.spec.AsyncContextImpl.dispatch(AsyncContextImpl.java:173)  [undertow-servlet-1.1.0.Final.jar!/:1.1.0.Final]

           at org.eclipse.jetty.continuation.Servlet3Continuation.resume(Servlet3Continuation.java:152) ~[jetty-continuation.jar:8.1.3.v20120416]

           at com.xyz.xyzapp.apihandler.util.AsyncJobWaitingAPIHandler$MultiJobCompletionContext.onListenerCompletion(AsyncJobWaitingAPIHandler.java:460) ~[xyzapp-apihandler.jar:1.4.1-2015.10.dev]

           at com.xyz.xyzapp.apihandler.util.AsyncJobWaitingAPIHandler$MultiJobCompletionListener.onCompletion(AsyncJobWaitingAPIHandler.java:492) ~[xyzapp-apihandler.jar:1.4.1-2015.10.dev]

           at com.xyz.xyzapp.job.JobEngine$4.onEvent(JobEngine.java:274) ~[xyzapp-job.jar:1.4.1-2015.10.dev]

           at com.xyz.xyzapp.job.JobEngine$4.onEvent(JobEngine.java:269) ~[xyzapp-job.jar:1.4.1-2015.10.dev]

           at com.xyz.xyzapp.core.event.multicast.LocalMulticastEventManager$1.run(LocalMulticastEventManager.java:134) ~[xyzapp-core.jar:1.4.1-2015.10.dev]

           at org.springframework.scheduling.support.DelegatingErrorHandlingRunnable.run(DelegatingErrorHandlingRunnable.java:53) ~[spring-context.jar:3.2.9.RELEASE]

           at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [na:1.8.0_51]

           at java.util.concurrent.FutureTask.run(FutureTask.java:266) [na:1.8.0_51]

           at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180) [na:1.8.0_51]

           at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293) [na:1.8.0_51]    

           at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [na:1.8.0_51]   

           at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [na:1.8.0_51]

       

       

      I am using Jetty.Continuation (8.1.3) to suspend the HTTPrequest until it has the response. I have spring (3.2.9) application that is deployed in wildfly (8.2.0.Final). Spring servlet is configured via web-fragment.xml to indicate that servlet is asynchronous

       

          <servlet>

              <servlet-name>apis</servlet-name>

              <servlet-class>com.xyz.xyzapp.server.common.spring.ClassloaderOverridingDispatcherServlet</servlet-class>

              <load-on-startup>1</load-on-startup>

              <async-supported>true</async-supported>

          </servlet>

       

      When one of the job (job is internal framework) completes, it need to respond back to clients (whoever is listening)

      that job is completed. During this workflow, I am getting the above error.

       

      I made sure the wildfly is up and running, clients are actually waiting for response.

       

      This was working with Jboss 6.1.0.Final/Tomcat.

       

      What could be the problem? Any configuration I need to add in standalone-full.xml for undertow? It appears that undertow closed the HTTPrequest, not sure.