title: Integrate Hibernate into JSF project with Glassfish server
body: <p>I am using GlassFish server in Eclipse and  am trying to intergerate the <code>hibernate-release-5.1.0.Final</code> into the JSF project. I have tried several steps but without seccuss. </p>
  
  <ul>
  <li>I have Placed the Hibernate Jars inside the GlassFisch directrory <code>glassfish4\bin</code> and restarted the server.</li>
  <li>I placed them inside the following foloder <code>glassfish4\glassfish\bin</code> and restarted the GlassFisch server.</li>
  <li>I placed the Hibernate jars inside the WEB-INF/lib</li>
  <li>I added this part <code>.addResource("/resources/person.hbm.xml")</code> to the <code>CreatePersonDemo</code> class.</li>
  <li>I replaced the <code>jboss-logging.jar</code> inside the <code>glassfish4\glassfish\modules</code> directory with <code>jboss-logging-3.3.0.Final.jar</code></li>
  </ul>
  
  <p><strong>CreatePersonDemo</strong></p>
  
  <pre><code>package com.backing;
  
  import org.hibernate.Session;
  import org.hibernate.SessionFactory;
  import org.hibernate.cfg.Configuration;
  
  import com.model.Person;
  
  
  
  public class CreatePersonDemo {
  
      public static void main(String[] args) {
          // create session factory.
  //      SessionFactory factory = new Configuration()
  //              .configure("/resources/hibernate.cfg.xml")
  //              .addAnnotatedClass(Person.class)
  //              .buildSessionFactory();
          SessionFactory factory = new Configuration().configure("/resources/hibernate.cfg.xml")
                  .addResource("/resources/person.hbm.xml")
                  .addAnnotatedClass(Person.class)
                  .buildSessionFactory();
  
          // create a session.
          Session session = factory.getCurrentSession();
          System.out.println("CreateStudentDemo");
  
      }
  }
  </code></pre>
  
  <p><strong>hibernate.cfg.xml</strong></p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;!DOCTYPE hibernate-configuration SYSTEM 
  "http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd"&gt;
  &lt;hibernate-configuration&gt;
      &lt;session-factory&gt;
          &lt;property name="connection.driver_class"&gt;com.mysql.jdbc.Driver&lt;/property&gt;
          &lt;property name="connection.url"&gt;jdbc:mysql://localhost:3306/GMapsYahooMeshup&lt;/property&gt;
          &lt;property name="connection.username"&gt;root&lt;/property&gt;
          &lt;property name="connection.password"&gt;&lt;/property&gt;
  
          &lt;property name="connection.pool_size"&gt;1&lt;/property&gt;
          &lt;property name="dialect"&gt;org.hibernate.dialect.MySQLDialect&lt;/property&gt;
          &lt;property name="current_session_context_class"&gt;thread&lt;/property&gt;
          &lt;property name="cache.provider_class"&gt;org.hibernate.cache.NoCacheProvider&lt;/property&gt;
          &lt;property name="show_sql"&gt;true&lt;/property&gt;
          &lt;property name="current_session_context_class"&gt;thread&lt;/property&gt;
          &lt;mapping resource="resources/person.hbm.xml" /&gt; 
          &lt;!-- &lt;mapping class ="com.Model.Person" /&gt; --&gt;
  
      &lt;/session-factory&gt;
  &lt;/hibernate-configuration&gt;
  </code></pre>
  
  <p><strong>person.hbm.xml</strong></p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;!DOCTYPE hibernate-mapping PUBLIC 
   "-//Hibernate/Hibernate Mapping DTD//EN"
   "http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd"&gt;
  
  &lt;hibernate-mapping&gt;
      &lt;class name="Person" table="person"&gt;
          &lt;meta attribute="class-description"&gt;
              This class contains the person detail.
          &lt;/meta&gt;
          &lt;id name="id" type="int" column="id"&gt;
              &lt;generator class="native" /&gt;
          &lt;/id&gt;
          &lt;property name="full_name" column="full_name" type="string" /&gt;
          &lt;property name="email " column="email " type="string" /&gt;
          &lt;property name="location" column="location" type="string" /&gt;
          &lt;property name="pwd" column="pwd" type="string" /&gt;
      &lt;/class&gt;
  &lt;/hibernate-mapping&gt;
  </code></pre>
  
  <p><strong>Person.Java</strong></p>
  
  <pre><code>package com.model;   
  
  public class Person {
      private int id;
      private String full_name;
      private String email;
      private String location;
      private String pwd;
      public Person(int id, String full_name, String email, String location, String pwd) {
          super();
          this.id = id;
          this.full_name = full_name;
          this.email = email;
          this.location = location;
          this.pwd = pwd;
      }
      public int getId() {
          return id;
      }
      public void setId(int id) {
          this.id = id;
      }
      public String getFull_name() {
          return full_name;
      }
      public void setFull_name(String full_name) {
          this.full_name = full_name;
      }
      public String getEmail() {
          return email;
      }
      public void setEmail(String email) {
          this.email = email;
      }
      public String getLocation() {
          return location;
      }
      public void setLocation(String location) {
          this.location = location;
      }
      public String getPwd() {
          return pwd;
      }
      public void setPwd(String pwd) {
          this.pwd = pwd;
      }
  }
  </code></pre>
  
  <p><strong>Error</strong></p>
  
  <pre><code>org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl buildCreator
  INFO: HHH10001001: Connection properties: {user=root, password=****}
  Jul 17, 2016 10:24:52 AM org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl buildCreator
  INFO: HHH10001003: Autocommit mode: false
  Exception in thread "main" java.lang.NoSuchMethodError: org.hibernate.internal.CoreMessageLogger.debugf(Ljava/lang/String;I)V
      at org.hibernate.engine.jdbc.connections.internal.PooledConnections.&lt;init&gt;(PooledConnections.java:34)
      at org.hibernate.engine.jdbc.connections.internal.PooledConnections.&lt;init&gt;(PooledConnections.java:19)
      at org.hibernate.engine.jdbc.connections.internal.PooledConnections$Builder.build(PooledConnections.java:138)
      at org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl.buildPool(DriverManagerConnectionProviderImpl.java:110)
      at org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl.configure(DriverManagerConnectionProviderImpl.java:74)
      at org.hibernate.boot.registry.internal.StandardServiceRegistryImpl.configureService(StandardServiceRegistryImpl.java:94)
      at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:217)
      at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:189)
      at org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator.buildJdbcConnectionAccess(JdbcEnvironmentInitiator.java:145)
      at org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator.initiateService(JdbcEnvironmentInitiator.java:66)
      at org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator.initiateService(JdbcEnvironmentInitiator.java:35)
      at org.hibernate.boot.registry.internal.StandardServiceRegistryImpl.initiateService(StandardServiceRegistryImpl.java:88)
      at org.hibernate.service.internal.AbstractServiceRegistryImpl.createService(AbstractServiceRegistryImpl.java:234)
      at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:208)
      at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:189)
      at org.hibernate.engine.jdbc.internal.JdbcServicesImpl.configure(JdbcServicesImpl.java:51)
      at org.hibernate.boot.registry.internal.StandardServiceRegistryImpl.configureService(StandardServiceRegistryImpl.java:94)
      at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:217)
      at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:189)
      at org.hibernate.boot.model.process.spi.MetadataBuildingProcess.handleTypes(MetadataBuildingProcess.java:352)
      at org.hibernate.boot.model.process.spi.MetadataBuildingProcess.complete(MetadataBuildingProcess.java:111)
      at org.hibernate.boot.model.process.spi.MetadataBuildingProcess.build(MetadataBuildingProcess.java:83)
      at org.hibernate.boot.internal.MetadataBuilderImpl.build(MetadataBuilderImpl.java:418)
      at org.hibernate.boot.internal.MetadataBuilderImpl.build(MetadataBuilderImpl.java:87)
      at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:692)
      at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:724)
      at com.backing.CreatePersonDemo.main(CreatePersonDemo.java:22)
  </code></pre>
  
  <p><strong>Project structure</strong></p>
  
  <p><a href="https://i.stack.imgur.com/jY3cu.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/jY3cu.png" alt="enter image description here"></a></p>