But only one of them is getting invoked when we run the application in the browser. For the other one (in this case B application) I am getting 404 error?
Do you know how we can make both the applications running successfully in the browser? If I use a separate tomcat instance for both applications then it is working fine.
Which I don’t want, I want to use a single tomcat instance in which 2 apps will be deployed & invoked successfully. Any ideas are welcome.
You should not define your Context elements in server.xml. That is very bad practice and has been discouraged by the Tomcat authors since about Tomcat3.
It's better to either make them individual files in TOMCAT_HOME/conf/Catalina/localhost or as META-INF/context.xml files in the WARs.
If you go the conf/Catalina/localhost route, note that the context path defined in the Context xml will be ignored and the actual context path will be derived from the name of the file containing the Context. So you'd have to name those files "A.xml" and "B.xml".
Your biggest problem, I think is that you attempted to define the webapps using the server.xml Host element when you should be using a Context element (but not in server.xml!) A Host can contain multiple Contexts, but you normally only have one Host, which by default would be named "localhost". It's what determines that the Context directory is conf/Catalina/localhost instead of conf/Catalina/xyz.
An IDE is no substitute for an Intelligent Developer.