After the green version of Tomcat decompression, enter http://localhost:8080/in the browser (the default port is 8080, can be modified in the configuration file), the following page appears:
This page from:/apache-tomcat-8.0.26/webapps/root/index.jsp
In Java EE application Development, we typically use localhost or 127.0.0.1来 to access the native Web service. If the same address is used in the Android emulator
Access, the Android emulator will not have normal access to the services deployed on Tomcat. Imagine:Android is the Linux kernel, Android itself is
an operating system ; So at this point, the localhost or 127.0.0.1 that we entered in the emulator's browser represents the Android emulator (Android virtual machine), and
It's not your computer. This is why you will be quoted as "Page not found" when you use localhost in the simulator.
On the Android operating system, map the address of the local computer to 10.0.2.2; Therefore, you only need to change the original localhost or 127.0.0.1 to 10.0.2.2, you can
To access Tomcat on the emulator and the resources and services deployed on Tomcat. Now we'll start Tomcat on the computer:
Now start the Android simulator (), open the emulator on the
browser, Then access: http://10.0.2.2:8080/, theoretically You can see the Tomcat cat. (ps:tomcat default service port is 8080)
However, the fact is that the results are as follows:
Conclusion: Both the official simulator and the hippocampus play simulator can be accessed via http://10.0.2.2:8080/ to the local tomcat server, but the night gods cannot access the local tomcat
server , the specific reason is not clear at the moment, so with the late-night Test of the small partners, change a simulator to try it.
Night God simulator access to local tomcat server test: Failed