-
Notifications
You must be signed in to change notification settings - Fork 40.9k
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
JMX InstanceAlreadyExistsException when setting server.contextPath + dev tools + cloud + actuator #7179
Comments
Could it be something that STS does on your app? That MBean rings a bell, ping @kdvolder |
Hi, Just a couple more details.
Thanks |
If you use 'Run As Spring Boot App' in STS, STS turns it on automatically, this could explain why you can't turn it off. The system properties that STS sets on launch probably take priority over what you are doing. You can disable this in STS launch config editor. You can open this, for example, from Boot Dashboard: select the project or launch config in Boot Dash and click 'pencil' icon. Make sure that both Unchecking these you will loose some functionality in STS/BootDash but most of it will still be functional. |
Hi @kdvolder , thanks for the reply. Turning those STS properties off does solve my issue however I assume this is still a bug in that, with a fresh Spring Boot App + Dev Tools + Cloud + server.contextPath then LiveBeansView sets up an MBean with applicationName="" but tries to destroy an MBean with applicationName=${server.contextPath} (in my case this is '/webapp') which does not exist? Thanks |
I tend to agree. Some wires seem to get crossed somewhere when using all this stuff together. This shouldn't happen. I'm just not sure how to fix it, or even who should fix it (STS vs spring-boot vs spring-cloud versus devtools). If there's some way for STS to enable JMX differently and avoid the problem I'd be happy to fix it on STS side, but I'm not sure what would have to be done. Or perhaps its easier for spring-boot or spring-cloud or devtools to do something a little differently. @snicoll what do you think? |
Just in case this is relevant. STS sets these to enable JMX:
Additionally sets this to enable spring boot admin bean:
And this to enable 'live bean' graph information:
|
Ok so
|
@dsyer @spencergibb does Spring Cloud change the application context's name? If so, it looks like we need to change something either here or in Spring cloud to do it earlier in the lifecycle. |
Spring Cloud does not change the |
The problem is in the ordering of calls to The devtools |
I tried which @kdvolder recommended (disabling Live Bean/Lifecycle Management) and this does get me back to LiveReload support however I do get an error on startup which makes sense: It still starts up and whenever I make a change to anything in classpath it automatically reloads successfully. I recently upgraded to latest Spring Boot version and upgraded STS to latest close to the same time, so not sure which one was the culprit. Seems like it's more related to the STS tools when running as "Spring Boot App". |
I've created an issue in the framework that I'll fix right the way. This should fix this issue as well. But I guess we need a separate issue to figure out why devtools stops the parent before the main application context. |
The issue in the framework is fixed. I am flagging this one as duplicate, pending the upgrade to Spring Framework |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
For anyone that comes to this issue, in my case using Intellij IDEA the problem was that when I ran the Spring Boot application I had the checkbox "Enable JMX agent" checked. |
Hi,
I'm having some funnies with the dev tools reload and MBean registration.
Within eclipse, if you create a Spring Boot 1.4.1 Starter Project with the following dependencies: Actuator, Cloud Boostrap, Web & DevTools.
Then add
server.contextPath=/webapp
to application.properties.If you trigger a dev tools reload (I just put a comment in the application.properties) then you get the following error
If I remote debug LiveBeansView then within registerApplicationContext > applicationContext.getApplicationName() returns "" but unregisterApplicationContext > applicationContext.getApplicationName() returns "/webapp" i.e from server.contextPath. Therefore you get a "Failed to unregister LiveBeansView MBean" because it can't find it.
Thanks
N.B Interestingly if I try and turn off JMX (spring.jmx.enabled=false) this has no effect.
The text was updated successfully, but these errors were encountered: