This is my first time trying out Hibernate with Eclipse and the following are the things I did:

1. Created a Java Bean called Student.java which is as follows:

```
package com.jwt.hibernate;

public class Student {

private long id;
private String name;
private String degree;
private String roll;
private String phone;

public long getId() {
    return id;
}
public void setId(long id) {
    this.id = id;
}
public String getName() {
    return name;
}
public void setName(String name) {
    this.name = name;
}
public String getDegree() {
    return degree;
}
public void setDegree(String degree) {
    this.degree = degree;
}
public String getRoll() {
    return roll;
}
public void setRoll(String roll) {
    this.roll = roll;
}
public String getPhone() {
    return phone;
}
public void setPhone(String phone) {
    this.phone = phone;
}   

}

```
2. Created a mapping file, **Student.hbm.xml** as follows:

```
<hibernate-mapping>

<class name="com.jwt.hibernate.Student" table="student">

<id column="ID" name="id" type="long" />
<property column="name" name="name" type="string" />
<property column="degree" name="degree" type="string" />
<property column="roll" name="roll" type="string" />
<property column="phone" name="phone" type="string" />

</class>

</hibernate-mapping>

```

3. Created the hibernate configuration file, **hibernate.cfg.xml** as follows:

```
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd">

<hibernate-configuration>
<session-factory>

<property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property>
<property name="hibernate.connection.url">jdbc:mysql://localhost:3306/hibernatetutorial</property>
<property name="hibernate.connection.username">root</property>
<property name="hibernate.connection.password">root</property>
<property name="hibernate.dialect">org.hibernate.dialect.MySQLDialect</property>
<property name="show_sql">true</property>
<property name="format_sql">true</property>
<property name="hbm2ddl.auto">create </property>

<mapping resource="com/jwt/hibernate/Student.hbm.xml" />

</session-factory>
</hibernate-configuration>

```

4. Created the class **SimpleTest.java** which is as follows:

```
package com.jwt.hibernate;

 import org.hibernate.Session;
 import org.hibernate.SessionFactory;
 import org.hibernate.Transaction;
 import org.hibernate.cfg.Configuration;

 public class SimpleTest {

public static void main(String[] args) {
    Configuration cfg = new Configuration();
    cfg.configure("hibernate.cfg.xml");

    SessionFactory factory = cfg.buildSessionFactory();
    Session session = factory.openSession();

    Student student = new Student();
    student.setName("Mukesh");
    student.setRoll("101");
    student.setPhone("8888");
    student.setDegree("B.E");

    Transaction tx = session.beginTransaction();
    session.save(student);
    System.out.println("Object saved successfully.....!!");
    tx.commit();

    session.close();
    factory.close();
}

}

```

Now, when I try to run SimpleTest, I get the following error:

```
**INFO: HHH000412: Hibernate Core {4.3.7.Final}
Exception in thread "main" java.lang.ExceptionInInitializerError
    at org.hibernate.cfg.Configuration.reset(Configuration.java:326)
    at org.hibernate.cfg.Configuration.<init>(Configuration.java:291)
    at org.hibernate.cfg.Configuration.<init>(Configuration.java:295)
    at com.jwt.hibernate.SimpleTest.main(SimpleTest.java:11)
Caused by: java.lang.NullPointerException
    at org.hibernate.internal.util.ConfigHelper.getResourceAsStream(ConfigHelper.java:170)
    at org.hibernate.cfg.Environment.<clinit>(Environment.java:221)
    ... 4 more**

```

I double checked and made sure that all the configuration and jar files were added to the classpath. So that is not the problem. I would really appreciate some insights as to what may have caused this problem and inturn, how to solve it.

Thanks in advance!