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.


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


You need to make Tomcat listen to 192.168.1.100 address also.

If you want it to listen to all interfaces (IP-s) just remove "address=" from Connector string in your configuration file and restart Tomcat.

Or just use your IP to listen to that address address=192.168.1.100 in the Connector string


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.


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.