Spring boot devtools 重启应用失败
Spring boot devtools fails to restart the application
我正在使用支持 devtools
的 Spring Boot 1.5.6。但是当我更改时,devtools 将尝试重新启动代码。这是抛出 Failed to unregister LiveBeansView MBean; nested exception is javax.management.InstanceNotFoundException
错误。
堆栈跟踪:
14:12:00.433 [Thread-11] WARN o.s.c.a.AnnotationConfigApplicationContext - Exception thrown from ApplicationListener handling ContextClosedEvent
org.springframework.context.ApplicationContextException: Failed to unregister LiveBeansView MBean; nested exception is javax.management.InstanceNotFoundException: DefaultDomain:application=/tenancy
at org.springframework.context.support.LiveBeansView.unregisterApplicationContext(LiveBeansView.java:89)
at org.springframework.context.support.AbstractApplicationContext.doClose(AbstractApplicationContext.java:985)
at org.springframework.context.support.AbstractApplicationContext.close(AbstractApplicationContext.java:956)
at org.springframework.boot.builder.ParentContextCloserApplicationListener$ContextCloserListener.onApplicationEvent(ParentContextCloserApplicationListener.java:102)
at org.springframework.boot.builder.ParentContextCloserApplicationListener$ContextCloserListener.onApplicationEvent(ParentContextCloserApplicationListener.java:86)
at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:166)
at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:138)
at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:382)
at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:336)
at org.springframework.context.support.AbstractApplicationContext.doClose(AbstractApplicationContext.java:989)
at org.springframework.context.support.AbstractApplicationContext.close(AbstractApplicationContext.java:956)
at org.springframework.boot.devtools.restart.Restarter.stop(Restarter.java:321)
at org.springframework.boot.devtools.restart.Restarter.call(Restarter.java:258)
at org.springframework.boot.devtools.restart.Restarter.call(Restarter.java:254)
at org.springframework.boot.devtools.restart.Restarter$LeakSafeThread.run(Restarter.java:627)
Caused by: javax.management.InstanceNotFoundException: DefaultDomain:application=/tenancy
at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.getMBean(Unknown Source)
at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.exclusiveUnregisterMBean(Unknown Source)
at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.unregisterMBean(Unknown Source)
at com.sun.jmx.mbeanserver.JmxMBeanServer.unregisterMBean(Unknown Source)
at org.springframework.context.support.LiveBeansView.unregisterApplicationContext(LiveBeansView.java:86)
... 14 common frames omitted
我可以解决问题:
发生这种情况是因为 spring.jmx
已启用。即使您将应用程序属性设置为 spring.jmx.enabled=false
,它也不起作用。因为如果您 运行 应用程序作为 Spring 引导应用程序。它由 STS 自动启用。
解决方案
从引导仪表板关闭 apring.jmx.enabled
。通过 select 项目>单击铅笔(编辑)>取消选中启用 JMX。
我正在使用支持 devtools
的 Spring Boot 1.5.6。但是当我更改时,devtools 将尝试重新启动代码。这是抛出 Failed to unregister LiveBeansView MBean; nested exception is javax.management.InstanceNotFoundException
错误。
堆栈跟踪:
14:12:00.433 [Thread-11] WARN o.s.c.a.AnnotationConfigApplicationContext - Exception thrown from ApplicationListener handling ContextClosedEvent
org.springframework.context.ApplicationContextException: Failed to unregister LiveBeansView MBean; nested exception is javax.management.InstanceNotFoundException: DefaultDomain:application=/tenancy
at org.springframework.context.support.LiveBeansView.unregisterApplicationContext(LiveBeansView.java:89)
at org.springframework.context.support.AbstractApplicationContext.doClose(AbstractApplicationContext.java:985)
at org.springframework.context.support.AbstractApplicationContext.close(AbstractApplicationContext.java:956)
at org.springframework.boot.builder.ParentContextCloserApplicationListener$ContextCloserListener.onApplicationEvent(ParentContextCloserApplicationListener.java:102)
at org.springframework.boot.builder.ParentContextCloserApplicationListener$ContextCloserListener.onApplicationEvent(ParentContextCloserApplicationListener.java:86)
at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:166)
at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:138)
at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:382)
at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:336)
at org.springframework.context.support.AbstractApplicationContext.doClose(AbstractApplicationContext.java:989)
at org.springframework.context.support.AbstractApplicationContext.close(AbstractApplicationContext.java:956)
at org.springframework.boot.devtools.restart.Restarter.stop(Restarter.java:321)
at org.springframework.boot.devtools.restart.Restarter.call(Restarter.java:258)
at org.springframework.boot.devtools.restart.Restarter.call(Restarter.java:254)
at org.springframework.boot.devtools.restart.Restarter$LeakSafeThread.run(Restarter.java:627)
Caused by: javax.management.InstanceNotFoundException: DefaultDomain:application=/tenancy
at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.getMBean(Unknown Source)
at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.exclusiveUnregisterMBean(Unknown Source)
at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.unregisterMBean(Unknown Source)
at com.sun.jmx.mbeanserver.JmxMBeanServer.unregisterMBean(Unknown Source)
at org.springframework.context.support.LiveBeansView.unregisterApplicationContext(LiveBeansView.java:86)
... 14 common frames omitted
我可以解决问题:
发生这种情况是因为 spring.jmx
已启用。即使您将应用程序属性设置为 spring.jmx.enabled=false
,它也不起作用。因为如果您 运行 应用程序作为 Spring 引导应用程序。它由 STS 自动启用。
解决方案
从引导仪表板关闭 apring.jmx.enabled
。通过 select 项目>单击铅笔(编辑)>取消选中启用 JMX。