Javatpoint Logo

Exception in thread "main" java.lang.NullPointerException

By: revath*** On: Wed Apr 05 16:07:23 IST 2017     Question Reputation0 Answer Reputation0 Quiz Belt Series Points0  0Blank User
As I Am getting error while running hibernate sample application with store data class.
This is following code here..
package com.javatpoint.mypackage;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.Transaction;
import org.hibernate.cfg.Configuration;
public class StoreData {
public static void main(String[] args) {
Configuration cfg=new Configuration();
cfg.configure("Hiberanate.cfg.xml");
SessionFactory factory=cfg.buildSessionFactory();
Session session=factory.openSession();
Transaction t=session.beginTransaction();
Employee e1=new Employee();
e1.setId(115);
e1.setFirstName("Revathi");
e1.setLastName("Vajravel");
session.persist(e1);
t.commit();
session.close();
System.out.println("successfully saved");

}
}
error occured under the line (cfg.configure("Hiberanate.cfg.xml");) plz tell me the solution..
Up0Down