Thanks Stephen... but here i dont have much choice due to various reason related to ERP build and deployment. But i really appreciate your suggestion.
Well, I don't believe that your current solution was ever portable (frankly, I'm surprised that it worked at all), so at some point you're going to have to address it properly.
Right now the simple solution we have done is like this
final String filePath = Thread.currentThread().getContextClassLoader().getResource("hibernate.cfg.xml").getPath();
final File mappingsJar = new File(filePath.substring(0, filePath.indexOf("/lib/")) + "/lib/mappings.jar");
This works fine but i want some direct way to get the path upto /lib at least