-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Description
Gary Russell opened INT-2307 and commented
SEVERE: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.jmx.export.annotation.AnnotationMBeanExporter#0' defined in class path resource [META-INF/spring/cic-config/cic-common-int-cluster-mbean-config.xml]: Invocation of init method failed; nested exception is org.springframework.jmx.export.UnableToRegisterMBeanException: Unable to register MBean [org.springframework.integration.router.RecipientListRouter#0] with key 'org.springframework.integration.router.RecipientListRouter#0'; nested exception is org.springframework.jmx.export.MBeanExportException: Could not create ModelMBean for managed resource [org.springframework.integration.router.RecipientListRouter#0] with key 'org.springframework.integration.router.RecipientListRouter#0'; nested exception is java.lang.IllegalArgumentException: MetadataMBeanInfoAssembler does not support JDK dynamic proxies - export the target beans directly or use CGLIB proxies instead
The AbstractMessageRouter is annotated as a @ManagedResource and so is (sometimes) exported by the normal exporter and then the IMBE throws the exception.
Turns out, it depends on whether the RouterFactoryBean has been fully initialized or not when post-processed by the AnnotationMBeanExporter. If not, getObjectType() returns a MessageHandler type, if intialized, it returns a subclass of AMR (e.g. ExpressionEvaluatingRouter) and is therefore exported.
A <recipient-list-router/> always fails because it doesn't use a factory bean and it's always exported.
I am not sure what the right solution is, aside from removing the annotations and adding the appropriate interfaces to allow these methods to be exported by the IMBE.
Affects: 2.1 RC1
Issue Links:
-
JMX exporter fails on dynamic proxies [INT-1675] #5671 JMX exporter fails on dynamic proxies
-
Consider removing pre-initialization of MBeanExporter form IntegrationMBeanExporter [INT-2318] #6302 Consider removing pre-initialization of MBeanExporter form IntegrationMBeanExporter