title: Hibernate can't find org/hibernate/cfg/Configuration even though it is there
body: <p>For some strange reason, Hibernate doesn't want to find the cfg.Configuration class in the jar even though it is part of the .classpath. This is what my util class looks like </p>
  
  <pre><code>import org.hibernate.SessionFactory;
  import org.hibernate.cfg.Configuration;
  
  public class HibernateUtil
  {
      private static final SessionFactory sessionFactory = buildSessionFactory();
  
      private static SessionFactory buildSessionFactory()
      {
          try
          {
              // Create the SessionFactory from hibernate.cfg.xml
              return new Configuration().configure().buildSessionFactory();
          }
          catch (Throwable ex)
          {
              // Make sure you log the exception, as it might be swallowed
              System.err.println("Initial SessionFactory creation failed." + ex);
              throw new ExceptionInInitializerError(ex);
          }
      }
  
      public static SessionFactory getSessionFactory() 
      {
          return sessionFactory;
      }
  }
  </code></pre>
  
  <p>Eclipse is importing it just fine, but I still get this error:</p>
  
  <pre><code>java.lang.ClassNotFoundException: org.hibernate.cfg.Configuration
  at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1688)
  at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1533)
  at com.HibernateUtil.buildSessionFactory(HibernateUtil.java:14)
  at com.HibernateUtil.&lt;clinit&gt;(HibernateUtil.java:8)
  at com.helpers.DatabaseManager.getResults(DatabaseManager.java:68)
  at com.web.results.ResultsServlet.doPost(ResultsServlet.java:34)
  at com.web.results.ResultsServlet.doGet(ResultsServlet.java:21)
  at javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
  at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
  at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
  at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
  at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:224)
  at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:169)
  at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
  at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168)
  at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
  at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:928)
  at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
  at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
  at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:987)
  at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:539)
  at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:300)
  at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
  at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
  at java.lang.Thread.run(Unknown Source)
  </code></pre>
  
  <p>Again, I added all the required jars to the .classpath (I'm looking at them right now), so why isn't it finding it? </p>
  
  <p>Here's the config file in case you want it:</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://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd"&gt;
  &lt;hibernate-configuration&gt;
  &lt;session-factory&gt;
  
      &lt;!-- Database connection settings --&gt;
      &lt;property name="connection.driver_class"&gt;com.mysql.jdbc.Driver&lt;/property&gt;
      &lt;property name="connection.url"&gt;url-to-my-database&lt;/property&gt;
      &lt;property name="connection.username"&gt;user&lt;/property&gt;
      &lt;property name="connection.password"&gt;pppsss&lt;/property&gt;
  
      &lt;!-- JDBC connection pool (use the built-in) --&gt;
      &lt;property name="connection.pool_size"&gt;1&lt;/property&gt;
  
      &lt;!-- SQL dialect --&gt;
      &lt;!-- &lt;property name="dialect"&gt;org.hibernate.dialect.HSQLDialect&lt;/property&gt; --&gt;
  
      &lt;!-- Enable Hibernate's automatic session context management --&gt;
      &lt;property name="current_session_context_class"&gt;thread&lt;/property&gt;
  
      &lt;!-- Disable the second-level cache  --&gt;
      &lt;property name="cache.provider_class"&gt;org.hibernate.cache.NoCacheProvider&lt;/property&gt;
  
      &lt;!-- Echo all executed SQL to stdout --&gt;
      &lt;property name="show_sql"&gt;true&lt;/property&gt;
  
      &lt;!-- Drop and re-create the database schema on startup --&gt;
      &lt;property name="hbm2ddl.auto"&gt;update&lt;/property&gt;
  
      &lt;mapping resource="src/com/models/mappedBeans/TestTesult.hbm.xml"/&gt;
      &lt;mapping resource="src/com/models/results/Results.hbm.xml"/&gt;
  
  &lt;/session-factory&gt;
  </code></pre>
  
  <p></p>
  
  <p>Thanks in advanced. </p>
  
  <p>EDIT: Added more to the error. I think it might have something to do with the loadClass in WebAppClassLoader.</p>