无法为 ws-outbound-gateway 注册 MBean

Unable to register MBean for ws-outbound-gateway

集成流程使用以下内容:

<int:chain input-channel="input" id="inChain">
        <!-- some header-enrichers -->
        <int-ws:outbound-gateway id="outGateway"/> <!-- other properties are omitted -->               
</int:chain>  

在部署到 Tomcat 的过程中,出现错误:

Caused by: org.springframework.jmx.export.UnableToRegisterMBeanException:
Unable to register MBean [inChain$child.outGateway.handler] with key 'inChain$child.outGateway.handler'; 
nested exception is org.springframework.jmx.export.MBeanExportException:
Could not create ModelMBean for managed resource [inChain$child.outGateway.handler] with key 'inChain$child.outGateway.handler';
nested exception is java.lang.IllegalArgumentException:
MetadataMBeanInfoAssembler does not support JDK dynamic proxies - export the target beans directly or use CGLIB proxies instead.

在 spring 集成中是否有简单的解决方案,或者是否有必要遵循错误文本中的建议(制作自定义 MBeanExporter 等)?

完全不将该网关作为代理可能更好?那是怎么发生的呢?在您的问题中没有任何内容可以证实有一个关于代理的故事......另一方面,您可以从 JMX 导出中排除该 bean。或者您可以提供另一种方法来收集该 bean 的 MBean 信息。查看如何自定义 MBeanExporter.

或者您可以添加一个 IntegrationMBeanExporterhttps://docs.spring.io/spring-integration/docs/current/reference/html/jmx.html#jmx-mbean-exporter

感谢 Artem Bilan 的搜索指导:在代码中找到了 AOP 建议:

<bean id="interceptor" class="..."/>
<aop:config>
   <aop:pointcut id="all" expression="execution(*org.springframework.integration.handler.AbstractReplyProducingMessageHandler.handleRequestMessage(..))"/>
   <aop:advisor pointcut-ref="all" advice-ref="interceptor" order="1"/>
</aop:config>

目前最好的解决方案是禁用 JMX。