tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher Schultz <>
Subject Re: Getting the tomcat server IP
Date Mon, 23 Feb 2009 00:53:56 GMT
Hash: SHA1


On 2/21/2009 1:44 PM, Yuval Perlov wrote:
> Also, from the socket object you can always call
> socket.getLocalAddress() on an outgoing connection. This is useful if
> you want to make sure you are getting the IP for a particular network.

Aren't we going around in circles, here? The OP can't use
getLocalAddress because there are multiple interfaces on the server.
There is no reference to the socket to get the local address from. There
is no request to get the local address from.

Your suggestion to make an outgoing connection won't work, either,
because there's no guarantee that the outgoing connection's IP is the
"right one".

The only way to find out what the correct IP address is to grab the
running Connector from memory and interrogate it. This could possibly be
done using JMX, but I'm no expert at what parts of Tomcat are available
via JMX.

I suppose you could also attempt to manually parse the server.xml file
looking for the <Connector> definition. Then again, you might get the
wrong connector if multiple <Connectors> are defined.

- -chris
Version: GnuPG v1.4.9 (MingW32)
Comment: Using GnuPG with Mozilla -


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message