Spring boot 服务启动后报错:Add an implement,such as Hibernate Validator, to the classpath

话不多说,解决问题:

spring boot 版本1.5.12.RELEASE

1.服务启动报错如下:

Description : 

The Bean Validation API is on the classpath but no implementation could be found 
Action : Add an implementation, such as Hibernate Validator, to the classpath


2.报错分析 
Hibernate Validator的加载问题,查看maven库Hibernate-validator-5.3.6.final.jar存在; 
执行mvn clean, 然后在eclipse或者idea上mvn install后,发现有告警日志,如下:

[WARNING] org.apache.maven.plugins:maven-compi1er-p1ugin:3.1:compi1e (default-compile) on project demo: Compilation failure: Compilation fail invalid LOC header (bad signature) 
[WARNING] D:\repository\org\hibernate\hibernate-validator\5.3.6.Final\hibernate validator-5.3.6.Fina1.jar 
[WARNING] src/main/java.com/example/ft1/FreeMa rke rConfig. java : [8 , 17] org.junit 
Ck trace of the errors, re-run Maven with the -e switch. the -X switch to enable full debug logging.

由日志提示推测,极大可能是Hibernate-validator-5.3.6.final.jar的问题(由于是WARNING,打包的时候忽略了)

3.解决方法
1)在本地maven库中删除Hibernate-validator包下的所有文件(如:D:\repository\org\hibernate\hibernate-validator)后,重新下载这个包。
2)该服务执行maven clean,若执行失败则需要调查原因;反之,执行成功则继续第三步。
3)该服务执行maven install,仔细查看日志,若无ERROR或WARNING后,生成的包便可以进行部署以及后续的功能测试。

猜你喜欢

转载自www.cnblogs.com/betty-orange/p/13399665.html
今日推荐