tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alexander Shutyaev <>
Subject Re: force embedded tomcat 7 to listen on ALL adresses
Date Tue, 17 Jul 2012 18:31:08 GMT
Hi Christopher,

I've found a solution to my problem although I believe it's more accurate
to say I guessed it :) Maybe you'll be able to explain it to me. Here is
the complete code:

Tomcat tomcat = new Tomcat();
tomcat.getEngine(); // (1)
tomcat.getHost().addAlias(""); // (2)
tomcat.addWebapp("", path);

(1) - this seems like it should be called from somewhere within Tomcat
class during initialization, but somehow it isn't called, and without this
line I get a NullPointerException

(2) - this is my solution to the problem I've described before; without
this line my app is only served on http://localhost:8080 but if I include
this line my app is available on http://localhost:8080, and all other assigned addresses like etc

2012/7/17 Christopher Schultz <>

> Hash: SHA1
> Alexander,
> On 7/17/12 6:42 AM, Alexander Shutyaev wrote:
> > Ok, I've figured out it DOES listen on ALL addresses no matter
> > what hostname is, but somehow requests only succeed if they have
> > the hostname matching with the one set by Tomcat.setHostname(...)
> > (which is localhost by default). I'm not sure where the requests
> > fail, but they do.
> What happens when the requests don't "succeed"?
> If you have a connector bound to (or ::) then it should accept
> connections on any interface.
> If you have a Host defined that is the default, then it should respond
> to all requests that don't match another Host.
> As long as you set the hostname before calling any of the more
> interesting methods, then the hostname you specify should be the
> default. If you set no hostname, then it will default to "localhost"
> and will be *the default Host* so everything should work.
> Please describe in more detail what happens. Also, if you could post
> your entire use of the Tomcat class, that would certainly help.
> - -chris
> Version: GnuPG/MacGPG2 v2.0.17 (Darwin)
> Comment: GPGTools -
> Comment: Using GnuPG with Mozilla -
> iEYEARECAAYFAlAFcLgACgkQ9CaO5/Lv0PCWCwCgidVx5uhVkpqk/rdSCnYeqbSl
> wMcAnR3fk//7SHueaNwH5SLv8U+mGDnU
> =C25J
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message