hibernateFactory中的ExceptionInInitializerError

时间:2019-07-02 15:34:18

标签: sessionfactory hibernate-5.x hibernate-session hibernate-5

在我的HibernateFactory类中,当我尝试使用以下代码获取sessionFactory对象时,我正在获取ExceptionInInitializerError

Configuration configuration= new Configuration();
ServiceRegistry serviceRegistryObj = new StandardServiceRegistryBuilder().applySettings(configuration.getProperties()).build();

我在下一行出现错误

sessionFactoryObj = configuration.buildSessionFactory(serviceRegistryObj);

错误是

Error: java.lang.ExceptionInInitializerError com.abc.xyz.conf.HibernateFactory.getSessionFactory(HibernateFactory.java:51) com.abc.xyz.service.UserService.getUser(UserService.java:155) com.abc.xyz.service.UserService.authenticate(UserService.java:378) com.abc.xyz.controller.UserController.authenticate(UserController.java:297) java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 

0 个答案:

没有答案