title: Hibernate : Error applying BeanValidation relational constraints
body: <p>I'm getting this error when I'm trying to configure my session factory, according to google's results putting javaee-api in provided scope should solve the problem, but it does not :/
      In your special case it looks like that javax.validation interface libary is not aviable in the tests. May they are not incuded in javaee-api. If this is the case, then add:</p>
  
  <pre><code> &lt;dependency&gt;
      &lt;groupId&gt;javax.validation&lt;/groupId&gt;
      &lt;artifactId&gt;validation-api&lt;/artifactId&gt;
      &lt;version&gt;1.0.0.GA&lt;/version&gt;
      &lt;scope&gt;test&lt;/scope&gt;
  &lt;/dependency&gt;
  
  full pom.xml [code]
  &lt;dependencies&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;commons-io&lt;/groupId&gt;
          &lt;artifactId&gt;commons-io&lt;/artifactId&gt;
          &lt;version&gt;2.0.1&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;commons-logging&lt;/groupId&gt;
          &lt;artifactId&gt;commons-logging&lt;/artifactId&gt;
          &lt;version&gt;1.1.1&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;commons-codec&lt;/groupId&gt;
          &lt;artifactId&gt;commons-codec&lt;/artifactId&gt;
          &lt;version&gt;1.7&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;tele.crm&lt;/groupId&gt;
          &lt;artifactId&gt;crm-service-utils&lt;/artifactId&gt;
          &lt;version&gt;1.0-SNAPSHOT&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;commons-beanutils&lt;/groupId&gt;
          &lt;artifactId&gt;commons-beanutils&lt;/artifactId&gt;
          &lt;version&gt;1.8.3&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;tele.crm&lt;/groupId&gt;
          &lt;artifactId&gt;crm-billing-client&lt;/artifactId&gt;
          &lt;version&gt;1.0-SNAPSHOT&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.hibernate&lt;/groupId&gt;
          &lt;artifactId&gt;hibernate-core&lt;/artifactId&gt;
          &lt;version&gt;4.0.1.Final&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;net.sf.ehcache&lt;/groupId&gt;
          &lt;artifactId&gt;ehcache-core&lt;/artifactId&gt;
          &lt;version&gt;2.4.3&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.hibernate&lt;/groupId&gt;
          &lt;artifactId&gt;hibernate-ehcache&lt;/artifactId&gt;
          &lt;version&gt;4.0.1.Final&lt;/version&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;mysql&lt;/groupId&gt;
          &lt;artifactId&gt;mysql-connector-java&lt;/artifactId&gt;
          &lt;version&gt;5.1.36&lt;/version&gt;
      &lt;/dependency&gt;
  &lt;/dependencies&gt;
  
  java Code:
  
   public static void main( String[] args )
  {
      show();
  }
  
  public static void show()
  {
      Session session = null;
      Transaction transaction = null;
      SessionFactory sessionFactory = HibernateUtil.getSessionFactory();
      try
      {
          System.out.println("aaa"+sessionFactory);
          session = sessionFactory.openSession();
          System.out.println(session);
          transaction = session.beginTransaction();
          CrmUserPojo e = new CrmUserPojo();
          e.setUserId( "ASDF" );
          e.setFirstName("kumar");
          session.save( e );
          transaction.commit();
      }
      catch ( Exception ss )
      {
          transaction.rollback();
      }
      finally
      {
          session.close();
      }
      System.out.println( "Sucesfully Saved" );
  }
  </code></pre>
  
  <p>Exception in thread "main" :</p>
  
  <pre><code>Exception in thread "main" java.lang.ExceptionInInitializerError
      at com.np.tele.crm.utils.HibernateUtil.&lt;clinit&gt;(HibernateUtil.java:29)
      at com.np.test.Emp.show(Emp.java:25)
      at com.np.test.Emp.main(Emp.java:15)
  Caused by: java.lang.ClassFormatError: Absent Code attribute in method that is not native or abstract in class file javax/validation/Validation
      at java.lang.ClassLoader.defineClass1(Native Method)
      at java.lang.ClassLoader.defineClassCond(Unknown Source)
      at java.lang.ClassLoader.defineClass(Unknown Source)
      at java.security.SecureClassLoader.defineClass(Unknown Source)
      at java.net.URLClassLoader.defineClass(Unknown Source)
      at java.net.URLClassLoader.access$000(Unknown Source)
      at java.net.URLClassLoader$1.run(Unknown Source)
      at java.security.AccessController.doPrivileged(Native Method)
      at java.net.URLClassLoader.findClass(Unknown Source)
      at java.lang.ClassLoader.loadClass(Unknown Source)
      at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
      at java.lang.ClassLoader.loadClass(Unknown Source)
      at java.lang.ClassLoader.loadClass(Unknown Source)
      at org.hibernate.service.classloading.internal.ClassLoaderServiceImpl.classForName(ClassLoaderServiceImpl.java:138)
      at org.hibernate.cfg.beanvalidation.BeanValidationIntegrator.integrate(BeanValidationIntegrator.java:115)
      at org.hibernate.internal.SessionFactoryImpl.&lt;init&gt;(SessionFactoryImpl.java:294)
      at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1737)
      at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1775)
      at com.np.tele.crm.utils.HibernateUtil.&lt;clinit&gt;(HibernateUtil.java:23)
      ... 2 more
  </code></pre>