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.
I am trying to run two servers through one tomcat. I want one on 8080 and one on 9090. In order to accomplish this I copped the all the page information and pasted it below then changed the main port from 8080 to 9090, the shutdown port from 8005 to 9005 and the ajp one from 8009 to 9009. I restarted tomcat and now it recoginzes the 8080 but when I change it to 9090 its consistently giving me a page not found!?
John Lark wrote:Would it be possible to do it through the server.xml? This is for a program that is going to install itself, the easiest approach seems to me it would be to rewrite the xml file?
There are 2 Tomcat environment variables: CATALINA_HOME and CATALINA_BASE. In most cases, they point to the same place, but if you want to run multiple instances of Tomcat, you set CATALINA_BASE to a shared copy of Tomcat, and create a separate CATALINA_HOME for each one. CATALINA_HOME contains the webapps, work, temp, and conf directories. CATALINA_BASE contains the sharable files, such as the bin and lib directories.
In an environment where tomcat is controlled via a command-line interface, you'd set up the environment variables before you invoked the catalina.bat start function for each Tomcat. I don't know how to to that using the Windows Service Manager, however, since I rarely run Tomcat on Windows, and usually do it from the command prompt when I do.
An IDE is no substitute for an Intelligent Developer.
Joined: Feb 08, 2010
As I am learning more about the subject (John <-- Tomcat Newbie) I am asking for something different then what I wanted . I am not looking to make multiple Instances of Tomcat I am looking to run multiple Servers within one Instance of Tomcat, if possible(no one has said it isn't yet). Although, I really have appreciated the information so far its helping me to understand parts of the this that I am not comprehending.
John Lark wrote:As I am learning more about the subject (John <-- Tomcat Newbie) I am asking for something different then what I wanted . I am not looking to make multiple Instances of Tomcat I am looking to run multiple Servers within one Instance of Tomcat. Although, I really have appreciated the information so far its helping me to understand parts of the this that I am not comprehending.
Tomcat is a server. So each "server" is an instance.
I think what you're actually looking for is Virtual Hosts. One Tomcat server instance can support multiple virtual hosts, and, in fact, we just had a nice discussion on how to set up multiple virtual hosts in Tomcat. Check this forum's recent history.