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

前端 未结 7 455
南方客
南方客 2021-01-19 02:15

I have read this and this, but that didn\'t help...

I am using hibernate validator with the following versions/dependencies:


             


        
相关标签:
7条回答
  • 2021-01-19 02:19

    I would suspect multiple implementations of javax.el. That's usually what causes this sort of issues.

    Check that you don't have another one with a different name.

    If it's not that, add a checkpoint in the ConfigurationImpl constructor and check what's failing.

    0 讨论(0)
  • 2021-01-19 02:21

    For me the problem was that Hibernate Validator depended on jboss-logging. And the jboss logging was not part of my classpath. The exception was not telling me that the class not def found error while trying to instantiate the hibernate configuration impl was from missing jboss logging on the classpath.

    Once I added it to the classpath, the class def not found error went away.

    0 讨论(0)
  • 2021-01-19 02:22

    Try like this config :

    <properties>
    
            <hibernate.version>4.3.11.Final</hibernate.version>
        </properties>
    
        <dependencies> 
            <!-- Hibernate -->
            <dependency>
                <groupId>org.hibernate</groupId>
                <artifactId>hibernate-core</artifactId>
                <version>${hibernate.version}</version>
            </dependency>
    
            <!-- jsr303 validation -->
            <dependency>
                <groupId>javax.validation</groupId>
                <artifactId>validation-api</artifactId>
                <version>1.1.0.Final</version>
            </dependency>
            <dependency>
                <groupId>org.hibernate</groupId>
                <artifactId>hibernate-validator</artifactId>
                <version>5.1.3.Final</version>
            </dependency>    
    
        </dependencies>
    

    For a complete example..

    0 讨论(0)
  • 2021-01-19 02:30

    First, check all dependencies using mvn dependency:tree - Find hibernate-validator and add below one into pom.xml inside respective dependency - if not required.

    <exclusion>
        <groupId>org.hibernate</groupId>
        <artifactId>hibernate-validator</artifactId>
    </exclusion>
    
    0 讨论(0)
  • 2021-01-19 02:34

    I was facing the same issue while working with JSR 303 bean validation I have added below two jar(along with validation-api-1.1.0.final.jar and hibernate-validator-5.0.1.final.jar) and the issue got resolved

    1. classmate-0.8.0.jar 2.jboss-logging-3.1.0.ga.jar
    0 讨论(0)
  • I had this issue when working on a spring-boot application. The problem was caused by hibernate-validator 6.0.11 which seems to have an erroneous dependency on javax validation-api 2.0.1.Final. For me the solution was to upgrade to a higher version of hibernate-validator.

    In more detail:
    My application was depending on spring-boot-starter-parent 2.1.18.RELEASE. The spring-boot-starter-web package depends on hibernate-validator 6.0.11, which itself depends on validation-api-2.0.1.Final. validation-api-2.0.1.Final however requires a higher version of the hibernate validator causing the ValueExtractorManager NoClassDefFoundError. The problem was fixed after upgrading the application to spring-boot-starter-parent 2.1.18.RELEASE which utilizes hibernate-validator 6.0.21.Final.

    0 讨论(0)
提交回复
热议问题