cat集成项目所遇到的一些坑

第一个问题:(jar包依赖冲突)

启动报错,直接贴log

zhengxin-third-shanghai-cis [2017-08-21 14:17:49] 56231 WARN [main]  - AnnotationConfigEmbeddedWebApplicationContext:487: Exception encountered during context initialization - cancelling refresh attempt
org.springframework.context.ApplicationContextException: Unable to start embedded container; nested exception is org.springframework.boot.context.embedded.EmbeddedServletContainerException: Unable to start embedded Tomcat
  at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.onRefresh(EmbeddedWebApplicationContext.java:133)
  at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:474)
  at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:118)
  at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:686)
  at org.springframework.boot.SpringApplication.run(SpringApplication.java:320)
  at org.springframework.boot.SpringApplication.run(SpringApplication.java:957)
  at org.springframework.boot.SpringApplication.run(SpringApplication.java:946)
  at com.ctc..framework.Server.<init>(Server.java:49)
  at com.ctc..framework.Server.<init>(Server.java:23)
  at com.ctc..third.Main.main(Main.java:23)
Caused by: org.springframework.boot.context.embedded.EmbeddedServletContainerException: Unable to start embedded Tomcat
  at org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainer.initialize(TomcatEmbeddedServletContainer.java:98)
  at org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainer.<init>(TomcatEmbeddedServletContainer.java:75)
  at org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainerFactory.getTomcatEmbeddedServletContainer(TomcatEmbeddedServletContainerFactory.java:378)
  at org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainerFactory.getEmbeddedServletContainer(TomcatEmbeddedServletContainerFactory.java:155)
  at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.createEmbeddedServletContainer(EmbeddedWebApplicationContext.java:157)
  at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.onRefresh(EmbeddedWebApplicationContext.java:130)
  ... 9 more
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘org.springframework.boot.autoconfigure.web.WebMvcAutoConfiguration$WebMvcAutoConfigurationAdapter‘: Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private org.springframework.boot.autoconfigure.web.HttpMessageConverters org.springframework.boot.autoconfigure.web.WebMvcAutoConfiguration$WebMvcAutoConfigurationAdapter.messageConverters; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘org.springframework.boot.autoconfigure.web.HttpMessageConvertersAutoConfiguration‘: Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private final java.util.List org.springframework.boot.autoconfigure.web.HttpMessageConvertersAutoConfiguration.converters; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘mappingJackson2HttpMessageConverter‘ defined in class path resource [org/springframework/boot/autoconfigure/web/JacksonHttpMessageConvertersConfiguration$MappingJackson2HttpMessageConverterConfiguration.class]: Unsatisfied dependency expressed through constructor argument with index 0 of type [com.fasterxml.jackson.databind.ObjectMapper]: : Error creating bean with name ‘jacksonObjectMapper‘ defined in class path resource [org/springframework/boot/autoconfigure/jackson/JacksonAutoConfiguration$JacksonObjectMapperConfiguration.class]: Unsatisfied dependency expressed through constructor argument with index 0 of type [org.springframework.http.converter.json.Jackson2ObjectMapperBuilder]: : Error creating bean with name ‘jacksonObjectMapperBuilder‘ defined in class path resource [org/springframework/boot/autoconfigure/jackson/JacksonAutoConfiguration$JacksonObjectMapperBuilderConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.http.converter.json.Jackson2ObjectMapperBuilder]: Factory method ‘jacksonObjectMapperBuilder‘ threw exception; nested exception is java.lang.NoSuchMethodError: org.springframework.http.converter.json.Jackson2ObjectMapperBuilder.applicationContext(Lorg/springframework/context/ApplicationContext;)Lorg/springframework/http/converter/json/Jackson2ObjectMapperBuilder;; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘jacksonObjectMapperBuilder‘ defined in class path resource [org/springframework/boot/autoconfigure/jackson/JacksonAutoConfiguration$JacksonObjectMapperBuilderConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.http.converter.json.Jackson2ObjectMapperBuilder]: Factory method ‘jacksonObjectMapperBuilder‘ threw exception; nested exception is java.lang.NoSuchMethodError: org.springframework.http.converter.json.Jackson2ObjectMapperBuilder.applicationContext(Lorg/springframework/context/ApplicationContext;)Lorg/springframework/http/converter/json/Jackson2ObjectMapperBuilder;; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘jacksonObjectMapper‘ defined in class path resource [org/springframework/boot/autoconfigure/jackson/JacksonAutoConfiguration$JacksonObjectMapperConfiguration.class]: Unsatisfied dependency expressed through constructor argument with index 0 of type [org.springframework.http.converter.json.Jackson2ObjectMapperBuilder]: : Error creating bean with name ‘jacksonObjectMapperBuilder‘ defined in class path resource [org/springframework/boot/autoconfigure/jackson/JacksonAutoConfiguration$JacksonObjectMapperBuilderConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.http.converter.json.Jackson2ObjectMapperBuilder]: Factory method ‘jacksonObjectMapperBuilder‘ threw exception; nested exception is java.lang.NoSuchMethodError: org.springframework.http.converter.json.Jackson2ObjectMapperBuilder.applicationContext(Lorg/springframework/context/ApplicationContext;)Lorg/springframework/http/converter/json/Jackson2ObjectMapperBuilder;; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘jacksonObjectMapperBuilder‘ defined in class path resource [org/springframework/boot/autoconfigure/jackson/JacksonAutoConfiguration$JacksonObjectMapperBuilderConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.http.converter.json.Jackson2ObjectMapperBuilder]: Factory method ‘jacksonObjectMapperBuilder‘ threw exception; nested exception is java.lang.NoSuchMethodError: org.springframework.http.converter.json.Jackson2ObjectMapperBuilder.applicationContext(Lorg/springframework/context/ApplicationContext;)Lorg/springframework/http/converter/json/Jackson2ObjectMapperBuilder;

