Search code examples
javaspringspring-boottomcatserver

Spring Boot and tomcat access from outside


For a few days I've been trying to solve this problem by searching on stackoverflow and other sites but I can't find it.

I currently have a spring boot application converted to jar running on a server. This application is accessible via a browser using the localhost on port 8080 by using tomcat which was directly integrated to my spring boot application.

The problem is the following:

We will tell here that the ip address of my server is 123.45.69.894

If I type :

localhost:8080/mypath

or if I type :

123.45.69.894:8080/mypath

in the browser of the server. I have this that appears in the console when I make the request :

2022-05-21 08:23:26.094  INFO 7536 --- [nio-8080-exec-1] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring DispatcherServlet 'dispatcherServlet'
2022-05-21 08:23:26.094  INFO 7536 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet        : Initializing Servlet 'dispatcherServlet'
2022-05-21 08:23:26.109  INFO 7536 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet        : Completed initialization in 15 ms

and everything works well.

But if I type,

123.45.69.894:8080/mypath

in the browser of another computer it doesn't work anymore and I have a connection time out error and nothing appears in the console.

I have already checked if the firewall doesn't blocked the port 8080. But the problem is not there.

I have also on the port 80 an IIS web site, the problem can come from there ?

I have already looked at these articles for example but that doesn't work for me :

how to deploy Spring boot application in IIS

Apache Tomcat not accessible from outside

Does anyone know where the problem might come from and how to solve it?


Solution

  • From the remote machine, try pinging your IP address. If it times out there is definitely a firewall issue between the machines. If ping works, try telnet IP port. If on Windows you may need to enable telnet from setup/applications. If telnet connects, the there will be no action until you hit cntrl square bracket. If that works then everything should work ok.