美文网首页
Tomcat运行多个SpringBoot,会报unabletor

Tomcat运行多个SpringBoot,会报unabletor

作者: 游泳的星尘龙 | 来源:发表于2018-04-18 16:34 被阅读0次

    原因:因为jmx某些东西重复,禁用jmx就可以了。而spring.jmx是默认打开的,所以有两种解决办法 !
    在application.properties中各自配置

    • 办法1:
      spring.jmx.enabled=false
    • 办法2:
      spring.jmx.default-domain=project1
      spring.jmx.default-domain=project2
      以保证domain是两个不一样的

    JMX的简介

    所谓JMX,是Java Management Extensions的缩写,从官方的文档上来看,他就是一个框架,和JPA、JMS是一样的,和我们平时使用的Spring、Hibernate也没有什么区别。就是通过将监控和管理涉及到的各个方面的问题和解决办法放到一起,统一设计,以便向外提供服务,以供使用者调用

    感兴趣的话就自己去做了解吧。转一篇springboot jmx的应用:https://www.jianshu.com/p/673385926ce1

    下面是我的错误日志:

    严重: A child container failed during start
    java.util.concurrent.ExecutionException: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/YbBloodSugar]]
        at java.util.concurrent.FutureTask.report(FutureTask.java:122)
        at java.util.concurrent.FutureTask.get(FutureTask.java:192)
        at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:1122)
        at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:819)
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
        at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1574)
        at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1564)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
        at java.lang.Thread.run(Thread.java:745)
    Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/YbBloodSugar]]
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154)
        ... 6 more
    Caused by: org.springframework.jmx.export.UnableToRegisterMBeanException: Unable to register MBean [{
        CreateTime:"2018-04-18 15:16:44",
        ActiveCount:0,
        PoolingCount:0,
        CreateCount:0,
        DestroyCount:0,
        CloseCount:0,
        ConnectCount:0,
        Connections:[
        ]
    }] with key 'dataSource'; nested exception is javax.management.InstanceAlreadyExistsException: com.alibaba.druid.pool:name=dataSource,type=DruidDataSource
        at org.springframework.jmx.export.MBeanExporter.registerBeanNameOrInstance(MBeanExporter.java:628)
        at org.springframework.jmx.export.MBeanExporter.registerBeans(MBeanExporter.java:550)
        at org.springframework.jmx.export.MBeanExporter.afterSingletonsInstantiated(MBeanExporter.java:432)
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:781)
        at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:866)
        at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:542)
        at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:122)
        at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:737)
        at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:370)
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:314)
        at org.springframework.boot.web.support.SpringBootServletInitializer.run(SpringBootServletInitializer.java:151)
        at org.springframework.boot.web.support.SpringBootServletInitializer.createRootApplicationContext(SpringBootServletInitializer.java:131)
        at org.springframework.boot.web.support.SpringBootServletInitializer.onStartup(SpringBootServletInitializer.java:86)
        at org.springframework.web.SpringServletContainerInitializer.onStartup(SpringServletContainerInitializer.java:169)
        at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5580)
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
        ... 6 more
    Caused by: javax.management.InstanceAlreadyExistsException: com.alibaba.druid.pool:name=dataSource,type=DruidDataSource
        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:195)
        at org.springframework.jmx.export.MBeanExporter.registerBeanInstance(MBeanExporter.java:674)
        at org.springframework.jmx.export.MBeanExporter.registerBeanNameOrInstance(MBeanExporter.java:618)
        ... 21 more
    
    四月 18, 2018 3:16:47 下午 org.apache.catalina.core.ContainerBase startInternal
    严重: A child container failed during start
    java.util.concurrent.ExecutionException: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost]]
        at java.util.concurrent.FutureTask.report(FutureTask.java:122)
        at java.util.concurrent.FutureTask.get(FutureTask.java:192)
        at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:1122)
        at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:300)
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
        at org.apache.catalina.core.StandardService.startInternal(StandardService.java:443)
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
        at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:739)
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
        at org.apache.catalina.startup.Catalina.start(Catalina.java:693)
        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 org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:294)
        at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:428)
    Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost]]
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154)
        at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1574)
        at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1564)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
        at java.lang.Thread.run(Thread.java:745)
    Caused by: org.apache.catalina.LifecycleException: A child container failed during start
        at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:1130)
        at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:819)
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
        ... 6 more
    
    四月 18, 2018 3:16:47 下午 org.apache.catalina.startup.Catalina start
    严重: The required Server component failed to start so Tomcat is unable to start.
    org.apache.catalina.LifecycleException: Failed to start component [StandardServer[8005]]
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154)
        at org.apache.catalina.startup.Catalina.start(Catalina.java:693)
        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 org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:294)
        at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:428)
    Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardService[Catalina]]
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154)
        at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:739)
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
        ... 7 more
    Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina]]
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154)
        at org.apache.catalina.core.StandardService.startInternal(StandardService.java:443)
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
        ... 9 more
    Caused by: org.apache.catalina.LifecycleException: A child container failed during start
        at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:1130)
        at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:300)
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
        ... 11 more
    
    四月 18, 2018 3:16:47 下午 org.apache.coyote.AbstractProtocol pause
    信息: Pausing ProtocolHandler ["http-bio-8080"]
    四月 18, 2018 3:16:47 下午 org.apache.coyote.AbstractProtocol pause
    信息: Pausing ProtocolHandler ["ajp-bio-8009"]
    四月 18, 2018 3:16:47 下午 org.apache.catalina.core.StandardService stopInternal
    信息: Stopping service Catalina
    四月 18, 2018 3:16:47 下午 org.apache.coyote.AbstractProtocol destroy
    信息: Destroying ProtocolHandler ["http-bio-8080"]
    四月 18, 2018 3:16:47 下午 org.apache.coyote.AbstractProtocol destroy
    信息: Destroying ProtocolHandler ["ajp-bio-8009"]
    四月 18, 2018 3:16:47 下午 org.apache.catalina.loader.WebappClassLoaderBase clearReferencesThreads
    严重: The web application [] appears to have started a thread named [commons-pool-EvictionTimer] but has failed to stop it. This is very likely to create a memory leak.
    

    ​​

    相关文章

      网友评论

          本文标题:Tomcat运行多个SpringBoot,会报unabletor

          本文链接:https://www.haomeiwen.com/subject/vczvkftx.html