java.net.ConnectException:无法连接到localhost/127.0.0.1(端口8080):连接失败:ECONNREFUSED….(代号一个应用程序) [英] java.net.ConnectException: fail to connect to localhost/127.0.0.1(port 8080): connect failed:ECONNREFUSED….(Codename One App)

查看:2128
本文介绍了java.net.ConnectException:无法连接到localhost/127.0.0.1(端口8080):连接失败:ECONNREFUSED….(代号一个应用程序)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

构建android应用程序后,我扫描了生成的QRcode并将其成功安装在galaxy s4上.但是,当我尝试使用该应用进行搜索时,出现以下异常:

After build android application , I scanned the generated QRcode and install the application on galaxy s4 successfully. But when I try to do some search using the app I got the following exception:

 "java.net.ConnectException: fail to connect to localhost/127.0.0.1(port 8080): connect failed:ECONNREFUSED…." 

请检查所附图片以获取更多清晰度.

Please check the attached picture for more clarity.

该应用程序可在模拟器上正常运行.我关闭了系统的防火墙,但不能解决问题. 请问我该如何解决这个问题?

The app works correctly on simulator. I OFF the firewall of my system but that doesn't solve the issue. Please how can I solve this problem?

此问题适用于: NetBeans 8.0.2, GlassFish Server 4.1, Windows 7的, 设备:三星Galaxy S4

This issue applies to: NetBeans 8.0.2, GlassFish Server 4.1, Windows 7, Device: Samsung Galaxy S4

最诚挚的问候.

推荐答案

似乎您正在尝试连接到URL中的localhost.

It looks like you're trying to connect to localhost in your URL.

这在模拟器上可能可以正常工作,但是在生产环境中运行应用程序时,您需要在URL中使用IP地址或更佳的可解析主机名.

This probably works fine using the simulator, but you'll need to use an IP address or better yet a resolvable host name in your URL when you run the app in production.

尝试以这种方式更改您的URL.您可以使用手机的Web浏览器测试连接性,例如,在浏览器中输入Web服务的URL(不使用localhost!),然后查看会发生什么情况.

Try changing your URL in this way. You can test for connectivity by using your phone's web browser, for example enter a URL (not using localhost!) of your web service in the browser and see what happens.

这篇关于java.net.ConnectException:无法连接到localhost/127.0.0.1(端口8080):连接失败:ECONNREFUSED….(代号一个应用程序)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