question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Runtime Error - java.lang.NoSuchMethodError: org.hibernate.validator.HibernateValidatorConfiguration.addValueExtractor

See original GitHub issue

Release: 2.0.0

Error- As soon you execute the jar file, you get following error:

Exception in thread "main" java.lang.NoSuchMethodError: org.hibernate.validator.HibernateValidatorConfiguration.addValueExtractor(Ljavax/validation/valueextraction/ValueExtractor;)Ljavax/validation/Configuration;
        at io.dropwizard.validation.BaseValidator.newConfiguration(BaseValidator.java:27)
        at io.dropwizard.jersey.validation.Validators.newConfiguration(Validators.java:33)
        at io.dropwizard.jersey.validation.Validators.newValidatorFactory(Validators.java:26)
        at io.dropwizard.setup.Bootstrap.<init>(Bootstrap.java:64)
        at io.dropwizard.Application.run(Application.java:86)
        at BusinessAPI.main(BusinessAPI.java:51)

Workaround: Exclusion of 6.1.0.Final version and inclusion of 6.0.17.Final

    <dependency>
      <groupId>io.dropwizard</groupId>
      <artifactId>dropwizard-core</artifactId>
        <exclusions>
          <exclusion>
            <groupId>org.hibernate.validator</groupId>
            <artifactId>hibernate-validator</artifactId>
          </exclusion>
        </exclusions>
    </dependency>

    <dependency>
      <groupId>org.hibernate.validator</groupId>
      <artifactId>hibernate-validator</artifactId>
      <version>6.0.17.Final</version>
    </dependency>

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:1
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

7reactions
j4n1commented, Jan 3, 2020

Problem is that javax.validation:validation-api-1.1.0-Final.jar and jakarta.validation:jakarta.validation-api-2.0.2.jar are both on your classpath, they have classes in the same namespace(javax.validation) and older version of the class, one which doesn’t have methods present in the latest version, is being loaded by the classloader.

You’ll have to exclude javax.validation from your classpath, it’s coming from swagger-models

6reactions
mrthebcommented, Apr 24, 2020

For bystanders ending up here, this has been fixed in swagger-core v2.1.2 from https://github.com/swagger-api/swagger-core/pull/3467 so the exclusion shouldn’t be needed anymore.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Trouble starting Hibernate Validator due to Bean Validation API
The java validation code is passing the Hiberate an outdated ConfiguationState interface; one that doesn't implement the required interfaces.
Read more >
Dropwizard 0.8 throws NoSuchMethodError on ...
Exception in thread "main " java.lang.NoSuchMethodError: org.hibernate.validator.HibernateValidatorConfiguration.
Read more >
Hibernate Validator 8.0.0.Final - Jakarta Bean Validation ...
The validate() method returns a set of ConstraintViolation instances, which you can iterate over in order to see which validation errors ...
Read more >
[Solved] java.lang.NoClassDefFoundError: Could not initialize ...
NoClassDefFoundError : Could not initialize class org.hibernate.validator.engine.ConfigurationImpl. Last Updated: October 1, 2022.
Read more >
Java.Lang.Nosuchmethoderror: Org.Hibernate.Sessionfactory ...
openSessionLorg/hibernate/Session; at org.springframework.orm.hibernate4.support.OpenSessionInViewFilter. NoSuchMethodError: 'java.lang.String javax.validation.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found