Hi sridevi,
I think your login code related to net weaver gateway login type. I mean you are using some properties of them .. So that when logon failed, it is asking again credentials of gateway( i.e. HANA server credentials) as normal login failed on XS engine. Try to use different code so that it won't ask again.
Once check the application output on eclipse using Tomcat server you can find the difference.
Regards,
Surendra.