两个springboot项目如何部署在同一个服务上,two spring boot applications deploy in same server
来源:互联网 发布:支持spi的读卡器淘宝 编辑:程序博客网 时间:2024/05/18 07:56
现在有两个spring boot的maven项目,需要部署到同一个外部的服务上(tomcat),他们都包含spring-boot-starter-actuator(健康检查)的依赖,但是出现下面的异常
I have 2 spring boot applications(maven projects), which contain "spring-boot-starter-actuator" dependency, for checking health of the each application. While deploying both the applications in tomcat server, I get below exception
2016-05-02 22:30:44.627 ERROR 12734 --- [ost-startStop-3] o.s.b.a.e.jmx.EndpointMBeanExporter : Could not register MBean for endpoint [dumpEndpoint]org.springframework.jmx.export.UnableToRegisterMBeanException: Unable to register MBean [org.springframework.boot.actuate.endpoint.jmx.DataEndpointMBean@67e7c413] with key 'dumpEndpoint'; nested exception is javax.management.InstanceAlreadyExistsException: org.springframework.boot:type=Endpoint,name=dumpEndpointat org.springframework.jmx.export.MBeanExporter.registerBeanNameOrInstance(MBeanExporter.java:625) ~[spring-context-4.2.3.RELEASE.jar:4.2.3.RELEASE]at org.springframework.boot.actuate.endpoint.jmx.EndpointMBeanExporter.registerEndpoint(EndpointMBeanExporter.java:182) [spring-boot-actuator-1.3.0.RELEASE.jar:1.3.0.RELEASE]at org.springframework.boot.actuate.endpoint.jmx.EndpointMBeanExporter.locateAndRegisterEndpoints(EndpointMBeanExporter.java:162) [spring-boot-actuator-1.3.0.RELEASE.jar:1.3.0.RELEASE]at org.springframework.boot.actuate.endpoint.jmx.EndpointMBeanExporter.doStart(EndpointMBeanExporter.java:153) [spring-boot-actuator-1.3.0.RELEASE.jar:1.3.0.RELEASE]at org.springframework.boot.actuate.endpoint.jmx.EndpointMBeanExporter.start(EndpointMBeanExporter.java:276) [spring-boot-actuator-1.3.0.RELEASE.jar:1.3.0.RELEASE]at org.springframework.context.support.DefaultLifecycleProcessor.doStart(DefaultLifecycleProcessor.java:173) [spring-context-4.2.3.RELEASE.jar:4.2.3.RELEASE]at org.springframework.context.support.DefaultLifecycleProcessor.access$200(DefaultLifecycleProcessor.java:51) [spring-context-4.2.3.RELEASE.jar:4.2.3.RELEASE]at org.springframework.context.support.DefaultLifecycleProcessor$LifecycleGroup.start(DefaultLifecycleProcessor.java:346) [spring-context-4.2.3.RELEASE.jar:4.2.3.RELEASE]at org.springframework.context.support.DefaultLifecycleProcessor.startBeans(DefaultLifecycleProcessor.java:149) [spring-context-4.2.3.RELEASE.jar:4.2.3.RELEASE]at org.springframework.context.support.DefaultLifecycleProcessor.onRefresh(DefaultLifecycleProcessor.java:112) [spring-context-4.2.3.RELEASE.jar:4.2.3.RELEASE]at org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:851) [spring-context-4.2.3.RELEASE.jar:4.2.3.RELEASE]at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.finishRefresh(EmbeddedWebApplicationContext.java:140) [spring-boot-1.3.0.RELEASE.jar:1.3.0.RELEASE]at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:540) [spring-context-4.2.3.RELEASE.jar:4.2.3.RELEASE]at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:118) [spring-boot-1.3.0.RELEASE.jar:1.3.0.RELEASE]at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:752) [spring-boot-1.3.0.RELEASE.jar:1.3.0.RELEASE]at org.springframework.boot.SpringApplication.doRun(SpringApplication.java:347) [spring-boot-1.3.0.RELEASE.jar:1.3.0.RELEASE]at org.springframework.boot.SpringApplication.run(SpringApplication.java:295) [spring-boot-1.3.0.RELEASE.jar:1.3.0.RELEASE]at org.springframework.boot.context.web.SpringBootServletInitializer.run(SpringBootServletInitializer.java:149) [spring-boot-1.3.0.RELEASE.jar:1.3.0.RELEASE]at org.springframework.boot.context.web.SpringBootServletInitializer.createRootApplicationContext(SpringBootServletInitializer.java:129) [spring-boot-1.3.0.RELEASE.jar:1.3.0.RELEASE]at org.springframework.boot.context.web.SpringBootServletInitializer.onStartup(SpringBootServletInitializer.java:85) [spring-boot-1.3.0.RELEASE.jar:1.3.0.RELEASE]at org.springframework.web.SpringServletContainerInitializer.onStartup(SpringServletContainerInitializer.java:175) [spring-web-4.2.3.RELEASE.jar:4.2.3.RELEASE]at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5155) [catalina.jar:8.0.21]at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) [catalina.jar:8.0.21]at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:725) [catalina.jar:8.0.21]at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:701) [catalina.jar:8.0.21]at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:717) [catalina.jar:8.0.21]at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:940) [catalina.jar:8.0.21]at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1738) [catalina.jar:8.0.21]at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [na:1.8.0]at java.util.concurrent.FutureTask.run(FutureTask.java:266) [na:1.8.0]at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [na:1.8.0]at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [na:1.8.0]at java.lang.Thread.run(Thread.java:744) [na:1.8.0]Caused by: javax.management.InstanceAlreadyExistsException: org.springframework.boot:type=Endpoint,name=dumpEndpointat com.sun.jmx.mbeanserver.Repository.addMBean(Repository.java:437) ~[na:1.8.0]at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.registerWithRepository(DefaultMBeanServerInterceptor.java:1898) ~[na:1.8.0]at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.registerDynamicMBean(DefaultMBeanServerInterceptor.java:966) ~[na:1.8.0]at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.registerObject(DefaultMBeanServerInterceptor.java:900) ~[na:1.8.0]at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.registerMBean(DefaultMBeanServerInterceptor.java:324) ~[na:1.8.0]at com.sun.jmx.mbeanserver.JmxMBeanServer.registerMBean(JmxMBeanServer.java:522) ~[na:1.8.0]at org.springframework.jmx.support.MBeanRegistrationSupport.doRegister(MBeanRegistrationSupport.java:195) ~[spring-context-4.2.3.RELEASE.jar:4.2.3.RELEASE]at org.springframework.jmx.export.MBeanExporter.registerBeanInstance(MBeanExporter.java:678) ~[spring-context-4.2.3.RELEASE.jar:4.2.3.RELEASE]at org.springframework.jmx.export.MBeanExporter.registerBeanNameOrInstance(MBeanExporter.java:621) ~[spring-context-4.2.3.RELEASE.jar:4.2.3.RELEASE]... 32 common frames omitted
解决办法需要为每个项目配置JMX的域, 修改application.properties中的属性spring.jmx.default-domain=applicationname
You can use the following properties in application.properties to configure a JMX domain for each of your applications (e.g. use the application name as domain):
spring.jmx.default-domain=applicationname
This configures the domain for all JMX endpoints which are added by Spring.
endpoints.jmx.domain=applicationname
This configures the JMX domain only for the actuator endpoints.
This will then prevent clashes of JMX beans with same names in different applications, because the domain will be added to the JMX name.
- 两个springboot项目如何部署在同一个服务上,two spring boot applications deploy in same server
- SpringBoot:spring boot 服务配置和部署
- linux上部署spring-boot项目
- spring boot -- 多个spring boot 项目部署到同一个web 容器
- 转载:Spring Boot (十二):springboot如何测试打包部署
- 利用命令部署springBoot项目出现ERROR] No plugin found for prefix ‘spring-boot’ in the current的错误
- 如何在openshift上diy部署spring-boot并在本地用eclipse开发
- Spring boot项目部署
- spring-boot项目部署
- 在idea里面如何对spring boot项目进行热部署
- Spring Boot+Docker项目cacubd-server-collector的部署运行
- 在weblogic server上部署DB2项目
- 如何在Linux上部署gerrit 服务?
- spring boot 使用docker在阿里云容器服务部署
- Ceph快速安装:Ceph-deploy 在Ubuntu 14.04 Server上部署三节点安装
- Ceph快速安装:Ceph-deploy 在Ubuntu 14.04 Server上部署三节点安装
- Spring Boot热部署—SpringBoot + Devtools
- springboot(十六):使用Jenkins部署Spring Boot
- git使用问题-解决方法 备忘
- 静态库和动态库详解
- 机械键盘测试——《万历十五年》2
- 趣味取小数
- 查询数据库重复记录方法
- 两个springboot项目如何部署在同一个服务上,two spring boot applications deploy in same server
- Mysql系列(一) 简介
- 【Unity】计时器
- 仿直播间玩色子游戏,AnimatorSet的综合使用
- scala sealed trait
- error: insufficient permission for adding an object to repository database ./objects
- Json介绍以及C++实现
- php开启openssl
- Java虚拟机学习(10):类加载器(ClassLoader)