This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
Am have Tomcat4 and Tomcat6 installed on my hp-Unix machine,
Tomcat 4 is running fine with port 8080, now i have changed the port number for tomcat6 as
but this doesn't work, i cant run both the servers at one time.
I have done this as i nee two different instances of tomcat.
One more problem here is, if i shut one server down the other is also getting down.
Please let me know, how can i change the port number. and how to use two instances at same time.
You cannot just "Change the Tomcat Port". Tomcat uses something like 5 separate ports - one for HTTP, one for HTTPS, one for ajp, one for control, and probably one or two I've forgotten.
It's a fundamental architectural restriction that only one process can listen on a TCP/IP port at a time, so you not only have to change the base port, you have to change all the ports in the server.xml file to be ports that no other app on the server is using - even the non-Tomcat apps.
An IDE is no substitute for an Intelligent Developer.
Joined: Dec 30, 2007
Now am able to change the port number,
I have changed the catalina_home and base, this is working now.
But the problem am facing is, as i have 2 instances of tomcat, i have to declare the catalina_home variable for these two instances. how can i do it differently for these two instances?
There are 2 Catalina environment variables. One is CATALINA_HOME and one is CATALINA_BASE and they're intended for exactly what you're trying to do.
I can never remember which is which. This is one of those items that litter technical exams when in the real world, it's done so rarely I simply RTFM and save my memory for stuff that's actually critical day-to-day <snark/>. So I'll recommend that you do likewise - which also means that you'll be looking at the exact way it's handled on the version of Tomcat that you're interested in.
What's more important to know is that Tomcat is designed with a sharable core and per-instance environments. That is, all the Tomcat instances would have common bin and lib directories, but each instance would have its own private webapps, conf, and log directories.
For most purposes, CATALINA_HOME and CATALINA_BASE will point to the same directory. In your case, you would have distinct values for them.
Like I said, I get HOME and BASE confused, so you may have to swap them.
This is how you'd do it for Unix-like systems. I haven't looked at what it takes for Windows, but the same rules apply. You'd just have to allow for how Windows manages environment variables.
Joined: Dec 30, 2007
Thanks a TON Tim ..
But i have a question here, when i want to start one instance say TomcatA, then the other instance TomcatB also starts, even both instances would stop at a time when i run shutdown.sh .
I want to start and stop the two instances independently. How can this be done?