title: Configuration class not found for JAR with Hibernate dependencies
body: <p>I'm trying to use hibernate in a sample, but cannot run it. Here is ma main class:</p>
  
  <pre><code>public class Main {
      public static void main(String[] args) {
          SessionFactory factory;
  
          try {
              Configuration configuration = new Configuration();
              configuration.configure("hibernate.cfg.xml");
              ServiceRegistry serviceRegistry = new ServiceRegistryBuilder().applySettings(configuration.getProperties()).buildServiceRegistry();
              factory = configuration.buildSessionFactory(serviceRegistry);
          } catch (Throwable ex) {
              System.err.println("Failed to create sessionFactory object." + ex);
              throw new ExceptionInInitializerError(ex);
          }
  
          System.out.println("**Example : Hibernate 4 SessionFactory**");
          System.out.println("----------------------------------------");
          Session session = factory.openSession();
          Transaction transaction = null;
  
          try {
              transaction = session.beginTransaction();
              transaction.commit();
          } catch (HibernateException e) {
              if (transaction != null)
                  transaction.rollback();
              e.printStackTrace();
          } finally {
              session.close();
          }
      }
  }
  </code></pre>
  
  <p>I've build it with</p>
  
  <pre><code>mvn clean install assembly:single
  </code></pre>
  
  <p>but when I've runned JAR, I've got:</p>
  
  <pre><code>Exception in thread "main" java.lang.ExceptionInInitializerError
      at Main.main(Main.java:28)
  Caused by: java.lang.NoClassDefFoundError: org/hibernate/cfg/Configuration
      at Main.main(Main.java:21)
  Caused by: java.lang.ClassNotFoundException: org.hibernate.cfg.Configuration
      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)
      ... 1 more
  </code></pre>
  
  <p>My POM:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;project xmlns="http://maven.apache.org/POM/4.0.0"
           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
           xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"&gt;
      &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
  
      &lt;groupId&gt;hibernate-test&lt;/groupId&gt;
      &lt;artifactId&gt;hibernate-test&lt;/artifactId&gt;
      &lt;version&gt;1.0&lt;/version&gt;
  
      &lt;properties&gt;
          &lt;hibernate.version&gt;4.1.3.Final&lt;/hibernate.version&gt;
      &lt;/properties&gt;
  
      &lt;dependencies&gt;
  
          &lt;dependency&gt;
              &lt;groupId&gt;org.hibernate&lt;/groupId&gt;
              &lt;artifactId&gt;hibernate-core&lt;/artifactId&gt;
              &lt;version&gt;${hibernate.version}&lt;/version&gt;
          &lt;/dependency&gt;
  
          &lt;dependency&gt;
              &lt;groupId&gt;org.hibernate&lt;/groupId&gt;
              &lt;artifactId&gt;hibernate-entitymanager&lt;/artifactId&gt;
              &lt;version&gt;${hibernate.version}&lt;/version&gt;
          &lt;/dependency&gt;
  
          &lt;dependency&gt;
              &lt;groupId&gt;org.hsqldb&lt;/groupId&gt;
              &lt;artifactId&gt;hsqldb&lt;/artifactId&gt;
              &lt;version&gt;2.2.8&lt;/version&gt;
          &lt;/dependency&gt;
  
      &lt;/dependencies&gt;
  
      &lt;build&gt;
          &lt;plugins&gt;
              &lt;plugin&gt;
                  &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
                  &lt;artifactId&gt;maven-jar-plugin&lt;/artifactId&gt;
                  &lt;configuration&gt;
                      &lt;archive&gt;
                          &lt;manifest&gt;
                              &lt;addClasspath&gt;true&lt;/addClasspath&gt;
                              &lt;mainClass&gt;Main&lt;/mainClass&gt;
                          &lt;/manifest&gt;
                      &lt;/archive&gt;
                  &lt;/configuration&gt;
              &lt;/plugin&gt;
  
              &lt;plugin&gt;
                  &lt;artifactId&gt;maven-assembly-plugin&lt;/artifactId&gt;
                  &lt;configuration&gt;
                      &lt;archive&gt;
                          &lt;manifest&gt;
                              &lt;mainClass&gt;Main&lt;/mainClass&gt;
                          &lt;/manifest&gt;
                      &lt;/archive&gt;
                      &lt;descriptorRefs&gt;
                          &lt;descriptorRef&gt;jar-with-dependencies&lt;/descriptorRef&gt;
                      &lt;/descriptorRefs&gt;
                  &lt;/configuration&gt;
              &lt;/plugin&gt;
          &lt;/plugins&gt;
      &lt;/build&gt;
  
  &lt;/project&gt;
  </code></pre>
  
  <p>What I'm doing wrong?</p>
  
  <p><em>EDIT</em>: I've opened result JAR with JD-Gui and discovered that there is Configuration class in my JAR.</p>