2 lp1052843207 lp1052843207 于 2013.12.10 23:21 提问

java.lang.ExceptionInInitializerError

public class HibernateUtil {
private static final SessionFactory sessionFactory;
private static final ServiceRegistry serviceRegistry;

private HibernateUtil() {
}

static {
    Configuration configuration = new Configuration();
    configuration.configure();
    serviceRegistry = new ServiceRegistryBuilder().applySettings(configuration.getProperties()).buildServiceRegistry();
    sessionFactory = configuration.buildSessionFactory(serviceRegistry);
}

public static SessionFactory getSessionFactory() {
    return sessionFactory;
}


public static Session getSession() {
    return getSessionFactory().getCurrentSession();
}

}
调用getSession就会报错:java.lang.ExceptionInInitializerError
各位大侠怎么解决???

Csdn user default icon
上传中...
上传图片
插入图片
准确详细的回答,更有利于被提问者采纳,从而获得C币。复制、灌水、广告等回答会被删除,是时候展现真正的技术了!