项目

一般

简介

部署两个sringboot项目报: Caused by: javax.management.InstanceAlreadyExistsException: org.springframework.cloud.context.environment:name=environmentManager,type=EnvironmentManager

由 何 善才 在 超过一年 之前添加

异常信息:2023-08-08 11:10:57.824  INFO [pay-service,,,] 17293 --- [           main] o.s.s.concurrent.ThreadPoolTaskExecutor  : Shutting down ExecutorService 'applicationTaskExecutor'
2023-08-08 11:10:57.890  INFO [pay-service,,,] 17293 --- [           main] com.alibaba.druid.pool.DruidDataSource   : {dataSource-1} closing ...
2023-08-08 11:10:57.910  INFO [pay-service,,,] 17293 --- [           main] com.alibaba.druid.pool.DruidDataSource   : {dataSource-1} closed
2023-08-08 11:10:58.724  WARN [pay-service,,,] 17293 --- [ender@281cfefd}] c.n.c.sources.URLConfigurationSource     : No URLs will be polled as dynamic configuration sources.
2023-08-08 11:10:58.733  INFO [pay-service,,,] 17293 --- [ender@281cfefd}] c.n.c.sources.URLConfigurationSource     : To enable URLs as dynamic configuration sources, define System property archaius.configurationSource.additionalUrls or make config.properties available on classpath.
2023-08-08 11:10:58.735  INFO [pay-service,,,] 17293 --- [ender@281cfefd}] c.netflix.config.DynamicPropertyFactory  : DynamicPropertyFactory is initialized with configuration sources: com.netflix.config.ConcurrentCompositeConfiguration@8f10979
2023-08-08 11:10:58.832  WARN [pay-service,,,] 17293 --- [ender@281cfefd}] s.c.a.AnnotationConfigApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'ribbonServerList' defined in com.alibaba.cloud.nacos.ribbon.NacosRibbonClientConfiguration: Unsatisfied dependency expressed through method 'ribbonServerList' parameter 1; nested exception is org.springframework.beans.factory.BeanCreationNotAllowedException: Error creating bean with name 'nacosProperties': Singleton bean creation not allowed while singletons of this factory are in destruction (Do not request a bean from a BeanFactory in a destroy method implementation!)
08-Aug-2023 11:10:58.901 严重 [main] com.apusic.ams.startup.HostConfig.deployWAR 部署 Web 应用程序 archive [/opt/software/aams-all/pay/pay.war] 时出错
    java.lang.IllegalStateException: Error starting child
        at com.apusic.ams.core.ContainerBase.addChildInternal(ContainerBase.java:721)
        at com.apusic.ams.core.ContainerBase.addChild(ContainerBase.java:691)
        at com.apusic.ams.core.StandardHost.addChild(StandardHost.java:705)
        at com.apusic.ams.startup.HostConfig.deployWAR(HostConfig.java:985)
        at com.apusic.ams.startup.HostConfig$DeployWar.run(HostConfig.java:1856)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at com.apusic.aas.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75)
        at java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:112)
        at com.apusic.ams.startup.HostConfig.deployWARs(HostConfig.java:780)
        at com.apusic.ams.startup.HostConfig.deployApps(HostConfig.java:428)
        at com.apusic.ams.startup.HostConfig.start(HostConfig.java:1583)
        at com.apusic.ams.startup.HostConfig.lifecycleEvent(HostConfig.java:310)
        at com.apusic.ams.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:123)
        at com.apusic.ams.util.LifecycleBase.setStateInternal(LifecycleBase.java:423)
        at com.apusic.ams.util.LifecycleBase.setState(LifecycleBase.java:366)
        at com.apusic.ams.core.ContainerBase.startInternal(ContainerBase.java:937)
        at com.apusic.ams.core.StandardHost.startInternal(StandardHost.java:841)
        at com.apusic.ams.util.LifecycleBase.start(LifecycleBase.java:183)
        at com.apusic.ams.core.ContainerBase$StartChild.call(ContainerBase.java:1385)
        at com.apusic.ams.core.ContainerBase$StartChild.call(ContainerBase.java:1375)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at com.apusic.aas.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75)
        at java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:134)
        at com.apusic.ams.core.ContainerBase.startInternal(ContainerBase.java:910)
        at com.apusic.ams.core.StandardEngine.startInternal(StandardEngine.java:262)
        at com.apusic.ams.util.LifecycleBase.start(LifecycleBase.java:183)
        at com.apusic.ams.core.StandardService.startInternal(StandardService.java:421)
        at com.apusic.ams.util.LifecycleBase.start(LifecycleBase.java:183)
        at com.apusic.ams.core.StandardServer.startInternal(StandardServer.java:937)
        at com.apusic.ams.util.LifecycleBase.start(LifecycleBase.java:183)
        at com.apusic.ams.startup.Apusic.start(Apusic.java:1407)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at com.apusic.ams.startup.Bootstrap.start(Bootstrap.java:1753)
        at com.apusic.ams.startup.Bootstrap.main(Bootstrap.java:311)
    Caused by: com.apusic.ams.LifecycleException: Failed to start component [StandardEngine[pay-service].StandardHost[localhost].StandardContext[/pay]]
        at com.apusic.ams.util.LifecycleBase.handleSubClassException(LifecycleBase.java:440)
        at com.apusic.ams.util.LifecycleBase.start(LifecycleBase.java:198)
        at com.apusic.ams.core.ContainerBase.addChildInternal(ContainerBase.java:718)
        ... 37 more
    Caused by: org.springframework.jmx.export.UnableToRegisterMBeanException: Unable to register MBean [org.springframework.cloud.context.environment.EnvironmentManager@1202518e] with key 'environmentManager'; nested exception is javax.management.InstanceAlreadyExistsException: org.springframework.cloud.context.environment:name=environmentManager,type=EnvironmentManager
        at org.springframework.jmx.export.MBeanExporter.registerBeanNameOrInstance(MBeanExporter.java:625)
        at org.springframework.jmx.export.MBeanExporter.lambda$registerBeans$2(MBeanExporter.java:551)
        at java.util.HashMap.forEach(HashMap.java:1288)
        at org.springframework.jmx.export.MBeanExporter.registerBeans(MBeanExporter.java:551)
        at org.springframework.jmx.export.MBeanExporter.afterSingletonsInstantiated(MBeanExporter.java:434)
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:866)
        at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:877)
        at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:549)
        at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:142)
        at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:775)
        at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397)
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:316)
        at org.springframework.boot.web.servlet.support.SpringBootServletInitializer.run(SpringBootServletInitializer.java:157)
        at org.springframework.boot.web.servlet.support.SpringBootServletInitializer.createRootApplicationContext(SpringBootServletInitializer.java:137)
        at org.springframework.boot.web.servlet.support.SpringBootServletInitializer.onStartup(SpringBootServletInitializer.java:91)
        at org.springframework.web.SpringServletContainerInitializer.onStartup(SpringServletContainerInitializer.java:171)
        at com.apusic.ams.core.StandardContext.startInternal(StandardContext.java:5135)
        at com.apusic.ams.util.LifecycleBase.start(LifecycleBase.java:183)
        ... 38 more
    Caused by: javax.management.InstanceAlreadyExistsException: org.springframework.cloud.context.environment:name=environmentManager,type=EnvironmentManager
        at com.sun.jmx.mbeanserver.Repository.addMBean(Repository.java:437)
        at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.registerWithRepository(DefaultMBeanServerInterceptor.java:1898)
        at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.registerDynamicMBean(DefaultMBeanServerInterceptor.java:966)
        at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.registerObject(DefaultMBeanServerInterceptor.java:900)
        at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.registerMBean(DefaultMBeanServerInterceptor.java:324)
        at com.sun.jmx.mbeanserver.JmxMBeanServer.registerMBean(JmxMBeanServer.java:522)
        at org.springframework.jmx.support.MBeanRegistrationSupport.doRegister(MBeanRegistrationSupport.java:137)
        at org.springframework.jmx.export.MBeanExporter.registerBeanInstance(MBeanExporter.java:679)
        at org.springframework.jmx.export.MBeanExporter.registerBeanNameOrInstance(MBeanExporter.java:615)
        ... 55 more
08-Aug-2023 11:10:58.913 信息 [main] com.apusic.ams.startup.HostConfig.deployWAR Deployment of web application archive [/opt/software/aams-all/pay/pay.war] has finished in [119,244] ms
08-Aug-2023 11:10:58.924 信息 [main] com.apusic.connector.AbstractProtocol.start 开始协议处理句柄["http-nio-19103"]
08-Aug-2023 11:10:58.928 信息 [main] com.apusic.ams.startup.Apusic.start Server startup in [261,150] milliseconds

解决:

https://www.cnblogs.com/codecat/p/11751783.html