aspose file tools*
The moose likes Servlets and the fly likes TOMCAT w/ diff HOST & PORT Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "TOMCAT w/ diff HOST & PORT" Watch "TOMCAT w/ diff HOST & PORT" New topic
Author

TOMCAT w/ diff HOST & PORT

Monty Ireland
Ranch Hand

Joined: Oct 03, 2000
Posts: 161
I'm running win98 and winNT...
I looking for the doc's.. a book .. or web page!
That can tell me how to change the default
HOST=localhost & PORT=127.0.0.1 to anything else!
say
HOST=localserv & PORT=255.255.255.255
I will be installing APACHE and a local network in my house
after the holidays...
Any ideas...
TIA Monty


Multi Platform Database Developer & DBA on E.S.T.
Frank Carver
Sheriff

Joined: Jan 07, 1999
Posts: 6920
I think there's some confusion here. You shouldn't ever need to change localhost and 127.0.0.1. They are special symbols which always refer to the machine the software is running on.
What happens when you connect the machine up to a network, is that you also assign another name and IP address to the machine, which will be used to refer to it from other machines.
In my home network, for example, I have the following machines:
172.16.1.1 "muscovy"
172.16.1.2 "teal"
172.16.1.3 "wigeon"
172.16.1.4 "aylesbury"
172.16.1.21 "puna"
172.16.1.22 "cape"
172.16.1.32 "eider"
172.16.1.253 "garganey"
172.16.1.254 "shoveller"
each of these machines may refer to itself by either it's symbolic self name "localhost" and IP address "127.0.0.1" or by its external name (say "teal") and IP address (say "172.16.1.2").
It gets even more fun when I connect to the internet. One of my machines ("garganey") acts as a modem-server which connects up to an ISP. When it is connected, it gains yet another name and IP address, automatically assigned by the service provider (say "modem1234.dialup.ntl.com" and 123.456.789.100) for the duration of the call. But that doesn't affect any of the other names or IP addresses used for it or any of my machines.
The key to all of this is the "hosts" file (c:\Windows\hosts, /etc/hosts. or C:\WINNT\SYSTEM32\DRIVERS\ETC\hosts). If you don't have your own DNS setup (which is probably best for small networks), just put the names and IP addresses of all the local machines in the hosts file for each machine and away you go.


Read about me at frankcarver.me ~ Raspberry Alpha Omega ~ Frank's Punchbarrel Blog
Monty Ireland
Ranch Hand

Joined: Oct 03, 2000
Posts: 161
No confusion here. I need to change localhost and 127.0.0.1. They are special symbols which always refer to the machine the software it's running on.
I can make these changes to Apache.
I should be able to make these changes to Tomcat.
But, I can not!
I took me 15 min. to read Apache RTFM web pages as how to install Apache. For this is the 1st time I have ever installed Apache. It took me 10 min on my NT box. Includeing changing the host & port default settings!
Tomcat took 10 min on my win98 box. It appear host=localhost and port=127.0.0.1 are default setting and not easly changed.
Still trying after 3 day to install TOMCAT on my NT box.
Boy am I !
There has got to be a better way...
Any ideas would be greatly appreciated.
Monty

Frank Carver
Sheriff

Joined: Jan 07, 1999
Posts: 6920
Ah! Do you need to change Tomcat to listen on a different port?
I still can't understand why you might want it to not listen to localhost/127.0.0.1 - I have three different web servers (my own, Resin and Tomcat) all running at once on this NT box, all quite happily listening to localhost/127.0.0.1 as well as various other names this box is known by. They listen on different ports, though :- currently Resin is on 80, Tomcat on 8080 and my own on 24761
Are you using Apache and Tomcat, or just Tomcat on its own?
If you are using Tomcat on its own, the port for Tomcat's HTTP listener is defined in Tomcat's conf/server.xml. Just change that from the default 8080 to whatever you like and restart Tomcat. If you are using Apache and Tomcat, then the port is defined in Apache's conf/httpd.conf.
Or am I still misunderstanding what you need?
Frank Carver
Sheriff

Joined: Jan 07, 1999
Posts: 6920
Looking at this and some other posts, I would like to clear up some terminology, just in case that's the problem.
host = a particular machine
hostname = a name that a host is known by, to itself or others (a host may have more than one name, but always has at least "localhost")
IP address = a number that a host is known by, to itself or others (a host may have more than one IP address, but always has at least "127.0.0.1"). An IP address consists of 4 "octets", each of which may be any value from 0 to 254. The value 255 is reserved for broadcast use.
port = one of several thousand available numbers which a server may "listen" on and a client send to. Some protocols have standard defaults (HTTP is 80, FTP is 21 etc.), but any server can listen on any port(s), provided they are not already in use by another server.
There is a fixed correspondence between a hostname and an IP address. "localhost" is always 127.0.0.1, "teal.efsol.com" is always 172.16.1.2 etc.
The most common way of running more than one HTTP server on one host is to just have them listen on different ports. If you have more than one hostname or IP address for your machine, you can also tell most servers to only listen to requests to particular IP addresses or particular host names (requires HTTP/1.1). This is known as "virtual hosting" and is discussed in detail in the Apache documentation.
Monty Ireland
Ranch Hand

Joined: Oct 03, 2000
Posts: 161
I have a need to change the host=locahost to host=somethingelse
I have a need to change the port=127.0.0.1 to port=somethingelse
I'm looking for doc's and.or web pages where I can look up this information.
I have found the information for Apache... and have made the
changes to host & port and they work...
I have found very little information for Tomcat... and I have tried to make the same changes... Still can not get it to work.
Somewhere in the tomcat 3.1 distribution .. i think port 127.0.0.1 is hard coded... but i could be wrong...
*** found the problem
tomcat 3.1 changing port from 8080 to 9090 WORKS.
tomcat 3.1 changing ip addr does NOT WORK
Solution:
#1 change port from 8080 to 9090
#2 change host file localhost ref. from 127.0.0.1 to my new ip addr
#3 reboot system, hard cod ip & port ... IT WORKS
Thank you for your advice and your help.
------------------
We learn more from our mistake's than from our success's.
a.k.a. monty6
Ireland (edited November 17, 2000).]
[This message has been edited by Monty Ireland (edited November 17, 2000).]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: TOMCAT w/ diff HOST & PORT