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

Spring JIRA | S. Paetzold | 5 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 | 5 months ago | S. Paetzold
    java.lang.IllegalArgumentException: Expected one of Callable, DeferredResult, or ListenableFuture: class com.ysura.rest.controller.ActivityController$CommandResult
  2. 0

    Add support for Functional types / non-fully-specified types to assisted Inject

    GitHub | 7 months ago | Groostav
    java.lang.IllegalArgumentException: Expected a Class, ParameterizedType, or GenericArrayType, but <? extends com.empowerops.language.KotlinLanguageFixture$KotlinClassWithJavaIdiomaticFactory> is of type com.google.inject.internal.MoreTypes$WildcardTypeImpl
  3. 0

    I'm experimenting with the new async servlet support and created an AsyncHandlerInterceptor with a getAsyncCallable method that always returns null. Returning null is allowed according to the JavaDoc. Now with every request Spring logs the following exception with severity error. The interceptor and the website seem to function normally, but the logging is quite annoying. 2012-06-20 17:52:15,154 ERROR [http-bio-443-exec-22] o.s.w.s.HandlerExecutionChain [HandlerExecutionChain.java:176] HandlerInterceptor.addAsyncCallables threw exception java.lang.IllegalArgumentException: Callable required at org.springframework.util.Assert.notNull(Assert.java:112) ~[spring-core-3.2.0.M1.jar:3.2.0.M1] at org.springframework.web.context.request.async.AsyncExecutionChain.addDelegatingCallable(AsyncExecutionChain.java:130) ~[spring-web-3.2.0.M1.jar:3.2.0.M1] at org.springframework.web.servlet.HandlerExecutionChain.addDelegatingCallables(HandlerExecutionChain.java:173) ~[spring-webmvc-3.2.0.M1.jar:3.2.0.M1] at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:944) [spring-webmvc-3.2.0.M1.jar:3.2.0.M1] at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:859) [spring-webmvc-3.2.0.M1.jar:3.2.0.M1] at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:883) [spring-webmvc-3.2.0.M1.jar:3.2.0.M1] at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:792) [spring-webmvc-3.2.0.M1.jar:3.2.0.M1] [...]

    Spring JIRA | 4 years ago | Peter De Wachter
    java.lang.IllegalArgumentException: Callable required
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    When given a Class, look for static ToJson/FromJson methods.

    GitHub | 9 months ago | JakeWharton
    java.lang.IllegalArgumentException: Expected at least one @ToJson or @FromJson method on java.lang.Class
  6. 0

    Recent changes for jGit support broke zipFileController

    GitHub | 2 years ago | sergebug
    java.lang.IllegalArgumentException: One of setGitDir or setWorkTree must be called.

    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