title: Hibernate ILLEGAL ACCESS ERROR Maria DB Connection
body: <p>Im trying to Connect to Maria DB from JBOSS Web app.</p>
  
  <p>Im using Datasource for the connection. </p>
  
  <p>my hibernate.cfg file </p>
  
  <p>
  
  
      </p>
  
  <pre><code>    &lt;property name="hibernate.dialect"&gt;org.hibernate.dialect.MySQL5Dialect&lt;/property&gt;
      &lt;property name="hibernate.connection.driver_class"&gt;org.mariadb.jdbc.Driver&lt;/property&gt;
   &lt;property name="hibernate.connection.datasource"&gt;java:/datasources/KDCDBM&lt;/property&gt;
      &lt;property name="hibernate.current_session_context_class"&gt;thread&lt;/property&gt;
      &lt;property name="hibernate.show_sql"&gt;true&lt;/property&gt;
      &lt;property name="show_sql"&gt;true&lt;/property&gt; 
      &lt;property name="hbm2dll.auto"&gt;update&lt;/property&gt;
      &lt;property name="transaction.factory_class"&gt;org.hibernate.transaction.JDBCTransactionFactory&lt;/property&gt;
  
      &lt;mapping resource="com/mycompany/Contact.hbm.xml"/&gt;
  </code></pre>
  
  <p>
  </p>
  
  <p>When i bring up my app and try to connect . Im getting following error</p>
  
  <pre><code>13:07:01,387 INFO  [org.hibernate.validator.internal.util.Version] (ServerService Thread Pool -- 60) HV000001: Hibernate Validator 4.3.3.Final-redhat-1
  13:07:01,391 ERROR [stderr] (ServerService Thread Pool -- 60) org.hibernate.HibernateException: Error applying BeanValidation relational constraints
  13:07:01,391 ERROR [stderr] (ServerService Thread Pool -- 60)   at org.hibernate.cfg.beanvalidation.BeanValidationIntegrator.applyRelationalConstraints(BeanValidationIntegrator.java:219)
  13:07:01,391 ERROR [stderr] (ServerService Thread Pool -- 60)   at org.hibernate.cfg.beanvalidation.BeanValidationIntegrator.integrate(BeanValidationIntegrator.java:126)
  13:07:01,391 ERROR [stderr] (ServerService Thread Pool -- 60)   at org.hibernate.internal.SessionFactoryImpl.&lt;init&gt;(SessionFactoryImpl.java:301)
  13:07:01,392 ERROR [stderr] (ServerService Thread Pool -- 60)   at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1744)
  13:07:01,392 ERROR [stderr] (ServerService Thread Pool -- 60)   at com.kony.p2p.services.integration.serviceimpl.batch.CronJobsImpl.startCronJob(CronJobsImpl.java:136)
  13:07:01,392 ERROR [stderr] (ServerService Thread Pool -- 60)   at com.kony.p2p.servlet.DBSBatchJobServlet.invokeCronJobs(DBSBatchJobServlet.java:66)
  13:07:01,392 ERROR [stderr] (ServerService Thread Pool -- 60)   at com.kony.p2p.servlet.DBSBatchJobServlet.contextInitialized(DBSBatchJobServlet.java:39)
  13:07:01,392 ERROR [stderr] (ServerService Thread Pool -- 60)   at org.apache.catalina.core.StandardContext.contextListenerStart(StandardContext.java:3339)
  13:07:01,392 ERROR [stderr] (ServerService Thread Pool -- 60)   at org.apache.catalina.core.StandardContext.start(StandardContext.java:3780)
  13:07:01,392 ERROR [stderr] (ServerService Thread Pool -- 60)   at org.jboss.as.web.deployment.WebDeploymentService.doStart(WebDeploymentService.java:163)
  13:07:01,392 ERROR [stderr] (ServerService Thread Pool -- 60)   at org.jboss.as.web.deployment.WebDeploymentService.access$000(WebDeploymentService.java:61)
  13:07:01,392 ERROR [stderr] (ServerService Thread Pool -- 60)   at org.jboss.as.web.deployment.WebDeploymentService$1.run(WebDeploymentService.java:96)
  13:07:01,392 ERROR [stderr] (ServerService Thread Pool -- 60)   at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
  13:07:01,392 ERROR [stderr] (ServerService Thread Pool -- 60)   at java.util.concurrent.FutureTask.run(FutureTask.java:266)
  13:07:01,392 ERROR [stderr] (ServerService Thread Pool -- 60)   at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
  13:07:01,393 ERROR [stderr] (ServerService Thread Pool -- 60)   at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
  13:07:01,393 ERROR [stderr] (ServerService Thread Pool -- 60)   at java.lang.Thread.run(Thread.java:745)
  13:07:01,393 ERROR [stderr] (ServerService Thread Pool -- 60)   at org.jboss.threads.JBossThread.run(JBossThread.java:122)
  13:07:01,393 ERROR [stderr] (ServerService Thread Pool -- 60) Caused by: java.lang.reflect.InvocationTargetException
  13:07:01,393 ERROR [stderr] (ServerService Thread Pool -- 60)   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  13:07:01,393 ERROR [stderr] (ServerService Thread Pool -- 60)   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
  13:07:01,393 ERROR [stderr] (ServerService Thread Pool -- 60)   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
  13:07:01,393 ERROR [stderr] (ServerService Thread Pool -- 60)   at java.lang.reflect.Method.invoke(Method.java:498)
  13:07:01,393 ERROR [stderr] (ServerService Thread Pool -- 60)   at org.hibernate.cfg.beanvalidation.BeanValidationIntegrator.applyRelationalConstraints(BeanValidationIntegrator.java:208)
  13:07:01,393 ERROR [stderr] (ServerService Thread Pool -- 60)   ... 17 more
  13:07:01,393 ERROR [stderr] (ServerService Thread Pool -- 60) Caused by: java.lang.IllegalAccessError: tried to access class javax.persistence.Persistence$1 from class javax.persistence.Persistence
  13:07:01,394 ERROR [stderr] (ServerService Thread Pool -- 60)   at javax.persistence.Persistence.&lt;clinit&gt;(Persistence.java:87)
  13:07:01,394 ERROR [stderr] (ServerService Thread Pool -- 60)   at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
  13:07:01,394 ERROR [stderr] (ServerService Thread Pool -- 60)   at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
  13:07:01,394 ERROR [stderr] (ServerService Thread Pool -- 60)   at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
  13:07:01,394 ERROR [stderr] (ServerService Thread Pool -- 60)   at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
  13:07:01,394 ERROR [stderr] (ServerService Thread Pool -- 60)   at java.lang.Class.newInstance(Class.java:442)
  13:07:01,394 ERROR [stderr] (ServerService Thread Pool -- 60)   at org.hibernate.validator.internal.util.privilegedactions.NewInstance.run(NewInstance.java:48)
  13:07:01,394 ERROR [stderr] (ServerService Thread Pool -- 60)   at org.hibernate.validator.internal.engine.resolver.DefaultTraversableResolver.run(DefaultTraversableResolver.java:156)
  13:07:01,394 ERROR [stderr] (ServerService Thread Pool -- 60)   at org.hibernate.validator.internal.engine.resolver.DefaultTraversableResolver.detectJPA(DefaultTraversableResolver.java:101)
  13:07:01,394 ERROR [stderr] (ServerService Thread Pool -- 60)   at org.hibernate.validator.internal.engine.resolver.DefaultTraversableResolver.&lt;init&gt;(DefaultTraversableResolver.java:67)
  13:07:01,394 ERROR [stderr] (ServerService Thread Pool -- 60)   at org.hibernate.validator.internal.engine.ConfigurationImpl.&lt;init&gt;(ConfigurationImpl.java:74)
  13:07:01,394 ERROR [stderr] (ServerService Thread Pool -- 60)   at org.hibernate.validator.HibernateValidator.createGenericConfiguration(HibernateValidator.java:41)
  13:07:01,394 ERROR [stderr] (ServerService Thread Pool -- 60)   at javax.validation.Validation$GenericBootstrapImpl.configure(Validation.java:269)
  13:07:01,395 ERROR [stderr] (ServerService Thread Pool -- 60)   at javax.validation.Validation.buildDefaultValidatorFactory(Validation.java:111)
  13:07:01,395 ERROR [stderr] (ServerService Thread Pool -- 60)   at org.hibernate.cfg.beanvalidation.TypeSafeActivator.getValidatorFactory(TypeSafeActivator.java:521)
  13:07:01,395 ERROR [stderr] (ServerService Thread Pool -- 60)   at org.hibernate.cfg.beanvalidation.TypeSafeActivator.applyDDL(TypeSafeActivator.java:119)
  13:07:01,395 ERROR [stderr] (ServerService Thread Pool -- 60)   ... 22 more
  </code></pre>