java.lang.NoClassDefFoundError:无法初始化类org.hibernate.validator.internal.engine.ConfigurationImpl

时间:2018-10-31 10:19:22

标签: java spring hibernate spring-boot

我阅读了与此相关的其他主题,

Could not initialize class org.hibernate.validator.internal.engine.ConfigurationImpl in Spring tool Suite

Hibernate Validator java.lang.NoClassDefFoundError: Could not initialize class org.hibernate.validator.internal.engine.ConfigurationImpl

但是他们没有帮助我。

在外部库中,我只有Hibernate-validator(6.0.10版本)。 我在所有pom中都使用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 建议在此处休眠6.0.13: https://docs.jboss.org/hibernate/stable/validator/reference/en-US/html_single/#validator-gettingstarted-createproject

我在类ConfigurationImpl中的构造函数上设置了断点,但是当我运行应用程序时它不会触发 在Tomcat 9.0.12上运行(不是出于业务需要而使用springboot的原因)。

错误是:

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)

1 个答案:

答案 0 :(得分:0)

我发现我必须包括jboss:

select t1.*,
       sign(coalesce(#_of_Shareholders,0))
       as dummy
  from table1 t1
  left join table2 t2
    on ( t1.CompanyID = t2.CompanyID ); 

此错误的原因是某人过去的这种排除。