title: Maven using wrong version of javax.validation
body: <p>I have a dynamic web project I have been working on that uses hibernate as a jpa provider.  Up until the last week, I could insert, update, query, and delete from my databases using hibernate.  Recently, I began working on validation, and brought in a lot of different maven dependencies.  In the course of doing this, I somehow have ended up with my project using an older, deprecated version of javax.validation jar, which throws a no such method exception.  I have included the relevant lines of the stack trace below:</p>
  
  <pre><code>Caused by: java.lang.NoSuchMethodError: javax.validation.BootstrapConfiguration.getClockProviderClassName()Ljava/lang/String;
  at org.hibernate.validator.internal.xml.ValidationBootstrapParameters.&lt;init&gt;(ValidationBootstrapParameters.java:63)
  </code></pre>
  
  <p>However, in my pom.xml I have the following dependency (which, when examined via javap and through eclipse, it has the method getClockProviderClassName() in the specified class):</p>
  
  <pre><code>&lt;!-- https://mvnrepository.com/artifact/javax.validation/validation-api --&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;javax.validation&lt;/groupId&gt;
          &lt;artifactId&gt;validation-api&lt;/artifactId&gt;
          &lt;version&gt;2.0.0.Final&lt;/version&gt;
      &lt;/dependency&gt;   
  </code></pre>
  
  <p>I put the following exclusion tag in my pom in multiple dependencies to try and ensure that it does not pull this jar from other sources:</p>
  
  <pre><code>            &lt;exclusion&gt;
                  &lt;artifactId&gt;validation-api&lt;/artifactId&gt;
                  &lt;groupId&gt;javax.validation&lt;/groupId&gt;
              &lt;/exclusion&gt;
  </code></pre>
  
  <p>I have also simplified my build path, so there is three elements in it: one properties folder that contains only my log4j configuration, the JRE System library (version 1.8) and maven dependencies.  Is there any way to tell where the deprecated javax.validation jar is coming from?  Can I force the program to use version 2.0.0 I bring in with maven?  Thank you for your help.</p>
  
  <p>Additional Information:<br>
  <a href="https://i.stack.imgur.com/ttB6Z.jpg" rel="noreferrer">full stack trace</a></p>
  
  <p><a href="https://i.stack.imgur.com/0AOPu.jpg" rel="noreferrer">persistence.xml source</a></p>
  
  <p><a href="https://i.stack.imgur.com/CpLdI.jpg" rel="noreferrer">working datasource properties</a></p>
  
  <p><a href="https://i.stack.imgur.com/UwWbb.jpg" rel="noreferrer">Java Build Path</a></p>
  
  <p><a href="https://i.stack.imgur.com/VG1Sq.jpg" rel="noreferrer">Line where root exception occurs (in my code)</a></p>
  
  <p><a href="https://i.stack.imgur.com/C5cFi.jpg" rel="noreferrer">look inside the included jar to see it contains the method</a></p>
  
  <p><a href="https://i.stack.imgur.com/NamNn.jpg" rel="noreferrer">using javap to examine artifact in maven (m2) directory</a></p>
  
  <p><a href="https://i.stack.imgur.com/WK4gM.jpg" rel="noreferrer">dependency overview from maven</a></p>
  
  <p>Dependencies from pom.xml</p>
  
  <pre><code>&lt;dependencies&gt;
      &lt;!-- https://mvnrepository.com/artifact/org.springframework/spring-core --&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.springframework&lt;/groupId&gt;
          &lt;artifactId&gt;spring-core&lt;/artifactId&gt;
          &lt;version&gt;5.0.2.RELEASE&lt;/version&gt;
          &lt;exclusions&gt;
              &lt;exclusion&gt;
                  &lt;groupId&gt;commons-logging&lt;/groupId&gt;
                  &lt;artifactId&gt;commons-logging&lt;/artifactId&gt;
              &lt;/exclusion&gt;
          &lt;/exclusions&gt;
      &lt;/dependency&gt;
      &lt;!-- https://mvnrepository.com/artifact/org.hibernate/hibernate-core --&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.hibernate&lt;/groupId&gt;
          &lt;artifactId&gt;hibernate-core&lt;/artifactId&gt;
          &lt;version&gt;5.2.2.Final&lt;/version&gt;
          &lt;exclusions&gt;
              &lt;exclusion&gt;
                  &lt;artifactId&gt;jboss-logging&lt;/artifactId&gt;
                  &lt;groupId&gt;org.jboss.logging&lt;/groupId&gt;
              &lt;/exclusion&gt;
              &lt;exclusion&gt;
                  &lt;artifactId&gt;validation-api&lt;/artifactId&gt;
                  &lt;groupId&gt;javax.validation&lt;/groupId&gt;
              &lt;/exclusion&gt;
          &lt;/exclusions&gt;
      &lt;/dependency&gt;
      &lt;!-- https://mvnrepository.com/artifact/mysql/mysql-connector-java --&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;mysql&lt;/groupId&gt;
          &lt;artifactId&gt;mysql-connector-java&lt;/artifactId&gt;
          &lt;version&gt;6.0.3&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;!-- https://mvnrepository.com/artifact/org.apache.logging.log4j/log4j-core --&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.apache.logging.log4j&lt;/groupId&gt;
          &lt;artifactId&gt;log4j-core&lt;/artifactId&gt;
          &lt;version&gt;2.10.0&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;!-- https://stackoverflow.com/questions/20859379/cannot-import-javax-ejb-packages --&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;javax&lt;/groupId&gt;
          &lt;artifactId&gt;javaee-api&lt;/artifactId&gt;
          &lt;version&gt;7.0&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;javax&lt;/groupId&gt;
          &lt;artifactId&gt;javaee-web-api&lt;/artifactId&gt;
          &lt;version&gt;6.0&lt;/version&gt;
          &lt;scope&gt;provided&lt;/scope&gt;
      &lt;/dependency&gt;
      &lt;!-- https://mvnrepository.com/artifact/org.jboss.logging/jboss-logging --&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.jboss.logging&lt;/groupId&gt;
          &lt;artifactId&gt;jboss-logging&lt;/artifactId&gt;
          &lt;version&gt;3.3.0.Final&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;!-- https://mvnrepository.com/artifact/javax.ejb/ejb-api --&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;javax.ejb&lt;/groupId&gt;
          &lt;artifactId&gt;ejb-api&lt;/artifactId&gt;
          &lt;version&gt;3.0&lt;/version&gt;
          &lt;scope&gt;provided&lt;/scope&gt;
      &lt;/dependency&gt;
      &lt;!-- https://mvnrepository.com/artifact/org.springframework/spring-webmvc --&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.springframework&lt;/groupId&gt;
          &lt;artifactId&gt;spring-webmvc&lt;/artifactId&gt;
          &lt;version&gt;5.0.2.RELEASE&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;!-- https://mvnrepository.com/artifact/javax.servlet/servlet-api --&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;javax.servlet&lt;/groupId&gt;
          &lt;artifactId&gt;servlet-api&lt;/artifactId&gt;
          &lt;version&gt;3.0-alpha-1&lt;/version&gt;
          &lt;scope&gt;provided&lt;/scope&gt;
      &lt;/dependency&gt;
      &lt;!-- https://mvnrepository.com/artifact/junit/junit --&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;junit&lt;/groupId&gt;
          &lt;artifactId&gt;junit&lt;/artifactId&gt;
          &lt;version&gt;4.12&lt;/version&gt;
          &lt;scope&gt;test&lt;/scope&gt;
      &lt;/dependency&gt;
      &lt;!-- https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-databind --&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;com.fasterxml.jackson.core&lt;/groupId&gt;
          &lt;artifactId&gt;jackson-databind&lt;/artifactId&gt;
          &lt;version&gt;2.9.3&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;!-- ********************************************************************************************************** --&gt;
      &lt;!-- THE FOLLOWING ARE SEPERATE FROM HIBERNATE THAT IS USED TO CONNECT 
          TO DB, THESE ARE FOR USE WITH VALIDATION --&gt;
      &lt;!-- https://mvnrepository.com/artifact/org.hibernate/hibernate-validator --&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.hibernate&lt;/groupId&gt;
          &lt;artifactId&gt;hibernate-validator&lt;/artifactId&gt;
          &lt;version&gt;6.0.7.Final&lt;/version&gt;
          &lt;exclusions&gt;
              &lt;exclusion&gt;
                  &lt;artifactId&gt;validation-api&lt;/artifactId&gt;
                  &lt;groupId&gt;javax.validation&lt;/groupId&gt;
              &lt;/exclusion&gt;
          &lt;/exclusions&gt;
      &lt;/dependency&gt;
      &lt;!-- https://mvnrepository.com/artifact/org.hibernate/hibernate-validator-annotation-processor --&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.hibernate&lt;/groupId&gt;
          &lt;artifactId&gt;hibernate-validator-annotation-processor&lt;/artifactId&gt;
          &lt;version&gt;6.0.7.Final&lt;/version&gt;
                      &lt;exclusions&gt;
              &lt;exclusion&gt;
                  &lt;artifactId&gt;validation-api&lt;/artifactId&gt;
                  &lt;groupId&gt;javax.validation&lt;/groupId&gt;
              &lt;/exclusion&gt;
          &lt;/exclusions&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.hibernate&lt;/groupId&gt;
          &lt;artifactId&gt;hibernate-validator-cdi&lt;/artifactId&gt;
          &lt;version&gt;6.0.7.Final&lt;/version&gt;
                      &lt;exclusions&gt;
              &lt;exclusion&gt;
                  &lt;artifactId&gt;validation-api&lt;/artifactId&gt;
                  &lt;groupId&gt;javax.validation&lt;/groupId&gt;
              &lt;/exclusion&gt;
          &lt;/exclusions&gt;
      &lt;/dependency&gt;
      &lt;!-- https://mvnrepository.com/artifact/javax.validation/validation-api --&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;javax.validation&lt;/groupId&gt;
          &lt;artifactId&gt;validation-api&lt;/artifactId&gt;
          &lt;version&gt;2.0.0.Final&lt;/version&gt;
      &lt;/dependency&gt;       
      &lt;!-- ********************************************************************************************************** --&gt;
      &lt;!-- API and reference implementation of expression language {a.b} in html 
          code --&gt;
      &lt;!-- https://mvnrepository.com/artifact/javax.el/javax.el-api --&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;javax.el&lt;/groupId&gt;
          &lt;artifactId&gt;javax.el-api&lt;/artifactId&gt;
          &lt;version&gt;3.0.0&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;!-- https://mvnrepository.com/artifact/org.glassfish.web/javax.el --&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.glassfish.web&lt;/groupId&gt;
          &lt;artifactId&gt;javax.el&lt;/artifactId&gt;
          &lt;version&gt;2.2.6&lt;/version&gt;
      &lt;/dependency&gt;
  &lt;/dependencies&gt;
  </code></pre>