title: Trouble starting Hibernate Validator due to Bean Validation API
body: <p>I'm trying to use Hibernate Validator in my project, but it isn't working. On the following line:</p>
  
  <pre><code>SessionFactory sessions = config.buildSessionFactory(builder.build());
  </code></pre>
  
  <p>I get the following exception:</p>
  
  <pre><code>org.hibernate.cfg.beanvalidation.IntegrationException: Error activating Bean Validation integration
      at org.hibernate.cfg.beanvalidation.BeanValidationIntegrator.integrate(BeanValidationIntegrator.java:154)
      at org.hibernate.internal.SessionFactoryImpl.&lt;init&gt;(SessionFactoryImpl.java:311)
      at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1857)
      at net.myProject.server.util.HibernateUtil.&lt;clinit&gt;(HibernateUtil.java:32)
      ... 36 more
  Caused by: java.lang.NoSuchMethodError: javax.validation.spi.ConfigurationState.getParameterNameProvider()Ljavax/validation/ParameterNameProvider;
      at org.hibernate.validator.internal.engine.ValidatorFactoryImpl.&lt;init&gt;(ValidatorFactoryImpl.java:119)
      at org.hibernate.validator.HibernateValidator.buildValidatorFactory(HibernateValidator.java:45)
      at org.hibernate.validator.internal.engine.ConfigurationImpl.buildValidatorFactory(ConfigurationImpl.java:217)
      at javax.validation.Validation.buildDefaultValidatorFactory(Validation.java:111)
  </code></pre>
  
  <p>I found <a href="https://stackoverflow.com/questions/17266297/hibernate-error-activating-bean-validation-integration">this question</a> which seems quite similar to my problem. He describes his solution as </p>
  
  <blockquote>
    <p>I had yet another bean validator jar in the class path. But not from
    maven, so i didn't realize it. Removing that solved the problem.</p>
  </blockquote>
  
  <p>I think my problem is the same. On <a href="http://hibernate.org/validator/documentation/getting-started/" rel="noreferrer">http://hibernate.org/validator/documentation/getting-started/</a> it says: </p>
  
  <blockquote>
    <p>This transitively pulls in the dependency to the Bean Validation API
    (javax.validation:validation-api:1.1.0.Final)</p>
  </blockquote>
  
  <p>That must be causing this issue, since reverting to an older version (4.3.1.Final) fixes the issue. Is there a way to force Hibernate to not pull in the Bean Validation API?</p>
  
  <p>Edit: I've tried to exclude the javax-validation api:</p>
  
  <pre><code>    &lt;dependency&gt;
        &lt;groupId&gt;org.hibernate&lt;/groupId&gt;
        &lt;artifactId&gt;hibernate-validator&lt;/artifactId&gt;
        &lt;version&gt;5.0.3.Final&lt;/version&gt;
        &lt;exclusions&gt;
            &lt;exclusion&gt;
                &lt;groupId&gt;javax.validation&lt;/groupId&gt;
                &lt;artifactId&gt;validation-api&lt;/artifactId&gt;
            &lt;/exclusion&gt;
        &lt;/exclusions&gt;
    &lt;/dependency&gt;
  </code></pre>
  
  <p>But it didn't seem to have any effect.</p>