Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Auto exported lazy @ManagedResources should at least log errors if they can't be initialized [SPR-12399] #17007

Closed
spring-projects-issues opened this issue Oct 30, 2014 · 2 comments
Assignees
Labels
in: core type: enhancement
Milestone

Comments

@spring-projects-issues
Copy link
Collaborator

@spring-projects-issues spring-projects-issues commented Oct 30, 2014

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

@spring-projects-issues
Copy link
Collaborator Author

@spring-projects-issues spring-projects-issues commented Oct 30, 2014

Steve Ash commented

I opened a PR for this:
#686

@spring-projects-issues
Copy link
Collaborator Author

@spring-projects-issues spring-projects-issues commented Oct 30, 2014

Juergen Hoeller commented

I've added this in a revised fashion, logging such a failure at warn level and with a flattened exception toString instead of a stacktrace - like we do in quite a few other places to clearly raise a warning but avoid flooding the log.

Juergen

@spring-projects-issues spring-projects-issues added type: enhancement in: core labels Jan 11, 2019
@spring-projects-issues spring-projects-issues added this to the 4.1.2 milestone Jan 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: core type: enhancement
Projects
None yet
Development

No branches or pull requests

2 participants