为什么我的android连不上tomcat上的的serverlet

一开始我就测试了一下连不上。。我的问题是
基本地址:服务器ip地址:端口号/Web项目逻辑地址+目标页面(Servlet)的url-pattern
private String baseURL = "http://10.0.2.2:8080/test/AddMessage";
这个是我的的服务器的地址,,我尝试了多个ip地址,,有127.0.0.1 有localhost有实际的地址都不行

10-24 23:28:47.004: W/System.err(1919): org.apache.http.conn.HttpHostConnectException: Connection to http://10.0.2.2:8080 refused

我的连接语句。。是一个post请求,,

 

HttpEntity requestHttpEntity = new UrlEncodedFormEntity(
pairList);
// URL使用基本URL即可,其中不需要加参数
HttpPost httpPost = new HttpPost(baseURL);
// 将请求体内容加入请求中
httpPost.setEntity(requestHttpEntity);
// 需要客户端对象来发送请求
HttpClient httpClient = new DefaultHttpClient();
// 发送请求
HttpResponse response = httpClient.execute(httpPost);
// 显示响应
showResponseResult(response);

麻烦大神们给点意见!!

 

你可能感兴趣的:(为什么我的android连不上tomcat上的的serverlet)