Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Source of org.hibernate.validator.engine.ConfigurationImpl

OK, I'm trying to get a validator working with a jsp form.. Have just started using maven, so it's all a bit new... what's the best way of locating which repository I should be selecting for the above class? I already have the following entries for validation:

    <dependency>
        <groupId>javax.validation</groupId>
        <artifactId>validation-api</artifactId>
        <version>1.0.0.GA</version>
    </dependency>


    <dependency>
        <groupId>org.hibernate</groupId>
        <artifactId>hibernate-validator-annotation-processor</artifactId>
        <version>4.1.0.Final</version>
    </dependency>

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

I tried loading hibernate itself, but that broke the build: I'm using eclipse for persistence, and building fails after dragging in a huge number of prerequisite libraries.

I figured that I should get a better strategy than just stabbing away with repositories..

Just to be clear: I'm getting the error:

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

This should be in the hibernate-validator dependency, so not behaving as I would expect.

like image 473
ohp Avatar asked May 25 '11 19:05

ohp


People also ask

What is org Hibernate Validator?

Hibernate Validator allows to express and validate application constraints. The default metadata source are annotations, with the ability to override and extend through the use of XML. It is not tied to a specific application tier or programming model and is available for both server and client application programming.

What is Hibernate Validator annotation processor?

Hibernate Validator Annotation Processor It helps to detect glitches such as: Putting a constraint to bean properties which are not supported by that constraint (e.g. putting @Date to a String) Annotating the setter of a bean property instead of the getter. Adding constraints to static fields or methods.

What is the difference between javax validation and Hibernate Validator?

The Javax bean validation API provides the following most frequently used annotations. The Hibernate validator provides the following commonly used annotations for validation. In case of product or project development we must use both the annotations for bean validation.

Is Hibernate Validator thread safe?

Validating constraints In the setUp() method, a Validator instance is retrieved from the ValidatorFactory . Validator instances are thread-safe and may be reused multiple times.


1 Answers

Do you have slf4j-api on the classpath (this should be pulled in by HV, but just to make sure)?

The NoClassDefFoundError doesn't mean that ConfigurationImpl is not available, but it couldn't be loaded (typically due to problems in the static initializer or by imports of the loaded class which are not available).

A side note on using the annotation processor: instead of adding it as project dependency you can also use it via the Maven annotation processor plugin. That way you can't accidentally import classes from it in your project. The set-up is described in detail in the Hibernate Validator reference guide.

like image 190
Gunnar Avatar answered Oct 20 '22 00:10

Gunnar