最重要的是

 Error creating bean with name ‘jacksonObjectMapperBuilder‘ defined in class path resource 

这个错

原因:pom.xml 中的jar包依赖冲突了;

解决办法:

jackson-databind

stackoverflow上面说的很清楚,是这个jar包冲突了。

右键pom.xml,打开项目中的maven,show dependencies,搜索jackson-databind,右键excloud就ok了;

第二个问题:cat集成的时候,pom.xml 添加以下东西

<!-- Cat 集成 -->
<dependency>
<groupId>com.madai.rong</groupId>
<artifactId>rong-cat</artifactId>
<version>1.0.4-SNAPSHOT</version>
</dependency>

<dependency>
<groupId>com.dianping.cat</groupId>
<artifactId>cat-client</artifactId>
<version>1.4.0-RELEASE</version>
</dependency>
<!-- Cat 集成 END -->

本地需要添加客户端配置文件。

在/data/appdatas/cat目录下添加client.xml

内容如下:

<?xml version="1.0" encoding="utf-8"?>

<config mode="client" xmlns:xsi="http://www.w3.org/2001/XMLSchema" xsi:noNamespaceSchemaLocation="config.xsd" enabled="true">
          <servers>
                 <server ip="*.*.*.*" port="2280" http-port="10083" />
          </servers>
</config>

注意,我这里犯了一个错,就是编写xml的时候,我习惯性的空了一行,打了个回车,于是解析xml的时候报错了,切记不能回车。

over...

时间: 2024-10-27 04:50:37

cat集成项目所遇到的一些坑的相关文章

部署点评Cat监控项目

在项目中监控代码运行的状况,可以采用点评的Cat项目来监控整个项目,但是按照官方的文档来部署cat,总会遇到各种问题,讲解的也不够简明清楚,现在用一个单机来部署运行cat监控项目. 首先,到项目的Git网页下载整个项目: https://github.com/dianping/cat 接着就是进入这个项目的目录,运行打包安装命令: mvn clean install -DskipTests  (需要maven) 执行完成后,运行 CAT 安装插件命令: mvn cat:install 会提示输入

综合应用集成项目总结与心得

1 概述 这篇文档是本人第一次以项目负责人的角色来参加企业综合应用集成项目的开发,项目历时了近三个月的时间,虽说最后的结果不是让人非常满意,没有达到的自己预期,但是我在项目中的成长达到了自己的预期,为下一次项目打下了坚实的基础,文中记录了本人在项目中的成长历程和一些心得. 2 预期读者 数通畅联内部人员 相关IT技术从业人员 3 技术总结 3.1 AEAI DP AEAI DP应用开发平台是本次项目中的开发工具,基于AEAI DP快速开发出整个工程的菜单和功能页面,同时也为客户开发一些定制的po

