我阅读了关于这个问题的其他话题,比如:
但他们并没有帮到我。
在外部库中,我只有Hibernate-validator (6.0.10版本)。我在所有的poms中都使用SpringBoot 2.0.3。我设置了:
<properties>
<cxf.version>3.2.4</cxf.version>
<cxf.xjc.version>3.2.1</cxf.xjc.version>
<spring.oxm.version>4.2.4.RELEASE</spring.oxm.version>
<aspectj.version>1.8.10</aspectj.version>
</properties>cxf 3.2.4来自2018年3月。cxf.xjc是从2018年2月开始的。Hibernate验证器来自
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-validation</artifactId>
</dependency>此外,我还排除了jboss-logging
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<exclusions>
<exclusion>
<groupId>org.jboss.logging</groupId>
<artifactId>jboss-logging</artifactId>
</exclusion>
</exclusions>
</dependency>在我的外部库中,我只有javax.validation-api 2.0.1.final,这是推荐给hibernate 6.0.13的:https://docs.jboss.org/hibernate/stable/validator/reference/en-US/html_single/#validator-gettingstarted-createproject
我在类ConfigurationImpl中的构造函数上设置了断点,但当我在Tomcat9.0.12上运行app时,它不会触发(不是因为业务需要而启动)。
错误是:
Caused by: org.springframework.context.ApplicationContextException: Unable to start web server; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'org.apache.cxf.spring.boot.autoconfigure.CxfAutoConfiguration': Unsatisfied dependency expressed through field 'properties'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'cxf-org.apache.cxf.spring.boot.autoconfigure.CxfProperties': Initialization of bean failed; nested exception is java.lang.NoClassDefFoundError: Could not initialize class org.hibernate.validator.internal.engine.ConfigurationImpl
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.onRefresh(ServletWebServerApplicationContext.java:155)发布于 2018-10-31 19:42:54
我想我必须包括jboss:
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>这个错误的原因是某人在过去所做的排除。
https://stackoverflow.com/questions/53081065
复制相似问题