7

Can anyone suggest me how to configure my localhost:8080 in tomcat to connecting to an IP address instead of localhost such that i access my localhost in any system in my workplace... i am using tomcat6 and netbeans 6.9.1

3
  • For the record, 192.260.0.2 is an invalid IP.
    – Alex Brault
    Dec 18, 2010 at 5:42
  • Alex i meant similar to it.... i know its a invalid IP
    – dude
    Dec 18, 2010 at 5:46
  • Which operating system ?
    – user9517
    Dec 18, 2010 at 8:51

6 Answers 6

8

Your question is ambiguous dude.

If you are asking how you can make the hostname "localhost" resolve to something other than 127.0.0.1 then the answer is:

  • change the localhost entry in your "/etc/hosts" file, and mess with the network configs, and
  • DON'T DO IT because you are liable to break things.

If you are asking how to get Tomcat to accept requests on some other IP address, then the answer is to edit the $CATALINA_HOME/conf/server.xml to add or change the relevant <Connector> element. Of course, you can only listen on the configured IP address or addresses of your computer's network interface / interfaces.

0
2

Tomcat by default binds to all IP addresses (0.0.0.0)

Check your inbound firewall rules next. 8080 or whatever port you're using may be blocked.

1
  • 1
    for Tomcat 7, there is an entry <Engine name="Catalina" defaultHost="localhost"> that can be extended with another <Host> entry pointing to your desired IP/external hostname. Then both localhost and the external name will work.
    – Gregor
    May 22, 2018 at 10:33
0

This is the general method for nearly any (non-microsoft) service:

  1. Go through your configuration files for the service in question, and locate any references to either "localhost" or "127.0.0.1".
  2. Ponder for a moment about the wisdom of giving anybody unrestricted access to the service.
  3. Change the reference to reflect your external ip address or dns name.

You might need to change network routes on any gateways or routers that may exist between you and "everyone else".

1
  • @Arafangion - in this case, he probably needs to do it differently than this. While he says "instead of", he probably doesn't really want to stop his Tomcat from listening on 127.0.0.1. (Why would you?)
    – Stephen C
    Dec 18, 2010 at 6:47
0

You just need to use the IP of the machine, e.g. your dev machine is 10.0.0.100, then in the other computer type 10.0.0.100:8080, remember to check firewall rules

1
  • That will only work if the service is listening on that IP address.
    – Arafangion
    Dec 18, 2010 at 5:49
0

So if I understand you, you want to remotely access your Tomcat which runs locally on port 8080?

You need to know the IP address of your machine first;

windows: - open a dos box - type:

ipconfig /all

linux: - go to shell - type

if config

Your local IP address is listed. Now on your remote (at work) machine's browser enter the following URL:

http://the-IP-address-you-found:8080

If there are no firewalls blocking or other network problems you will see your tomcat page.

0

Since It is too late to respond, but today I faced same problem and resolved by allowing 8080 port in firewall rule.

sudo iptables -A INPUT -p tcp --dport 8080 -j ACCEPT

Note- In my case was able to access my server by url localhost:8080 but unable to access by url like 172.16.16.10:8080 from local as well as from remote machine.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .