启动报错日志如下:
Description:
An attempt was made to call a method that does not exist. The attempt was made from the following location:
org.hibernate.validator.internal.xml.config.ValidationBootstrapParameters.<init>(ValidationBootstrapParameters.java:63)
The following method did not exist:
javax.validation.BootstrapConfiguration.getClockProviderClassName()Ljava/lang/String;
The method's class, javax.validation.BootstrapConfiguration, is available from the following locations:
jar:file:/D:/Dev/repositories/javax/javaee-api/7.0/javaee-api-7.0.jar!/javax/validation/BootstrapConfiguration.class
jar:file:/D:/Dev/repositories/javax/validation/validation-api/2.0.1.Final/validation-api-2.0.1.Final.jar!/javax/validation/BootstrapConfiguration.class
It was loaded from the following location:
file:/D:/Dev/repositories/javax/javaee-api/7.0/javaee-api-7.0.jar
报错是在引入的hibernate-valitator-6.0.16.Final包里的引用的方法找不到。
org.hibernate.validator.internal.xml.config.ValidationBootstrapParameters#ValidationBootstrapParameters(javax.validation.BootstrapConfiguration, java.lang.ClassLoader)
找不到方法的代码如下:
bootstrapConfiguration.getClockProviderClassName()
bootstrapConfiguration.getValueExtractorClassNames()
出现问题的背景是将SSM项目重构为基于SpringBoot2.x的项目,解决方案为将 JavaEE7升级到JavaEE8
将
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-api</artifactId>
<version>7.0</version>
</dependency>
升级至
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-api</artifactId>
<version>8.0</version>
</dependency>