title: hibernate.cfg.xml contains info about MySQL database they why I am getting this exception?
body: <p>This is question about java hibernate.</p>
  
  <p>my <code>hibernate.cfg.xml</code> is</p>
  
  <pre><code> &lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd"&gt;
  &lt;hibernate-configuration&gt;
    &lt;session-factory&gt;
      &lt;property name="hibernate.dialect"&gt;org.hibernate.dialect.MySQLDialect&lt;/property&gt;
      &lt;property name="hibernate.connection.driver_class"&gt;com.mysql.jdbc.Driver&lt;/property&gt;
      &lt;property name="hibernate.connection.url"&gt;jdbc:mysql://localhost:3306/poc&lt;/property&gt;
      &lt;property name="hibernate.connection.username"&gt;user&lt;/property&gt;
      &lt;property name="hibernate.connection.password"/&gt;
      &lt;mapping class="test.person" file="" jar="" package="" resource="person.hbm.xml"/&gt;
    &lt;/session-factory&gt;
  &lt;/hibernate-configuration&gt;
  </code></pre>
  
  <p>Connection to the database is working and I can explore databases and tables,</p>
  
  <p>my sample</p>
  
  <p><code>person.hbm.xml</code> is</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd"&gt;
  &lt;hibernate-mapping&gt;
      &lt;class name="test.person" table="person"&gt;
          &lt;id name="id" type="int" column="id" &gt;
              &lt;generator class="assigned"/&gt;
          &lt;/id&gt;
          &lt;property name="fName"&gt;
              &lt;column name="fName" /&gt;
          &lt;/property&gt;
          &lt;property name="lName"&gt;
              &lt;column name="lName"/&gt;
          &lt;/property&gt;
          &lt;property name="age"&gt;
              &lt;column name="age"/&gt;
          &lt;/property&gt;
          &lt;property name="gender"&gt;
              &lt;column name="gender"/&gt;
          &lt;/property&gt;
      &lt;/class&gt;
  &lt;/hibernate-mapping&gt;
  </code></pre>
  
  <p>this is my person class</p>
  
  <pre><code>/*
   * To change this template, choose Tools | Templates
   * and open the template in the editor.
   */
  package test;
  
  public class person {
  
      private int id;
      private String fName;
      private String lName;
      private String gender;
      private int age;
  
      public person() {
          System.out.println("person");
      }
  
      public int getId() {
          return id;
      }
  
      public int getAge() {
          return age;
      }
  
      public String getfName() {
          return fName;
      }
  
      public String getGender() {
          return gender;
      }
  
      public String getlName() {
          return lName;
      }
  
      public void setId(int id) {
          this.id = id;
      }
  
      public void setAge(int age) {
          this.age = age;
      }
  
      public void setfName(String fName) {
          this.fName = fName;
      }
  
      public void setGender(String gender) {
          this.gender = gender;
      }
  
      public void setlName(String lName) {
          this.lName = lName;
      }
  
  }
  </code></pre>
  
  <p>Here comes my Main class</p>
  
  <pre><code>package test;
  
  
  import org.hibernate.Session;
  import org.hibernate.SessionFactory;
  import org.hibernate.cfg.Configuration;
  
  public class Test {
  
      public static void main(String[] args) throws ClassNotFoundException, InstantiationException, IllegalAccessException {
  
  
          Session session = null;
          SessionFactory sessionFactory =new Configuration().configure().buildSessionFactory();
          session = sessionFactory.openSession();
  
          person obj = new person();
          obj.setfName("Aqif");
          obj.setlName("Hamid");
          obj.setAge(24);
          obj.setGender("Male");
  
          session.save(obj);
          session.flush();
          session.close();
  
      }
  }
  </code></pre>
  
  <p>I am getting this exception,</p>
  
  <pre><code>SEVERE: JDBC Driver class not found: org.apache.derby.jdbc.ClientDriver
  java.lang.ClassNotFoundException: org.apache.derby.jdbc.ClientDriver
      at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
      at java.security.AccessController.doPrivileged(Native Method)
      at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
      at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
      at java.lang.Class.forName0(Native Method)
      at java.lang.Class.forName(Class.java:169)
      at org.hibernate.util.ReflectHelper.classForName(ReflectHelper.java:100)
      at org.hibernate.connection.DriverManagerConnectionProvider.configure(DriverManagerConnectionProvider.java:61)
      at org.hibernate.connection.ConnectionProviderFactory.newConnectionProvider(ConnectionProviderFactory.java:124)
      at org.hibernate.connection.ConnectionProviderFactory.newConnectionProvider(ConnectionProviderFactory.java:56)
      at org.hibernate.cfg.SettingsFactory.createConnectionProvider(SettingsFactory.java:414)
      at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:62)
      at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:2009)
      at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1292)
      at test.Test.main(Test.java:15)
  Exception in thread "main" org.hibernate.HibernateException: JDBC Driver class not found: org.apache.derby.jdbc.ClientDriver
      at org.hibernate.connection.DriverManagerConnectionProvider.configure(DriverManagerConnectionProvider.java:66)
      at org.hibernate.connection.ConnectionProviderFactory.newConnectionProvider(ConnectionProviderFactory.java:124)
      at org.hibernate.connection.ConnectionProviderFactory.newConnectionProvider(ConnectionProviderFactory.java:56)
      at org.hibernate.cfg.SettingsFactory.createConnectionProvider(SettingsFactory.java:414)
      at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:62)
      at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:2009)
      at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1292)
      at test.Test.main(Test.java:15)
  Caused by: java.lang.ClassNotFoundException: org.apache.derby.jdbc.ClientDriver
      at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
      at java.security.AccessController.doPrivileged(Native Method)
      at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
      at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
      at java.lang.Class.forName0(Native Method)
      at java.lang.Class.forName(Class.java:169)
      at org.hibernate.util.ReflectHelper.classForName(ReflectHelper.java:100)
      at org.hibernate.connection.DriverManagerConnectionProvider.configure(DriverManagerConnectionProvider.java:61)
      ... 7 more
  Java Result: 1
  </code></pre>
  
  <p>Please help me resolve these exceptions</p>
  
  <p>I donot know why I am getting this exception</p>
  
  <pre><code>java.lang.ClassNotFoundException: org.apache.derby.jdbc.ClientDriver
  </code></pre>
  
  <p>Where as my hibernate.cfg.xml is set for MySQL database</p>
  
  <hr>
  
  <p>EDIT:</p>
  
  <p>Location of files,</p>
  
  <p>It is located at root of .java files</p>
  
  <p>C:.....NetBeansProjects\test\src</p>
  
  <p>That is src folder of my project.</p>
  
  <p>and java files are in </p>
  
  <p>C:.....NetBeansProjects\test\src\test</p>
  
  <p>I have tried by coping my hibernate.cfg.xml file to some other locations as well.</p>