Uploaded image for project: 'Spring Integration'
  1. Spring Integration
  2. INT-3448

Gateway proxy for @Async method throws NullPointerException

    XMLWordPrintable

    Details

    • Type: Task
    • Status: Closed
    • Priority: Minor
    • Resolution: Complete
    • Affects Version/s: 4.0.2
    • Fix Version/s: 4.1 M1, 4.0.3
    • Component/s: Core
    • Labels:
    • Environment:
      Spring core 4.0.4

      Description

      Interface methods are eligible for annotation with Spring's @Async. When a GatewayProxyFactoryBean is used to provide an implementation for such an interface and the @EnableAsync advice is applied in proxy mode, invocations of the service method throw a NullPointerException. The exception is not thrown if @EnableAsync is not applied, and hand-writing a wrapper implementation that autowires the message channel and sends a GenericMessage with the argument as the payload works correctly.

      In this stack trace, handlePostback(PostbackObject postback) is declared on the PostbackHandler interface, and I used <int:gateway> to wire the method onto a message chain.

      stack trace
      java.lang.IllegalArgumentException: Class must not be null
      	at org.springframework.util.Assert.notNull(Assert.java:112)
      	at org.springframework.core.annotation.AnnotationUtils.findAnnotation(AnnotationUtils.java:279)
      	at org.springframework.core.annotation.AnnotationUtils.findAnnotation(AnnotationUtils.java:266)
      	at org.springframework.aop.support.annotation.AnnotationClassFilter.matches(AnnotationClassFilter.java:65)
      	at org.springframework.aop.support.ClassFilters$UnionClassFilter.matches(ClassFilters.java:101)
      	at org.springframework.aop.framework.DefaultAdvisorChainFactory.getInterceptorsAndDynamicInterceptionAdvice(DefaultAdvisorChainFactory.java:62)
      	at org.springframework.aop.framework.AdvisedSupport.getInterceptorsAndDynamicInterceptionAdvice(AdvisedSupport.java:489)
      	at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:193)
      	at com.sun.proxy.$Proxy101.handlePostback(Unknown Source)
      

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              abilan Artem Bilan
              Reporter:
              w_c_smith Christopher Smith
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: