Auto exported lazy @ManagedResources should at least log errors if they can't be initialized [SPR-12399] #17007
Labels
in: core
Issues in core modules (aop, beans, core, context, expression)
type: enhancement
A general enhancement
Milestone
Steve Ash opened SPR-12399 and commented
We use the
@ManagedResource
and@ManagedOperation
all the time. Since most of our singletons are lazy when it publishes the managed JMX bean it creates a cglib proxy to register with the mbean server in order to preserve the laziness. This is good.The first time this JMX method is invoked, the bean is retrieved from the container and the managed operation method is invoked. If anything fails in between the mbean server calling the proxy and the proxy calling our application code inside the operation -- the exception will go back through RMI and if the client is JConsole or JVisualVm then it will fail as the exception classes aren't on those classpaths. It would be nice if spring would provide a way to enable logging in these scenarios. Or at least log any exceptions encountered during that lazy initialization in between the cglib proxy and calling our application code.
The current workaround is to eagerly init the jmx managed beans to get any failures to happen at startup, which is a fair workaround.
Affects: 4.1.1
Referenced from: commits 5f160c1
The text was updated successfully, but these errors were encountered: