org.apache.http.NoHttpResponseException: The target server failed to respond
最近将所有数据移动到新服务器,在所有链接中都出现此异常后,JSON
但它在浏览器中运行良好。在旧服务器上运行良好。我无法解决这个问题。有人知道请帮我解决这个问题。
编码
HttpClient client;
HttpResponse response;
HttpPost post;
InputStream in;
StringEntity se;
int resp_code;
client = new DefaultHttpClient();
post = new HttpPost(getString(R.string.base_url)+ "getCityList");
response = client.execute(post);
resp_code = response.getStatusLine().getStatusCode();
InputStream in = response.getEntity().getContent();
String a = json_res_class.convertStreamToString(in);
日志猫错误
09-10 11:55:22.369: W/System.err(2214): org.apache.http.NoHttpResponseException: The target server failed to respond
09-10 11:55:22.369: W/System.err(2214): at org.apache.http.impl.conn.DefaultResponseParser.parseHead(DefaultResponseParser.java:85)
09-10 11:55:22.381: W/System.err(2214): at org.apache.http.impl.io.AbstractMessageParser.parse(AbstractMessageParser.java:174)
09-10 11:55:22.381: W/System.err(2214): at org.apache.http.impl.AbstractHttpClientConnection.receiveResponseHeader(AbstractHttpClientConnection.java:180)
09-10 11:55:22.381: W/System.err(2214): at org.apache.http.impl.conn.DefaultClientConnection.receiveResponseHeader(DefaultClientConnection.java:235)
09-10 11:55:22.405: W/System.err(2214): at org.apache.http.impl.conn.AbstractClientConnAdapter.receiveResponseHeader(AbstractClientConnAdapter.java:259)
09-10 11:55:22.405: W/System.err(2214): at org.apache.http.protocol.HttpRequestExecutor.doReceiveResponse(HttpRequestExecutor.java:279)
09-10 11:55:22.409: W/System.err(2214): at org.apache.http.protocol.HttpRequestExecutor.execute(HttpRequestExecutor.java:121)
09-10 11:55:22.409: W/System.err(2214): at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:428)
09-10 11:55:22.413: W/System.err(2214): at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:555)
09-10 11:55:22.413: W/System.err(2214): at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:487)
09-10 11:55:22.421: W/System.err(2214): at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:465)