简体   繁体   English

无法连接到tomcat Web服务

[英]Can't connect to tomcat webservice

So I've been doing a java webservice in Eclipse in which I have launched on a localhost tomcat from Eclipse. 因此,我一直在Eclipse中进行Java Web服务,其中我是在Eclipse的localhost tomcat上启动的。 This has worked very good as long as I've been connecting to the tomcat started from Eclipse. 只要我一直连接到从Eclipse开始的tomcat,此方法就非常有效。

However now I want to try deploy it on my tomcat separated from Eclipse but still on localhost. 但是现在我想尝试将其部署在与Eclipse分开但仍在本地主机上的tomcat上。 So I exported my web project to a .war file and deployed it with the tomcat manager app. 因此,我将Web项目导出到.war文件,并使用tomcat Manager应用程序对其进行了部署。 However now I cant reach it from my client any longer. 但是现在我再也无法从客户那里得到它了。 I'm running the tomcat on port 8080, just as my Eclipse tomcat did. 正如我的Eclipse tomcat一样,我正在端口8080上运行tomcat。 BUT I can go to a reasource URL from my web browser and receive proper information, so the service is running(which the manager app is saying as well). 但是我可以从我的Web浏览器转到资源URL并接收适当的信息,因此该服务正在运行(经理应用也正在说)。

The client is a android device connected to the same network. 客户端是连接到同一网络的android设备。 The service fetches information from a MySQL database on the same machine. 该服务从同一台计算机上的MySQL数据库获取信息。 This connection worked fine before exporting it to war on my other tomcat 在将其导出到我的另一个tomcat上进行战争之前,该连接工作良好

What am I doing wrong here? 我在这里做错了什么? Just ask if you need any further information! 只要问您是否需要任何进一步的信息!

Ok so after testing I found it strange that I got connection time-outs and not something else. 好的,所以在测试之后,我发现连接超时而不是其他原因很奇怪。 It also took at least 10 seconds before any feedback occurred. 至少要花10秒钟才能收到任何反馈。 Sooo it felt like a firewall problem which indeed it was. 如此感觉确实是一个防火墙问题。

First I needed to portforward the tomcat port in my router to the machine ip that was hosting it. 首先,我需要将路由器中的tomcat端口转发到托管它的机器ip。 Then I remembered I had Windows firewall on that very machine which was also blocking conenctions on that port. 然后我想起我在那台机器上有Windows防火墙,它也阻止了该端口上的连接。 So I allowed connections on tomcat port and BAM! 因此,我允许在Tomcat端口和BAM上进行连接! It worked. 有效。

Thanks for all your comments, of course I should have thought about opening my ports before coming here. 感谢您的所有评论,当然我应该在来这里之前考虑开放我的港口。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM