Multiple Tomcat instances

Hi.
My project has 2 web modules. I need to run them at the same time, using Tomcat (v5.5).
My IntelliJ (v6.05) isn't smart enough to understand that has to use different ports when running multiple instances of Tomcat, so I tried to do the dirty work manually, but without success:
I created a copy of catalina.bat, that points to a different server.xml where I changed the default ports 8005 and 8080 to something other.
I linked my copy of catalina.bat to one of the 2 web modules' running configuration.

Now it's time to run my 2 web modules.
I start the first one, with the default catalina.bat; all it's fine.
I try to start the second module, IntelliJ says "Address localhost:8080 is already in use". That's true, it's in use, but I've configured the application to start on port 8081! No way to make it work this way...

Ok, 2nd try.
I start the second module, the one configured to run with the alternative catalina.bat. It starts, and it's running on the alternative port, great!
Time to start the first module, the one on the default 8080 port.... It starts!!!
Everything seems ok but now, from the browser I can only access the application on the default 8080 port, and there's no way to access the application on the alternative port...

I can't find a solution, how can I concurrently run 2 web modules using the same Tomcat installation?

Thanks.

2 comments
Avatar
Nikolay Chashnikov
Comment actions Permalink

Hello SoulSpirit,

You should copy complete Tomcat installation to another directory, change
port number in server.xml, create a new app server configuration for the
new Tomcat installation (Settings | Application Servers) and then create
2 run configurations for these app servers.

Hi.

My project has 2 web modules. I need to run them at the same time,
using Tomcat (v5.5).

My IntelliJ (v6.05) isn't smart enough to understand that has to use
different ports when running multiple instances of Tomcat, so I tried
to do the dirty work manually, but without success:

I created a copy of catalina.bat, that points to a different
server.xml where I changed the default ports 8005 and 8080 to
something other.

I linked my copy of catalina.bat to one of the 2 web modules' running
configuration.

Now it's time to run my 2 web modules.

I start the first one, with the default catalina.bat; all it's fine.

I try to start the second module, IntelliJ says "Address
localhost:8080 is already in use". That's true, it's in use, but I've
configured the application to start on port 8081! No way to make it
work this way...

Ok, 2nd try.

I start the second module, the one configured to run with the
alternative catalina.bat. It starts, and it's running on the
alternative port, great!

Time to start the first module, the one on the default 8080 port....
It starts!!!

Everything seems ok but now, from the browser I can only access the
application on the default 8080 port, and there's no way to access the
application on the alternative port...

I can't find a solution, how can I concurrently run 2 web modules
using the same Tomcat installation?

Thanks.



0
Comment actions Permalink

Are you using Tomcat for the web container and the web server in production? We did this for a while, but eventually moved to having Apache in front of the Tomcats. If you are not using Tomcat for the web server in production, then just include both modules in the same project and deploy. They will be separate contexts within the same web container.

Also, make sure you are using c:url tags within your JSP pages so that you don't have hard-coded web contexts in your code. If you move from having Tomcat as your web server (e.g. running each web app as the root app) to having the tomcat run multiple web contexts behind a dedicated web server, then using the c:url tag will remove the need to modify your app to remove/add the web context to the http calls.

0

Please sign in to leave a comment.