【日常错误】Could not initialize class org.hibernate.validator.internal.engine.ConfigurationImpl
2024-08-31 19:37:37
最近在用spring-boot编写一个Lucene项目,中间用到了redis,引用了spring-boot-starter-data-redis,在eclipse中用外部Tomcat启动项目一切正常,但是在运行Junit测试用例或使用spring-boot的application的main方法启动项目时,会报如下错误:
2017-11-01 16:45:20.166 WARN 14252 --- [ main] o.s.w.c.s.GenericWebApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'buildController': Unsatisfied dependency expressed through field 'redisTemplate'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'redisConfig': Unsatisfied dependency expressed through field 'redisConnectionFactory'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'org.springframework.boot.autoconfigure.data.redis.RedisAutoConfiguration$RedisConnectionConfiguration': Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'spring.redis-org.springframework.boot.autoconfigure.data.redis.RedisProperties': Initialization of bean failed; nested exception is java.lang.NoClassDefFoundError: Could not initialize class org.hibernate.validator.internal.engine.ConfigurationImpl
2017-11-01 16:45:20.206 INFO 14252 --- [ main] utoConfigurationReportLoggingInitializer : Error starting ApplicationContext. To display the auto-configuration report re-run your application with 'debug' enabled.
2017-11-01 16:45:20.230 ERROR 14252 --- [ main] o.s.boot.SpringApplication : Application startup failed
搜索堆栈中错误信息,很多博客都说是 hibernate-validator 版本冲突的问题:
http://www.jianshu.com/p/a33518f4012f
于是尝试在pom文件中exclude排除spring-boot中自带的这个jar包:
在pom.xml代码里的配置变为如下:
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<exclusions>
<exclusion>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-validator</artifactId>
</exclusion>
</exclusions>
</dependency>
解决。
最新文章
- java实现甘特图的2种方法:SwiftGantt和Jfree (转)
- patchca验证码的使用
- 怎么用ABBYY创建属于自己的PDF
- hdu 3046 Pleasant sheep and big big wolf 最小割
- PHP取二进制文件头快速判断文件类型
- AnimateWindow 阻塞当前线程问题
- maven自动部署到tomcat的问题
- FTP下载帮助类
- day23 框架之基础加强
- 结构体struct sockaddr_in, struct sockaddr,struct in_addr
- centos7下安装mysql5.7.17
- Sublime 3基于python环境的使用
- docker_flannel
- 阿里云-AliRepo
- spring boot(二): spring boot+jdbctemplate+sql server
- 通过DbVisualizer 工具运行DB2存储过程实现INSERT语句主键自增造数
- synchronized(八)
- 谈话准备.xmind 思维导图模版
- java基础四 基本语法
- ReportNG测试报告的定制修改(二)
热门文章
- Pandas | 17 缺失数据处理
- [springboot 开发单体web shop] 1. 前言介绍和环境搭建
- Element-ui-安装
- js取两位小数点
- CF480E Parking Lot(单调队列+dp然鹅并不是优化)
- [转载]1.4 UiPath参数的介绍和使用
- .NET进阶篇06-async异步、thread多线程2
- 【Elasticsearch 7 探索之路】(三)倒排索引
- requests模块发送带headers的Get请求和带参数的请求
- ArcGIS API For Javascript:新增热力图层的方法