The reason the Android system accesses items under its own Tomcat server cannot be accessed

Source: Internet
Author: User

Today I do a download function of Android, using the Tomcat on my machine to do the server, on Tomcat download things, but the Android system is always prompt error said cannot connect to my tomcat, but I clearly started the Tomcat service Ah, And the code I also checked the good changed, no mistake ah, this is to give me depressed bad, I believe many beginners will have such experience, hehe ... Really overwhelmed, quite let people depressed, I here and you share a solution, hehe ... Find me this article and you will find a solution.
The reason is actually very simple,
Start my link to write is: http://127.0.0.1:8090/project name/file name, people who have been in Java development will think this is written, because it is this machine ah, 127.0.0.1 is the machine, or with localhost, which is the same, If you have a local area network, then LAN-native IP will not have this problem, the key is that we are using the home of their own, local area network, this error will occur.
02-18 14:47:47.957:warn/system.err (406): java.net.ConnectException:/127.0.0.1:8090-connection refused
02-18 14:47:47.976:warn/system.err (406): At Org.apache.harmony.luni.net.PlainSocketImpl.connect ( plainsocketimpl.java:237)
02-18 14:47:47.976:warn/system.err (406): At Org.apache.harmony.luni.net.PlainSocketImpl.connect ( plainsocketimpl.java:521)
02-18 14:47:47.976:warn/system.err (406): at Java.net.Socket.connect (socket.java:1019)
02-18 14:47:47.976:warn/system.err (406): at Org.apache.harmony.luni.internal.net.www.protocol.http.HttpConnection .<init> (httpconnection.java:67)
02-18 14:47:47.989:warn/system.err (406): at Org.apache.harmony.luni.internal.net.www.protocol.http.httpconnectionmanager$connectionpool.gethttpconnection ( httpconnectionmanager.java:151)
02-18 14:47:47.989:warn/system.err (406): at Org.apache.harmony.luni.internal.net.www.protocol.http.HttpConnectionManager.getConnection ( httpconnectionmanager.java:73)
02-18 14:47:47.997:warn/system.err (406): at Org.apache.harmony.luni.internal.net.www.protocol.http.HttpURLConnection.getHTTPConnection ( httpurlconnection.java:826)
02-18 14:47:47.997:warn/system.err (406): at Org.apache.harmony.luni.internal.net.www.protocol.http.HttpURLConnection.connect (httpurlconnection.java:812)
02-18 14:47:47.997:warn/system.err (406): at Org.apache.harmony.luni.internal.net.www.protocol.http.HttpURLConnection.getInputStream (Httpurlconnection.java : 1054)
02-18 14:47:47.997:warn/system.err (406): at Com.down.HttpDownloader.download (httpdownloader.java:38)
02-18 14:47:47.997:warn/system.err (406): at Com.mp3.Mp3ListActivity.downloadXml (mp3listactivity.java:50)
02-18 14:47:47.997:warn/system.err (406): At com.mp3.Mp3ListActivity.onOptionsItemSelected (mp3listactivity.java:38 )
This is part of my error message, the red part of the obvious, not even the address, and later checked, the original in Android 10.0.2.2 address is the mapping of the native.
This is the key, so we just need to change the IP to this address, no problem. Oh...

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.