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

Cast will fail when trying to use AbstractReplyProducingMessageHandler directly and using JMX

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Blocker
    • Resolution: Complete
    • Affects Version/s: 3.0 M3
    • Fix Version/s: 3.0 RC1
    • Component/s: Core
    • Labels:

      Description

      <int-jmx:mbean-export />
      
      <int:service-activator
       ...
          <bean class="SubclassOfAbstractReplyProducingMessageHandler" >
           ...
          </bean>
      </int:service-activator>
      

      This will fail in AbstractStandardMessageHandlerFactoryBean#createHandler() line 82:

      boolean targetIsDirectReplyProducingHandler = this.extractTypeIfPossible(targetObject,
      										AbstractReplyProducingMessageHandler.class) != null
      							&& this.canBeUsedDirect(
      									(AbstractReplyProducingMessageHandler) targetObject) // give subclasses a say
      							&& this.methodIsHandleMessageOrEmpty(this.targetMethodName);
      

      Because:
      1) extractTypeIfPossible will recognize that the targetObject is a PROXIED bean (because we have enabled JMX) of the right class and it will return not-null

      2) this.canBeUsedDirect((AbstractReplyProducingMessageHandler) targetObject) will fail with a CLASS CAST EXCEPTION because the proxy cannot be cast to the class, only to one of the interfaces.

      If line 82 is fixed (e.g. by casting to MessageHandler instead?) then the folioing lines will also fail:

      line 92: this.checkReuse((AbstractReplyProducingMessageHandler) handler);

      line 93: this.postProcessReplyProducer((AbstractReplyProducingMessageHandler) handler);

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              grussell Gary Russell
              Reporter:
              askogman Adam Skogman
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: