@Rahulm6 It sounds like you are having issues with "localhost" and "127.0.0.1" networking. You should avoid using those values in HDP services. Aim to use the external IP and an FQDN to avoid the issues with localhost networking. For example you should use the sandbox-hdp.hortonworks.com address with your app port.
Also make sure you have the right IP address for the sandbox per these instructions:
https://www.cloudera.com/tutorials/learning-the-ropes-of-the-hdp-sandbox.html#environment-setup
If this answer resolves your issue or allows you to move forward, please choose to ACCEPT this solution and close this topic. If you have further dialogue on this topic please comment here or feel free to private message me. If you have new questions related to your Use Case please create separate topic and feel free to tag me in your post.
Thanks,
Steven @ DFHZ