简体   繁体   中英

Spring Integration 4.1.0 Migration problems

I'm having problems migrating my application form spring-integration 4.0.4 to the recent 4.1.0 release.

Once replacing the jars, my integration context throws an exception for each <recipient-list-router/> tag.

The thrown exception is a java.lang.ClassCastException the message is:

Caused by: java.lang.ClassCastException: com.sun.proxy.$Proxy62 cannot be cast to org.springframework.integration.context.IntegrationObjectSupport
    at org.springframework.config.AbstractSimpleMessageHandlerFactoryBean.createHandlerInternal(AbstractSimpleMessageHandlerFactoryBean.java:130)
    at org.springframework.integration.config.AbstractSimpleMessageHandlerFactoryBean.getObject(AbstractSimpleMessageHandlerFactoryBean.java:102)
    at org.springframework.integration.config.AbstractSimpleMessageHandlerFactoryBean.getObject(AbstractSimpleMessageHandlerFactoryBean.java:44)
    at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.doGetObjectFromFactoryBean(FactoryBeanReagistrySupport.java:168)
    ... 20 more

I am using Spring-Integration 4.1.0.RELEASE, spring-core 4.1.2.RELEASE, and running on jdk1.8.0_05. My Integration beans context contains two <recipient-list-router/> tags, which upon removal, do not throw this error.

The code from AbstractSimpleMessageHandlerFactoryBean says:

else if(!(this.handler instanceof AbstractReplyProducingMessageHandler)) {
    if (logger.isDebugEnabled()) {
            logger.debug("adviceChain can only be set to AbstractReplyProducingMessageHandler or its subclass, "
                    + ((IntegrationObjectSupport) this.handler).getComponentName() + " doesn't support it.");
                }
}

So, let's switch of debug for the org.springframework.integration category!

From other side I agree that it is a bug, because if our messageHandler is a Proxy we can't simply cast it to the IntegrationObjectSupport .

So, feel free to raise a JIRA ticket on the matter.

From other side it isn't clear why removal of <recipient-list-router/> evict an issue...

Because <recipient-list-router/> doesn't support <request-handler-advice-chain> .

I agree that we have introduced in the 4.1 the RecipientListRouterManagement and if you use JMX the special MBean will be registered for the RecipientListRouter and the last one becomes Proxy , but it isn't clrear how that proxying relates to the request-handler-advice-chain log message...

Would be great if you can debug for that line from AbstractSimpleMessageHandlerFactoryBean and show us the real object for that Proxy .

And show, please, more StackTrace . Maybe we can see more context to figure out the root of cause.

Thank you!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM