java.lang.IllegalArgumentException: Expected one of Callable, DeferredResult, or ListenableFuture: class com.ysura.rest.controller.ActivityController$CommandResult

Spring JIRA | S. Paetzold | 7 months ago
  1. 0

    In Spring 4.1.1.RELEASE following code used to work: {code:java} @ResponseBody @RequestMapping(value = "", method = PUT) public CommandResult put(@Valid @RequestBody Record record) { ... CommandResult result = sendCommand(...); return result; } private class CommandResult extends DeferredResult<Object> implements CommandCallback<Object> { @Override public void onSuccess(Object result) { setResult(result); } @Override public void onFailure(Throwable cause) { setErrorResult(cause); } } {code} Following exception is thrown: {code} java.lang.IllegalArgumentException: Expected one of Callable, DeferredResult, or ListenableFuture: class com.ysura.rest.controller.ActivityController$CommandResult at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod$ConcurrentResultMethodParameter.getParameterType(ServletInvocableHandlerMethod.java:273) ~[spring-webmvc-4.2.6.RELEASE.jar:4.2.6.RELEASE] at org.springframework.web.servlet.mvc.method.annotation.ModelAndViewMethodReturnValueHandler.supportsReturnType(ModelAndViewMethodReturnValueHandler.java:72) ~[spring-webmvc-4.2.6.RELEASE.jar:4.2.6.RELEASE] at org.springframework.web.method.support.HandlerMethodReturnValueHandlerComposite.selectHandler(HandlerMethodReturnValueHandlerComposite.java:90) ~[spring-web-4.2.6.RELEASE.jar:4.2.6.RELEASE] at org.springframework.web.method.support.HandlerMethodReturnValueHandlerComposite.handleReturnValue(HandlerMethodReturnValueHandlerComposite.java:77) ~[spring-web-4.2.6.RELEASE.jar:4.2.6.RELEASE] at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:126) ~[spring-webmvc-4.2.6.RELEASE.jar:4.2.6.RELEASE] at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:832) ~[spring-webmvc-4.2.6.RELEASE.jar:4.2.6.RELEASE] at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:743) ~[spring-webmvc-4.2.6.RELEASE.jar:4.2.6.RELEASE] at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:85) ~[spring-webmvc-4.2.6.RELEASE.jar:4.2.6.RELEASE] at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:961) ~[spring-webmvc-4.2.6.RELEASE.jar:4.2.6.RELEASE] at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:895) ~[spring-webmvc-4.2.6.RELEASE.jar:4.2.6.RELEASE] at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:967) [spring-webmvc-4.2.6.RELEASE.jar:4.2.6.RELEASE] at org.springframework.web.servlet.FrameworkServlet.doPut(FrameworkServlet.java:880) [spring-webmvc-4.2.6.RELEASE.jar:4.2.6.RELEASE] at javax.servlet.http.HttpServlet.service(HttpServlet.java:710) [jetty-runner-9.3.6.v20151106.jar:9.3.6.v20151106] at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:843) [spring-webmvc-4.2.6.RELEASE.jar:4.2.6.RELEASE] at javax.servlet.http.HttpServlet.service(HttpServlet.java:790) [jetty-runner-9.3.6.v20151106.jar:9.3.6.v20151106] at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:821) [jetty-runner-9.3.6.v20151106.jar:9.3.6.v20151106] at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1685) [jetty-runner-9.3.6.v20151106.jar:9.3.6.v20151106] ... {code} If the method return type is simply changed to {{DeferredResult<Object>}} it starts working again!

    Spring JIRA | 7 months ago | S. Paetzold
    java.lang.IllegalArgumentException: Expected one of Callable, DeferredResult, or ListenableFuture: class com.ysura.rest.controller.ActivityController$CommandResult
  2. 0
    Some bots are sending malformed HTTP requests to your site. Try to find their IP addresses in the access logs and ask them to fix the bots or blacklist them.
  3. 0
    This error is caused by malformed HTTP request. You are trying to access unsecured page through https.
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

    Not finding the right solution?
    Take a tour to get the most out of Samebug.

    Tired of useless tips?

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. java.lang.IllegalArgumentException

      Expected one of Callable, DeferredResult, or ListenableFuture: class com.ysura.rest.controller.ActivityController$CommandResult

      at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod$ConcurrentResultMethodParameter.getParameterType()
    2. Spring MVC
      ModelAndViewMethodReturnValueHandler.supportsReturnType
      1. org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod$ConcurrentResultMethodParameter.getParameterType(ServletInvocableHandlerMethod.java:273)[spring-webmvc-4.2.6.RELEASE.jar:4.2.6.RELEASE]
      2. org.springframework.web.servlet.mvc.method.annotation.ModelAndViewMethodReturnValueHandler.supportsReturnType(ModelAndViewMethodReturnValueHandler.java:72)[spring-webmvc-4.2.6.RELEASE.jar:4.2.6.RELEASE]
      2 frames
    3. Spring
      HandlerMethodReturnValueHandlerComposite.handleReturnValue
      1. org.springframework.web.method.support.HandlerMethodReturnValueHandlerComposite.selectHandler(HandlerMethodReturnValueHandlerComposite.java:90)[spring-web-4.2.6.RELEASE.jar:4.2.6.RELEASE]
      2. org.springframework.web.method.support.HandlerMethodReturnValueHandlerComposite.handleReturnValue(HandlerMethodReturnValueHandlerComposite.java:77)[spring-web-4.2.6.RELEASE.jar:4.2.6.RELEASE]
      2 frames
    4. Spring MVC
      FrameworkServlet.doPut
      1. org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:126)[spring-webmvc-4.2.6.RELEASE.jar:4.2.6.RELEASE]
      2. org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:832)[spring-webmvc-4.2.6.RELEASE.jar:4.2.6.RELEASE]
      3. org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:743)[spring-webmvc-4.2.6.RELEASE.jar:4.2.6.RELEASE]
      4. org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:85)[spring-webmvc-4.2.6.RELEASE.jar:4.2.6.RELEASE]
      5. org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:961)[spring-webmvc-4.2.6.RELEASE.jar:4.2.6.RELEASE]
      6. org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:895)[spring-webmvc-4.2.6.RELEASE.jar:4.2.6.RELEASE]
      7. org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:967)[spring-webmvc-4.2.6.RELEASE.jar:4.2.6.RELEASE]
      8. org.springframework.web.servlet.FrameworkServlet.doPut(FrameworkServlet.java:880)[spring-webmvc-4.2.6.RELEASE.jar:4.2.6.RELEASE]
      8 frames
    5. JavaServlet
      HttpServlet.service
      1. javax.servlet.http.HttpServlet.service(HttpServlet.java:710)[jetty-runner-9.3.6.v20151106.jar:9.3.6.v20151106]
      1 frame
    6. Spring MVC
      FrameworkServlet.service
      1. org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:843)[spring-webmvc-4.2.6.RELEASE.jar:4.2.6.RELEASE]
      1 frame
    7. JavaServlet
      HttpServlet.service
      1. javax.servlet.http.HttpServlet.service(HttpServlet.java:790)[jetty-runner-9.3.6.v20151106.jar:9.3.6.v20151106]
      1 frame
    8. Jetty
      ServletHandler$CachedChain.doFilter
      1. org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:821)[jetty-runner-9.3.6.v20151106.jar:9.3.6.v20151106]
      2. org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1685)[jetty-runner-9.3.6.v20151106.jar:9.3.6.v20151106]
      2 frames