You would like to read the file present in folder WebContent
,you could try to use likes this
InputStream st= getServletContext().getResourceAsStream("/hibernate.cfg.xml");
But I recommend to put hibernate.cfg.xml
under src and your code
configuration.configure("hibernate.cfg.xml");
will be OK.