javax.management.InstanceAlreadyExistsException异常

时间:2018-02-05 12:25:56

标签: spring maven tomcat spring-boot jhipster

我使用jhipster生成spring boot + hibernate + angular应用程序,在尝试将其部署到生产环境时,我收到了上述错误。它在我的开发服务器和本地服务器上工作正常,它只是它失败的prod服务器

我手动删除了tomcat - > webapps以避免碰撞

我已检查this question并尝试应用所有可能的jmx配置,但没有结果。

我已重命名spring: application

我重命名了数据源,prometeus指标和maven工件,但没有一个工作

我甚至在我遇到问题的VM上重新启动了tomcat,没有结果

我做的最后一件事是尝试在我的开发服务器上使用-Pprod部署应用程序,它可以很好地放弃application-prod.yml文件中的任何错误/疏忽

这里真的失去了想法。

错误的完整堆栈跟踪(它对于几个bean配置都重复相同的错误):

2018-02-05 09:18:03,422 ERROR [http-bio-8080-exec-3] EndpointMBeanExporter: Could not register MBean for endpoint [configurationPropertiesReportEndpoint]
org.springframework.jmx.export.UnableToRegisterMBeanException: Unable to register MBean [org.springframework.boot.actuate.endpoint.jmx.DataEndpointMBean@7c0bb49f] with 
key 'configurationPropertiesReportEndpoint'; nested exception is javax.management.InstanceAlreadyExistsException: org.springframework.boot:type=Endpoint,name=configurat
ionPropertiesReportEndpoint
        at org.springframework.jmx.export.MBeanExporter.registerBeanNameOrInstance(MBeanExporter.java:628)
        at org.springframework.boot.actuate.endpoint.jmx.EndpointMBeanExporter.registerEndpoint(EndpointMBeanExporter.java:214)
        at org.springframework.boot.actuate.endpoint.jmx.EndpointMBeanExporter.registerEndpoints(EndpointMBeanExporter.java:191)
        at org.springframework.boot.actuate.endpoint.jmx.EndpointMBeanExporter.locateAndRegisterEndpoints(EndpointMBeanExporter.java:163)
        at org.springframework.boot.actuate.endpoint.jmx.EndpointMBeanExporter.doStart(EndpointMBeanExporter.java:158)
        at org.springframework.boot.actuate.endpoint.jmx.EndpointMBeanExporter.start(EndpointMBeanExporter.java:337)
        at org.springframework.context.support.DefaultLifecycleProcessor.doStart(DefaultLifecycleProcessor.java:175)
        at org.springframework.context.support.DefaultLifecycleProcessor.access$200(DefaultLifecycleProcessor.java:50)
        at org.springframework.context.support.DefaultLifecycleProcessor$LifecycleGroup.start(DefaultLifecycleProcessor.java:348)
        at org.springframework.context.support.DefaultLifecycleProcessor.startBeans(DefaultLifecycleProcessor.java:151)
        at org.springframework.context.support.DefaultLifecycleProcessor.onRefresh(DefaultLifecycleProcessor.java:114)
        at org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:880)
        at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.finishRefresh(EmbeddedWebApplicationContext.java:144)
        at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:546)
        at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:122)
        at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:693)
        at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:360)
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:303)
        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:5573)
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:147)
        at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:899)
        at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:875)
        at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:652)
        at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:1091)
        at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:558)
        at org.apache.catalina.startup.HostConfig.check(HostConfig.java:1775)
        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.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:301)
        at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:819)
        at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:801)
        at org.apache.catalina.manager.ManagerServlet.check(ManagerServlet.java:1506)
        at org.apache.catalina.manager.ManagerServlet.deploy(ManagerServlet.java:729)
        at org.apache.catalina.manager.ManagerServlet.doPut(ManagerServlet.java:447)
at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:819)
        at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:801)
        at org.apache.catalina.manager.ManagerServlet.check(ManagerServlet.java:1506)
        at org.apache.catalina.manager.ManagerServlet.deploy(ManagerServlet.java:729)
        at org.apache.catalina.manager.ManagerServlet.doPut(ManagerServlet.java:447)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:653)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:731)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
        at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
        at org.apache.catalina.filters.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:108)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:221)
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)
        at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:614)
        at org.apache.catalina.valves.RequestFilterValve.process(RequestFilterValve.java:334)
        at org.apache.catalina.valves.RemoteAddrValve.invoke(RemoteAddrValve.java:119)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:169)
        at com.googlecode.psiprobe.Tomcat70AgentValve.invoke(Tomcat70AgentValve.java:38)
        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
        at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:956)
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:436)
        at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1078)
        at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:625)
        at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:316)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
        at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
        at java.lang.Thread.run(Thread.java:748)
Caused by: javax.management.InstanceAlreadyExistsException: org.springframework.boot:type=Endpoint,name=configurationPropertiesReportEndpoint
        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:682)
        at org.springframework.jmx.export.MBeanExporter.registerBeanNameOrInstance(MBeanExporter.java:624)
        ... 67 common frames omitted

