DefaultMvcResult.getAsyncResult() has thrown an IllegalStateException

java.lang.IllegalStateException
Javadoc
Signals that a method has been invoked at an illegal or inappropriate time. In other words, the Java environment or Java application is not in an appropriate state for the requested operation. @author Jonni Kanerva @since JDK1.1
at org.springframework.test.web.servlet.DefaultMvcResult.getAsyncResult
(source)
at org.springframework.test.web.servlet.DefaultMvcResult.getAsyncResult
(source)

Typical Exception Messages

  1. Async result for handler [public java.lang.String org.vpac.web.controller.DatasetController.createOrUpdateDataset(org.vpac.web.model.request.DatasetRequest,org.springframework.ui.ModelMap) throws org.vpac.web.exception.ResourceNotFoundException,java.io.IOException] was not set during the specified timeToWait=-1
  2. Gave up waiting on async result from handler [public org.springframework.web.context.request.async.DeferredResult<java.util.List<java.lang.String>> org.springframework.samples.async.chat.ChatController.getMessages(int)] to complete
  3. Gave up waiting on async result from handler [public org.springframework.web.context.request.async.DeferredResult<java.lang.String> SimpleController.handle()] to complete
  4. Async result for handler [rx.Single<java.util.List<MyType>> MyController.fetchFromDB()] was not set during the specified timeToWait=-1
  5. Async result for handler [public org.springframework.web.context.request.async.DeferredResult<org.springframework.http.ResponseEntity<org.springframework.core.io.InputStreamResource>> com.example.controller.FileController.getSomeFile()] was not set during the specified timeToWait=9223372036854775807

Origin

MockMvc failed waiting on async call

java.lang.IllegalStateException
org.springframework.test.web.servlet.DefaultMvcResult.getAsyncResult
4Web pages
1Solution

Specific cases

External results for this pattern (3)

  1. piotrekvia Stack Overflow4 months ago
    Async result for handler [rx.Single<java.util.List<MyType>> MyController.fetchFromDB()] was not set during the specified timeToWait=-1
    Show stack trace
  2. marknorkinvia Stack Overflow4 months ago
    Async result for handler [public org.springframework.web.context.request.async.DeferredResult<org.springframework.http.ResponseEntity<org.springframework.core.io.InputStreamResource>> com.example.controller.FileController.getSomeFile()] was not set during the specified timeToWait=9223372036854775807
    Show stack trace
  3. Maxim Valyanskiyvia Spring JIRA4 months ago
    Gave up waiting on async result from handler [public org.springframework.web.context.request.async.DeferredResult<java.lang.String> SimpleController.handle()] to complete
    Show stack trace