首页 技术 正文
技术 2022年11月6日
0 收藏 321 点赞 799 浏览 8194 个字

第一个问题:(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…

相关推荐
python开发_常用的python模块及安装方法
adodb:我们领导推荐的数据库连接组件bsddb3:BerkeleyDB的连接组件Cheetah-1.0:我比较喜欢这个版本的cheeta…
日期:2022-11-24 点赞:878 阅读:9,076
Educational Codeforces Round 11 C. Hard Process 二分
C. Hard Process题目连接:http://www.codeforces.com/contest/660/problem/CDes…
日期:2022-11-24 点赞:807 阅读:5,552
下载Ubuntn 17.04 内核源代码
zengkefu@server1:/usr/src$ uname -aLinux server1 4.10.0-19-generic #21…
日期:2022-11-24 点赞:569 阅读:6,400
可用Active Desktop Calendar V7.86 注册码序列号
可用Active Desktop Calendar V7.86 注册码序列号Name: www.greendown.cn Code: &nb…
日期:2022-11-24 点赞:733 阅读:6,176
Android调用系统相机、自定义相机、处理大图片
Android调用系统相机和自定义相机实例本博文主要是介绍了android上使用相机进行拍照并显示的两种方式,并且由于涉及到要把拍到的照片显…
日期:2022-11-24 点赞:512 阅读:7,812
Struts的使用
一、Struts2的获取  Struts的官方网站为:http://struts.apache.org/  下载完Struts2的jar包,…
日期:2022-11-24 点赞:671 阅读:4,894