title: Hibernate: Unable to load class declared in Hibernate configuration <mapping/> entry
body: <p>I am completely new in Hibernate and got such an stacktrace:</p>
  
  <pre><code>hql&gt; from TracksEntity 
  [2014-04-26 21:13:45] org.hibernate.MappingException: Unable to load class [ model.TracksEntity] declared in Hibernate configuration &lt;mapping/&gt; entry
  [2014-04-26 21:13:45] java.lang.ClassNotFoundException: model.TracksEntity
      at java.net.URLClassLoader$1.run(URLClassLoader.java:372)
      at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
      at java.security.AccessController.doPrivileged(Native Method)
      at java.net.URLClassLoader.findClass(URLClassLoader.java:360)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
      at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
      at java.lang.Class.forName0(Native Method)
      at java.lang.Class.forName(Class.java:259)
      at org.hibernate.internal.util.ReflectHelper.classForName(ReflectHelper.java:192)
      at org.hibernate.cfg.Configuration.parseMappingElement(Configuration.java:2188)
      at org.hibernate.cfg.Configuration.parseSessionFactory(Configuration.java:2139)
      at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:2119)
      at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:2072)
      at org.hibernate.cfg.Configuration.configure(Configuration.java:2045)
      at com.intellij.hibernate.remote.impl.RemoteConfigurationImpl.configure(RemoteConfigurationImpl.java:57)
  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:483)
      at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:323)
      at sun.rmi.transport.Transport$1.run(Transport.java:178)
      at sun.rmi.transport.Transport$1.run(Transport.java:175)
      at java.security.AccessController.doPrivileged(Native Method)
      at sun.rmi.transport.Transport.serviceCall(Transport.java:174)
      at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:557)
      at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:812)
      at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:671)
      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
      at java.lang.Thread.run(Thread.java:744)
  </code></pre>
  
  <p>My hibernate.cfg.xml and TracksEntity.java was automatically generated by Intellij Idea:</p>
  
  <p>TracksEntity.java:
      package model;</p>
  
  <pre><code>import javax.persistence.*;
  
  @Entity
  @Table(name = "TRACKS", schema = "APP", catalog = "")
  public class TracksEntity {
      private int id;
      private String artist;
      private int duration;
      private String title;
      private String url;
  
      @Id
      @Column(name = "ID")
      public int getId () {
          return id;
      }
  
      public void setId (int id) {
          this.id = id;
      }
  
      @Basic
      @Column(name = "ARTIST")
      public String getArtist () {
          return artist;
      }
  
      public void setArtist (String artist) {
          this.artist = artist;
      }
  
      @Basic
      @Column(name = "DURATION")
      public int getDuration () {
          return duration;
      }
  
      public void setDuration (int duration) {
          this.duration = duration;
      }
  
      @Basic
      @Column(name = "TITLE")
      public String getTitle () {
          return title;
      }
  
      public void setTitle (String title) {
          this.title = title;
      }
  
      @Basic
      @Column(name = "URL")
      public String getUrl () {
          return url;
      }
  
      public void setUrl (String url) {
          this.url = url;
      }
  
      @Override
      public boolean equals (Object o) {
          if (this == o) return true;
          if (o == null || getClass() != o.getClass()) return false;
  
          TracksEntity that = (TracksEntity) o;
  
          if (duration != that.duration) return false;
          if (id != that.id) return false;
          if (artist != null ? !artist.equals(that.artist) : that.artist != null) return false;
          if (title != null ? !title.equals(that.title) : that.title != null) return false;
          if (url != null ? !url.equals(that.url) : that.url != null) return false;
  
          return true;
      }
  
      @Override
      public int hashCode () {
          int result = id;
          result = 31 * result + (artist != null ? artist.hashCode() : 0);
          result = 31 * result + duration;
          result = 31 * result + (title != null ? title.hashCode() : 0);
          result = 31 * result + (url != null ? url.hashCode() : 0);
          return result;
      }
  }
  </code></pre>
  
  <p>hibernate.cfg.xml:</p>
  
  <pre><code>&lt;?xml version='1.0' encoding='utf-8'?&gt;
  &lt;!DOCTYPE hibernate-configuration PUBLIC
      "-//Hibernate/Hibernate Configuration DTD//EN"
      "http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd"&gt;
  &lt;hibernate-configuration&gt;
      &lt;session-factory&gt;
          &lt;property name="connection.url"&gt;jdbc:derby:/home/zimy/Documents/drbdb;create=true;create=true&lt;/property&gt;
          &lt;property name="connection.driver_class"&gt;org.apache.derby.jdbc.EmbeddedDriver&lt;/property&gt;
          &lt;mapping class="model.TracksEntity"/&gt;
      &lt;/session-factory&gt;
  &lt;/hibernate-configuration&gt;
  </code></pre>
  
  <p>What the problem is? I see that it is not found, but why?</p>