title: Specified JDBC Driver com.mysql.jdbc.Driver class not found
body: <p>I am using <em>eclipse juno</em> and <em>hibernate 4.1.6</em>, <em>mysql connector 5.1.24</em>, <em>jboss 7.1.1</em>.</p>
  
  <p>I tried <a href="https://stackoverflow.com/questions/8779631/jdbc-driver-class-not-found-com-mysql-jdbc-driver">this</a> and <a href="https://community.jboss.org/wiki/DataSourceConfigurationinAS7" rel="nofollow noreferrer">this</a>(as a module).</p>
  
  <p>I have the connector JAR in <code>WEB-INF/lib</code> folder, and I also tried once without it. Everything failed. I don't know anymore how I can solve this problem. The whole stack trace: </p>
  
  <pre><code>18:35:44,284 ERROR [stderr] (http-localhost-127.0.0.1-8080-1) Error creating Session: org.hibernate.service.classloading.spi.ClassLoadingException: Specified JDBC Driver com.mysql.jdbc.Driver class not found
  </code></pre>
  
  <p>The connector is an the class path, it's in the Maven Dependencies Library. I put it in the lib folder and in the System Library...nothing works.</p>
  
  <pre><code>public class HibernateUtil {
  
  private static SessionFactory sessionFactory;
  private static ServiceRegistry serviceRegistry;
  
  static
  {
      try
      {
          Configuration configuration = new Configuration().configure("hibernate.cfg.xml");
          serviceRegistry = new ServiceRegistryBuilder().applySettings(configuration.getProperties()).buildServiceRegistry();
          sessionFactory = configuration.buildSessionFactory(serviceRegistry);
      }
      catch (HibernateException he)
      {
          System.err.println("Error creating Session: " + he);
          throw new ExceptionInInitializerError(he);
      }
  }
  </code></pre>