部署点评Cat监控项目(转)

原文地址: 在项目中监控代码运行的状况,可以采用点评的Cat项目来监控整个项目,但是按照官方的文档来部署cat,总会遇到各种问题,讲解的也不够简明清楚,现在用一个单机来部署运行cat监控项目. 首先,到项目的git网页下载整个项目: https://github.com/dianping/cat 接着就是进入这个项目的目录,运行打包安装命令: mvn clean install -DskipTests  (需要maven) 执行完成后,运行 CAT 安装插件命令: mvn cat:install

iOS 平台 Cocos2d-x 项目接入新浪微博 SDK 的坑

iOS 平台 Cocos2d-x 项目接入新浪微博 SDK 的坑 最近在做一个 iOS 的 cocos2d-x 项目接入新浪微博 SDK 的时候被“坑”了,最后终于顺利的解决了.发现网上也有不少人遇到一样的问题,但是能找到的数量有限的解决办法写得都不详细,很难让人理解,我来深入的写一写. 我的开发环境 Mac OS X 10.10.1 Xcode 6.1.1 (6A2008a) Cocos2d-x 3.2 新浪微博 SDK for iOS 2015 年 1 月 5 日从 github clone

spring cloud微服务分布式云架构集成项目

Spring Cloud集成项目有很多,下面我们列举一下和Spring Cloud相关的优秀项目,我们的企业架构中用到了很多的优秀项目,说白了,也是站在巨人的肩膀上去整合的.在学习Spring Cloud之前大家必须了解一下相关项目,希望可以帮助到大家. Spring Cloud Config 配置管理工具包,让你可以把配置放到远程服务器,集中化管理集群配置,目前支持本地存储.Git以及Subversion. Spring Cloud Bus 事件.消息总线,用于在集群(例如,配置变化事件)中传

Spring Cloud微服务分布式云架构-集成项目简介

Spring Cloud集成项目有很多,下面我们列举一下和Spring Cloud相关的优秀项目,我们的企业架构中用到了很多的优秀项目,说白了,也是站在巨人的肩膀上去整合的.在学习Spring Cloud之前大家必须了解一下相关项目,希望可以帮助到大家. Spring Cloud Config 配置管理工具包,让你可以把配置放到远程服务器,集中化管理集群配置,目前支持本地存储.Git以及Subversion. Spring Cloud Bus ?事件.消息总线,用于在集群(例如,配置变化事件)中

Spring Cloud微服务分布式云架构 - spring cloud集成项目

摘要: Spring Cloud集成项目有很多,下面我们列举一下和Spring Cloud相关的优秀项目,我们的企业架构中用到了很多的优秀项目,说白了,也是站在巨人的肩膀上去整合的.在学习Spring Cloud之前大家必须了解一下相关项目,希望可以帮助到大家. Spring Cloud集成项目有很多,下面我们列举一下和Spring Cloud相关的优秀项目,我们的企业架构中用到了很多的优秀项目,说白了,也是站在巨人的肩膀上去整合的.在学习Spring Cloud之前大家必须了解一下相关项目,希

spring cloud微服务分布式云架构 - Spring Cloud集成项目简介

Spring Cloud集成项目有很多,下面我们列举一下和Spring Cloud相关的优秀项目,我们的企业架构中用到了很多的优秀项目,说白了,也是站在巨人的肩膀上去整合的.在学习Spring Cloud之前大家必须了解一下相关项目,希望可以帮助到大家. Spring Cloud Config 配置管理工具包,让你可以把配置放到远程服务器,集中化管理集群配置,目前支持本地存储.Git以及Subversion. Spring Cloud Bus ?事件.消息总线,用于在集群(例如,配置变化事件)中

Spring Cloud微服务分布式云架构-集成项目

Spring Cloud集成项目有很多,下面我们列举一下和Spring Cloud相关的优秀项目,我们的企业架构中用到了很多的优秀项目,说白了,也是站在巨人的肩膀上去整合的.在学习Spring Cloud之前大家必须了解一下相关项目,希望可以帮助到大家. Spring Cloud Config 配置管理工具包,让你可以把配置放到远程服务器,集中化管理集群配置,目前支持本地存储.Git以及Subversion. Spring Cloud Bus ?事件.消息总线,用于在集群(例如,配置变化事件)中