wood burning stoves 2.0
The moose likes Tomcat and the fly likes Is localhost always = ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Tomcat
Bookmark "Is localhost always = ?" Watch "Is localhost always = ?" New topic

Is localhost always = ?

Oleksandr Karpus

Joined: Feb 13, 2002
Posts: 10
Hi all
Is localhost always = for Tomcat 4.0?
I did check it on 5 machines.
http://localhost:8080 always brings me "An error has occurred processing the request...
Unable to contact site SERVER
Press 'Refresh' on your browser to try again." is OK.

O.Karpus<br />SCJP2, SCWD
Rick Salsa
Ranch Hand

Joined: Jul 17, 2001
Posts: 173
Open up the Hosts file in C:\Windows in an editor. Add the following line at the bottom of the file: localhost
That should do the trick. You can now use http://localhost:8080
Bruce Jin
Ranch Hand

Joined: Sep 20, 2001
Posts: 672
Can I enter this in the host file? localhost
Then enter in browser?
Just a thought.

We love Java programming. It is contagious, very cool, and lot of fun. - Peter Coad, Java Design

Crazy Bikes created by m-Power
Oleksandr Karpus

Joined: Feb 13, 2002
Posts: 10
Hi rich salsa
I've always had a line " localhost" in my C:\winnt\system\drivers32\etc\hosts.
So It doesn't work.
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 17421

You Don't want to remap localhost. This is a "magic" IP address and I don't know what would break but certainly wouldn't care to find out.
On my Linux system, the OS install created a line in the /etc/hosts file tagged with the comment that removing the localhost definition would "cause various programs that require network funcitonality to fail". The Windows equivalent to /etc/hosts is %WINDOWS%\LMHOSTS, but that file is not present by default, so I suspect that the definition for localhost is either hard-coded in the OS or hidden in some sneaky part of the Registry.
There are some OS's where localhost ISN'T defined by default - I believe I've read of Solaris being noted for that. However, it is ALWAYS defined for any Windows 9x/NT (or successor) networked machine.
If you really want to write something tied to your specific machine (as opposed to whatever machine you're running the software on) refer to it by its hostname - which is the machine ID it was given by the LAN administrator (visible in Network Neighborhood/Properties, aka "My Network Places/Properties").
If you enter "http://localhost" or "" in your browser, it will look for a web server running at TCP/IP port 80 on your computer. If you want to access that server from another computer in your LAN and the machine ID is "FRED123", then say "http://FRED123".
Under Linux, IP isn't attached to a physical network device - it uses a special device called the "loopback" device. Windows may be doing something similar for performance reasons.

An IDE is no substitute for an Intelligent Developer.
I agree. Here's the link: http://aspose.com/file-tools
subject: Is localhost always = ?
It's not a secret anymore!