title: Hibernate 4 javax/transaction/SystemException error
body: <p>I am trying to get Hibernate 4.3 to work with my MySQL database. I am already able to use the Hibernate Code Generation tool in Eclipse and I am also able to connect to the database using the Hibernate Configurations tool.</p>
  
  <p>However when I try to run code in my Main class that queries the database I get the following error:</p>
  
  <pre><code>Exception in thread "main" java.lang.NoClassDefFoundError: javax/transaction/SystemException
  at java.lang.Class.forName0(Native Method)
  at java.lang.Class.forName(Unknown Source)
  at org.jboss.logging.Logger.getMessageLogger(Logger.java:2248)
  at org.jboss.logging.Logger.getMessageLogger(Logger.java:2214)
  at org.hibernate.cfg.Configuration.&lt;clinit&gt;(Configuration.java:184)
  at be.comp.permanenties.HibernateUtil.&lt;clinit&gt;(HibernateUtil.java:15)
  at be.comp.dao.balie.ZitdagenDAOMySQL.findByMaCode(ZitdagenDAOMySQL.java:31)
  at be.comp.permanenties.Main.main(Main.java:19)
  Caused by: java.lang.ClassNotFoundException: javax.transaction.SystemException
  at java.net.URLClassLoader$1.run(Unknown Source)
  at java.net.URLClassLoader$1.run(Unknown Source)
  at java.security.AccessController.doPrivileged(Native Method)
  at java.net.URLClassLoader.findClass(Unknown Source)
  at java.lang.ClassLoader.loadClass(Unknown Source)
  at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
  at java.lang.ClassLoader.loadClass(Unknown Source)
  ... 8 more
  </code></pre>
  
  <p>The code in my HibernateUtil.java file is:</p>
  
  <pre><code>import org.apache.commons.lang3.SystemUtils;
  import org.hibernate.HibernateException;
  import org.hibernate.SessionFactory;
  import org.hibernate.cfg.Configuration;
  import org.hibernate.service.ServiceRegistry;
  import org.hibernate.service.ServiceRegistryBuilder;
  
  public class HibernateUtil {
  
  private static final SessionFactory sessionFactoryBalie = new Configuration().configure("mysql_balie.cfg.xml").buildSessionFactory();
  
  public static SessionFactory getSessionFactoryBalie() {
      return sessionFactoryBalie;
  }
  
  }
  </code></pre>
  
  <p>The mysq_balie.cfg.xml file looks like:</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;property name="hibernate.connection.driver_class"&gt;com.mysql.jdbc.Driver&lt;/property&gt;
  
      &lt;!-- Development --&gt;
  
      &lt;property name="hibernate.connection.url"&gt;jdbc:mysql://127.0.0.1:3306/balie?autoReconnect=true&amp;amp;useUnicode=true&amp;amp;characterEncoding=iso-8859-1&lt;/property&gt;
      &lt;property name="hibernate.connection.username"&gt;username&lt;/property&gt;
      &lt;property name="hibernate.connection.password"&gt;password&lt;/property&gt;
      &lt;property name="hibernate.default_catalog"&gt;db&lt;/property&gt;
  
      &lt;property name="hibernate.dialect"&gt;org.hibernate.dialect.MySQL5Dialect&lt;/property&gt;
  
      &lt;!-- JDBC connection pool (use the built-in) --&gt;
      &lt;property name="hibernate.connection.pool_size"&gt;1&lt;/property&gt;
  
      &lt;!-- Enable Hibernate's automatic session context management --&gt;
      &lt;property name="hibernate.current_session_context_class"&gt;thread&lt;/property&gt;
      &lt;!-- &lt;property name="hibernate.current_session_context_class"&gt;org.hibernate.context.internal.ThreadLocalSessionContext&lt;/property&gt;--&gt;
  
      &lt;!-- Disable the second-level cache --&gt;
      &lt;property name="hibernate.cache.provider_class"&gt;org.hibernate.cache.NoCacheProvider&lt;/property&gt;
  
      &lt;!-- Echo all executed SQL to stdout --&gt;
      &lt;property name="hibernate.show_sql"&gt;true&lt;/property&gt;
  
      &lt;!-- Drop and re-create the database schema on startup --&gt;
      &lt;property name="hibernate.hbm2ddl.auto"&gt;update&lt;/property&gt;
  
      &lt;!-- List of XML mapping files --&gt;
      &lt;mapping resource="be/comp/model/balie/Zitdagen.hbm.xml"/&gt;
  &lt;/session-factory&gt;
  </code></pre>
  
  <p></p>
  
  <p>I am unable to figure out where the error might be. All help is welcome. Thanks.</p>