我的application-prod.yml现在看起来像这样(在应用和删除所有jmx唯一名称配置之后)

spring:
    devtools:
        restart:
            enabled: false
        livereload:
            enabled: false
    datasource:
        type: com.zaxxer.hikari.HikariDataSource
        #driver-class-name: com.mysql.jdbc.Driver
        url: jdbc:mysql://localhost:3306/adatabase
        name: adatabaseName /*changed for debugging error
        username: adatabaseuser
        password: adatabasepassword
    h2:
        console:
            enabled: false
    jpa:
        database-platform: org.hibernate.dialect.MySQL5InnoDBDialect
        database: MYSQL
        show-sql: false
        hibernate:
            ddl-auto: validate
            naming:
                physical-strategy: org.wwarn.drugquality.config.HibernateAuditTablesNamingStrategy
        properties:
            hibernate.cache.use_second_level_cache: true
            hibernate.cache.use_query_cache: false
            hibernate.generate_statistics: false
            hibernate.cache.region.factory_class: org.hibernate.cache.jcache.JCacheRegionFactory
            org.hibernate.envers.store_data_at_delete: true
            org.hibernate.envers.revision_on_collection_change: false
    data:
        elasticsearch:
            cluster-name: aclustername
            cluster-nodes: localhost:9300
    mail:
        host: localhost
        port: 25
        username:
        password:
    thymeleaf:
        cache: true

liquibase:
    contexts: prod


server:
    port: 8080
    compression:
        enabled: true
        mime-types: text/html,text/xml,text/plain,text/css, application/javascript, application/json
        min-response-size: 1024

jhipster:
    http:
        version: V_1_1 # To use HTTP/2 you will need SSL support (see above the "server.ssl" configuration)
        cache: # Used by the CachingHttpHeadersFilter
            timeToLiveInDays: 1461
    cache: # Cache configuration
        ehcache: # Ehcache configuration
            time-to-live-seconds: 3600 # By default objects stay 1 hour in the cache
            max-entries: 1000 # Number of objects in each cache entry
    security:
        remember-me:
            # security key (this key should be unique for your application, and kept secret)
            key: akey
    mail: # specific JHipster mail property, for standard properties see MailProperties
        from: DrugQualityDataManager@localhost
        base-url: http://my-server-url-to-change # Modify according to your server's URL
    metrics: # DropWizard Metrics configuration, used by MetricsConfiguration
        jmx.enabled: true
        graphite:
            enabled: false
            host: localhost
            port: 2003
            prefix: DrugQualityDataManagerUpgraded //changed for debug
        prometheus:
            enabled: false
            endpoint: /prometheusMetricsUpgraded //changed for debug
        logs: # Reports Dropwizard metrics in the logs
            enabled: false
            report-frequency: 60 # in seconds
    logging:
        logstash: # Forward logs to logstash over a socket, used by LoggingConfiguration
            enabled: false
            host: localhost
            port: 5000
            queue-size: 512

我的maven prod个人资料如下:

<profile>
            <id>prod</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>com.github.trecloux</groupId>
                        <artifactId>yeoman-maven-plugin</artifactId>
                        <version>0.5</version>
                        <executions>
                            <execution>
                                <id>run-frontend-build</id>
                                <phase>generate-resources</phase>
                                <goals>
                                    <goal>build</goal>
                                </goals>
                                <configuration>
                                    <skipTests>true</skipTests>
                                    <buildTool>gulp</buildTool>
                                    <buildArgs>build</buildArgs>
                                </configuration>
                            </execution>
                        </executions>
                        <configuration>
                            <yeomanProjectDirectory>${project.basedir}</yeomanProjectDirectory>
                        </configuration>
                    </plugin>
                    <plugin>
                        <artifactId>maven-clean-plugin</artifactId>
                        <version>2.5</version>
                        <configuration>
                            <filesets>
                                <fileset>
                                    <directory>target/www/</directory>
                                </fileset>
                                <!--<fileset>-->
                                <!--<directory>node_modules</directory>-->
                                <!--</fileset>-->
                            </filesets>
                        </configuration>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-war-plugin</artifactId>
                        <configuration>
                            <warSourceDirectory>target/www/</warSourceDirectory>
                            <packagingExcludes>WEB-INF/lib/tomcat-*.jar</packagingExcludes>
                            <failOnMissingWebXml>false</failOnMissingWebXml>
                        </configuration>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.tomcat.maven</groupId>
                        <artifactId>tomcat7-maven-plugin</artifactId>
                        <version>2.2</version>
                        <configuration>
                            <url>aurl</url>
                            <username>ausername</username>
                            <password>apassword</password>
                            <path>/apath</path>
                        </configuration>
                    </plugin>

0 个答案:

没有答案