Hibernate: javax.naming.NoInitialContextException (Component Mapping via Annotations)

I guess it's caused by the fact that you specified name attribute in <session-factory>, therefore Hibernate tries to bind SessionFactory to JNDI under that name, but JNDI is not available in your environment. So, remove name attribute.


Just remove the name attribute even if its empty from your session-factory mapping [hibernate.cfc.xml]


To fix your error, you must delete the name attribute in the SessionFactory node.

enter image description here