Skip to content

Routers Cause MBean Registration Failures When Using Both Spring and Spring Integration MBean Exporters [INT-2307] #6292

@spring-operator

Description

@spring-operator

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:

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions