简体   繁体   中英

java.lang.NoClassDefFoundError when running jdk 11

I am getting this error when i try to run my code in jdk 11, it doesn't give this error in jdk 1.8

  java.lang.NoClassDefFoundError: org/hibernate/validator/spi/valuehandling/ValidatedValueUnwrapper

    at io.dropwizard.setup.Bootstrap.<init>(Bootstrap.java:68)
    at io.dropwizard.testing.DropwizardTestSupport$2.<init>(DropwizardTestSupport.java:204)
    at io.dropwizard.testing.DropwizardTestSupport.startIfRequired(DropwizardTestSupport.java:204)
    at io.dropwizard.testing.DropwizardTestSupport.before(DropwizardTestSupport.java:151)

Caused by: java.lang.ClassNotFoundException: org.hibernate.validator.spi.valuehandling.ValidatedValueUnwrapper
    at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:583)
    at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
    at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)

Please help.

This problem is due to incorrect version of “hibernate-validator” dependency. You need to try other versions of this dependency to solve this issue. Below combination works perfectly.

<dependency>
  <groupId>javax.validation</groupId>
  <artifactId>validation-api</artifactId>
  <version>1.0.0.GA</version>
</dependency>
<dependency>
  <groupId>org.hibernate</groupId>
  <artifactId>hibernate-validator</artifactId>
  <version>4.3.1.Final</version>
</dependency>

If you want to refer pom.xml, please refer this article:- https://howtodoinjava.com/spring-mvc/solved-java-lang-noclassdeffounderror-could-not-initialize-class-org-hibernate-validator-engine-configurationimpl/

Please reach out in the comments for any further clarifications Thanks

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM