So I tried with different options - earlier I was putting the hibernate.cfg.xml in the app folder only. Now I have moved it to classes folder. I dun know why is that? I was following a youtube video to create a hibernate project, earlier by not putting it in the classes folder.
"app folder", what do you mean by that? If you are deploying a web application you need to include the Hibernate configuration file on the classpath. If you are using the default configuration this need to be at the root of your classpath. Web applications have specified folders* that are included in the classpath. If you don't use these it will be up to how you configure your servlet container's classloader to pick dependent files up.
However, an IncompatibleClassChangeError is not what I would expect if you had put hibernate.cfg.xml in the wrong place. An erro like that usually only happens as the result of hot deployment.
*(If this is something you were not aware of I would go through the servlet parts of
this before trying anything more with Hibernate)