Exception in thread “main” org.hibernate.HibernateException: Error accessing stax stream

家住魔仙堡 提交于 2019-12-08 15:17:32
v.ladynev

You have illegal symbols in hibernate.cfg.xml, probably spaces. Refer this for details

Error: The processing instruction target matching “[xX][mM][lL]” is not allowed.

Here problem is hibernate could not locate your hibernate configuration file.

Hibernate default locate your Hibernate Configuration file in your resource folder.

If your Hibernate.cfg.xml file in your resource folder then check below line must be exist in your HibernateUtil class(There you configured hibernate SessionFactory).

sessionFactory = new Configuration().configure().buildSessionFactory();

If your Hibernate.cfg.xml file in differnt location the add below line in your HibernateUtil class.

sessionFactory = new Configuration().configure("/Path of your configuration file").buildSessionFactory();

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!