java.lang.NoClassDefFoundError: Could not initialize class itd.pabwe.contactbook.entities.HibernateUtil

I keep getting this error eventhough I already change the HibernateUtil.java file. How to solve this error?

Here is my HibernatUtil.java code.

import org.hibernate.SessionFactory;
import org.hibernate.boot.registry.StandardServiceRegistryBuilder;
import org.hibernate.cfg.Configuration;
import org.hibernate.service.ServiceRegistry;

public class HibernateUtil {

private static SessionFactory sessionFactory;

/*
static {
    try {
        // Create the SessionFactory from standard (hibernate.cfg.xml) 
        // config file.
        factory = new AnnotationConfiguration().configure().buildSessionFactory();
        Configuration configuration = new Configuration().configure();
        StandardServiceRegistryBuilder builder = new StandardServiceRegistryBuilder().applySettings(configuration.getProperties());
        SessionFactory factory = configuration.buildSessionFactory(builder.build());

    } catch (Throwable ex) {
        // Log the exception. 
        System.err.println("Initial SessionFactory creation failed." + ex);
        throw new ExceptionInInitializerError(ex);
    }
}
*/
public static SessionFactory getSessionFactory() {
    if(sessionFactory==null){
        //loads configuration and mappings
        Configuration configuration = new Configuration().configure();
        ServiceRegistry serviceRegistry = new StandardServiceRegistryBuilder().applySettings(configuration.getProperties()).build();

        //build a session factory from the service registry
        sessionFactory = configuration.buildSessionFactory(serviceRegistry);
    }

    return sessionFactory;

}

}

Here I’m using Hibernate 4.3.x. Please help me