multiple Tomcat instances

J

Jean Lutrin

Hi,

I am sorry if this is a little offtopic, but there's something that
I don't understand.

I read somewhere (don't remember where though, please don't flame :) that
you could run several Tomcat instances in chroot'ed jails on an
unique system (I suppose this is not limited to Tomcat and can be
applied to Apache or whatever).

Say user John has his own chroot'ed instance of Tomcat running his
own Web app and user Jean has also his own chroot'ed instance of
Tomcat, running another Web app.

My question is : how are the clients requests dispatched to the
right Tomcat instance ?

I am not asking wheter this setup if a good setup or not, I don't
care much about that.

What I want to know is how the clients requests from, say, across
the globe, get dispatched to the right Tomcat instance. Because
the "server" holding those two Tomcat instance has a single IP address ?

I know this is a basic silly question (not really related to Java), but
I could get no sleep not knowing this...

Thanks in advance,

Jean
 
D

Daniel Schneller

Hi!
What I want to know is how the clients requests from, say, across
the globe, get dispatched to the right Tomcat instance. Because
the "server" holding those two Tomcat instance has a single IP address ?

Via different port numbers. Alternatively you could use Apache and named
VirtualHosts that map to different Tomcat connectors. That would allow
different DNS names to be used with a single IP address on a single
port. However this is not specific to Tomcat and I have never tried it
in connection with mod_jk/2.
I could get no sleep not knowing this...
Hope you can finally get some rest now ;)

Daniel
 
J

Jean Lutrin

Daniel Schneller said:
Via different port numbers. Alternatively you could use Apache and named
VirtualHosts that map to different Tomcat connectors. That would allow
different DNS names to be used with a single IP address on a single
port. However this is not specific to Tomcat and I have never tried it
in connection with mod_jk/2.

But if it's via different port numbers, it means one has, say, port 80 and
the other has port 81 !?

Then if some user enters : www.somesite.com he gets directed to port 80, ok.

But another user enters www.someothersite.com and should get directed to
port 81, but his browser only attemps by default to connect to port 80 ?

If it is for a "Tomcat only" installation (no apache and hence no need for
mod_jk), do you see any other way of doing this ?

Hope you can finally get some rest now ;)

Hehe, at least I went to sleep knowing that someone would have the answer :)

Thanks again,

Jean
 
N

Nathan Zumwalt

AFAIK, the only way you can do this is by using Apache or some other
webserver that has the concept of a virtual host (because Tomcat
doesn't). You'd have your two instances of Tomcat running on
different ports (say for example 8080 and 8081). The webserver
running on port 80 would differenciate between your two domains and
proxy requests to the appropriate Tomcat instance and port. The
proxying is all done under the covers, so the address in the user's
browser never changes.

-Nathan
 
J

Juha Laiho

(e-mail address removed) (Jean Lutrin) said:
But if it's via different port numbers, it means one has, say, port 80 and
the other has port 81 !?

Then if some user enters : www.somesite.com he gets directed to port 80, ok.

But another user enters www.someothersite.com and should get directed to
port 81, but his browser only attemps by default to connect to port 80 ?

No, the other user would have to enter www.somesite.com:81 to get to the
site at port 81. Or alternatively the server should have distinct IP
addresses for www.somesite and www.someothersite.

As for the proxy scenario described by another person, I consider it just
as a generic variant of using mod_jk (so, Apache equipped with mod_jk
can be considered to be a backend-specific proxy).

So, the rules are:
- only a single process can be listening at a given IP address/port
combination at a single point in time (but the listening process
can function as a proxy for several backend processes)
- machines can be equipped with multiple IP addresses
- if a port other than 80 is used, the port needs to be used as part of
the URL
 
J

Jean Lutrin

AFAIK, the only way you can do this is by using Apache or some other
webserver that has the concept of a virtual host (because Tomcat
doesn't). You'd have your two instances of Tomcat running on
different ports (say for example 8080 and 8081). The webserver
running on port 80 would differenciate between your two domains and
proxy requests to the appropriate Tomcat instance and port. The
proxying is all done under the covers, so the address in the user's
browser never changes.

Thank very much to both of you...

So my question was not that silly after all (just a little bit
offtopic)

:)

See you all later on cljp,

Jean
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,743
Messages
2,569,478
Members
44,899
Latest member
RodneyMcAu

Latest Threads

Top