在我的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)