[tomcat] Can't access Tomcat using IP address

I'm running a Tomcat 5.5 instance (port: 8089) on Windows 7.

The server runs correctly if I open http://localhost:8089/ but it gives me an error (Connection refused) on http://192.168.1.100:8089/

I thought it was a firewall issue...so I disabled it, but I still have no luck.

Thanks in advance.

SOLVED:

added address="0.0.0.0" to Connector string, it works! thanks a lot!

This question is related to tomcat windows-7

The answer is


Thanks for all answers. For me it was a different issue. I had to set my wireless network to "private". I only need tomcat for network internal use. For some reason although firewall rule was set to allow for all, it does not allow access from within the same network if set to public.

Changing settings in server.xml were not needed in this usecase.


If you are trying to access your web app which is running on apache tomcat server, it might be working perfect while you are trying to use it on http://localhost:8080/ , it will not work same if you are trying to access it on your mobile device browser for ex. chrome using http://192.168.x.x:8080/ so if you want to access via ip address on your remote/mobile device , do following settings

  1. Open server.xml file.
  2. Change

    <Connector connectionTimeout="20000" port="8080"protocol="HTTP/1.1" redirectPort="8443"/>
    

to.

    <Connector connectionTimeout="20000" port="8080" protocol="HTTP/1.1" redirectPort="8443" address="0.0.0.0" />
  1. Save the file
  2. Stop and restart the server
  3. Now access on your mobile device using ip address http://192.168.1.X:8080/

You are good to go.


I was also facing same problem on Amazon windows EC2 instance ( Windows Server 2012 R2 ) Then I figured out , it was local windows firewall preventing it . I opened port 80 ( defined port for website ) using windows Firewall with Advance Security .

It resolved the issue .


Firewalls are often the problem in these situations. Personally, the Mcafee enterprise firewall was causing this issue even for requests within the network.

Disable your firewalls or add a rule for tomcat and see if this helps.


New versions of application servers removed the ability of binding to your entire network interface and limited it just to the local interface (localhost). The reason being was for security. From what I know, Tomcat and JBoss implement the same security measures.

If you want to bind it to another IP you can explicitly set it in your connector string:

  • Tomcat: address="192.168.1.100"
  • JBoss: you pass in a -b 192.168.1.100 as a command line.

Just remember that binding 0.0.0.0 allows anyone access to your box to access that server. It will bind to all addresses. If that is what you want, then use 0.0.0.0, if it isn't then specify the address you would like to explicitly bind instead.

Just make sure you understand the consequences binding to all addresses (0.0.0.0)


If you are not able to access tomcat from remote, there might be reason that taken port is not open in your machine. Suppose you have taken 8081 port.

On Your windows machine:

Open Control panel-> windows Firewall-> Advance setting->Inbound Rules

Create a new rule: mention Port

Picture1

Configure your port and then shutdown and start your tomcat and it will be accessible from remote as well.

That port issue majorly comes in AWS machines.

If it is still not working then please check with your administrator that selected port is open for public access or not, if not then open it.


You need allow ip based access for tomcat in server.xml, by default its disabled. Open server.xml search for "

<Connector port="8080" protocol="HTTP/1.1" 
           connectionTimeout="20000" 
           URIEncoding="UTF-8"
           redirectPort="8443" />

Here add a new attribute useIPVHosts="true" so it looks like this,

<Connector port="8080" protocol="HTTP/1.1" 
           connectionTimeout="20000" 
           URIEncoding="UTF-8"
           redirectPort="8443"
           useIPVHosts="true" />

Now restart tomcat, it should work


No solution mentioned above was solved my problem. My problem was different.

First check is your port is disabled in firewall. Go to Control Panel -> Windows Firewall -> Advance Settings -> Inbound Rules and see any port is blocked.

A sample image is below:

enter image description here

If so then you can unblock the port by following steps:

Step 1:

enter image description here

Here you can see that the port is blocked.

enter image description here

Step 2: Allow the connection -> Apply -> Ok.

enter image description here

That's solved my blocked problem. Happy coding :) :)


Windows Firewall cause issue after uninstalling Oracle JDK and installing OpenJDK on Windows Server 2008 R2.

Tomcat 7 and Tomcat 8 not access on other machine after this.

Follow below path to add new rule

 --> Windows Firewall with Advanced Security on Local Computer
 --> Inbound Rule 
 -->Add New Rule 
      with specific port you have required for Tomcat application.

Check your windows-firewall feature in control panel. Outbound and inbound port should allow port 8089. (or write a new rule for this- Right hand side, actions - new rules.) it worked for me!


Very strange because the firewall caused the issue.


Examples related to tomcat

Jersey stopped working with InjectionManagerFactory not found The origin server did not find a current representation for the target resource or is not willing to disclose that one exists. on deploying to tomcat Spring boot: Unable to start embedded Tomcat servlet container Tomcat 404 error: The origin server did not find a current representation for the target resource or is not willing to disclose that one exists Spring Boot application in eclipse, the Tomcat connector configured to listen on port XXXX failed to start Kill tomcat service running on any port, Windows Tomcat 8 is not able to handle get request with '|' in query parameters? 8080 port already taken issue when trying to redeploy project from Spring Tool Suite IDE 403 Access Denied on Tomcat 8 Manager App without prompting for user/password Difference between Xms and Xmx and XX:MaxPermSize

Examples related to windows-7

ng is not recognized as an internal or external command Why am I getting ImportError: No module named pip ' right after installing pip? How to Delete node_modules - Deep Nested Folder in Windows Telnet is not recognized as internal or external command Multiple -and -or in PowerShell Where-Object statement How do I set ANDROID_SDK_HOME environment variable? Run Batch File On Start-up Why isn't .ico file defined when setting window's icon? How to access shared folder without giving username and password Can't start hostednetwork