• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Bear Bibeault
  • Henry Wong
  • Devaka Cooray
Saloon Keepers:
  • salvin francis
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Frits Walraven
Bartenders:
  • Jj Roberts
  • Carey Brown
  • Scott Selikoff

Multiple windows services with tomcat servlet on one Windows server

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I am trying to install tomcat as a windows service and that works fine if I have only one windows service with tomcat.

My problem is that I want to have (on one single windows server) multiple windows services each one containing a tomcat servlet.

For the first service I use the:

apache-tomcat-6.0.26-windows-installer.exe

And that works fine. But when I try to install another windows service with tomcat nothing works and I have to start all over again.

How do I install multiple windows services containing tomcat (on one windows server)?

Can someone give me a detailed description of how to do this?
Or maybe tell me where there are a description/manual of how to do this?

Thanks in advance!

/Wind
 
Saloon Keeper
Posts: 23288
158
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Welcome to the JavaRanch, Wikard!

Tomcat is not designed with that sort of idea in mind. Tomcat is a container, and a container with only one object in it isn't much of a container.

You can have multiple copies of Tomcat in a system, and Tomcat is very definitely intended to support that. However, it's a fundamental limitation of TCP/IP that every server instance has to own its port(s) exclusively - no sharing with other servers - and Tomcat requires about 5 ports per instance. So just setting up the configuration is annoying.

Additionally, JVMs are not something you crank up lightly, and each Tomcat instance runs in its own separate JVM. They all compete for CPU, and since they all run apps in private, not-sharable address spaces, if one JVM has memory to spare and another needs it, too bad.

So, for the most part, it's better to run all the webapps in a single Tomcat. Tomcat will partition resources in a way that rigidly limits their ability to interfere with each other, so only the most critical applications generally justify their own private VM.
 
Rikard Wind
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for your answer.

My problem is this:

We are using a standard third party application running inside tomcat. The application is intended to be a multiuser application, but is not so well built and it can only handle one request at a time and each request can take up to 1-2 minutes.
So we want to setup an environment with several windows services, with one tomcat (on different ports) in each windows service and one instance of our third party application in each tomcat. Then we will have a loadbalancer distributing the request among the different services.

We need to set up 10-16 of these services.

It will be too expensive to have a Windows 2008 R2 server for each of these 10-16 services.
We want to have 2-4 windows services running tomcat/our third party application per windows server.

Any more help on this?

Thanks!

/Wind

 
Tim Holloway
Saloon Keeper
Posts: 23288
158
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm not sure what your definition of "standard" is here. If it was a "standard" as in industry-standard - something from a major vendor or open-source project, it would be able to handle multiple concurrent requests; even long-running ones. Professional J2EE apps are not only expected to support such things, they're required to.

On the other hand if it can't run multiple concurrent requests, then it fails the basic J2EE standard. There isn't supposed to be a division between "single user" and "multi user" webapps, regardless of the language or platform. This is the kind of behaviour you get from apps that use MS-Access as their database and were the $50 low bid from Rent-A-Hacker because "IT Doesn't Matter" and "Anyone can create complex webapps, even a kid can do it!".

What you have, in short, is a carton of Chinese Pet Food. Whatever savings someone got are going to cost you an immense amount of time and money to support both initially and ongoing. You're already obligating yourself to a load-balancer that might not otherwise be needed. And Ganesh help you if it has anything to do with corporate-critical resources, because you can pretty much bet it will fail catastrophically at the worst possible moment and probably drag down other critical systems as well.

To set up multiple Tomcat instances, you need to pay attention to the differences between CATALINA_HOME and CATALINA_BASE. In common use, both these directories are the same directory. However since one refers to shareable resources and the other refers to per-instance resources, you'll have to make the distinction. Within the per-instance resources, you need to customize the conf/server.xml files to set a different set of ports for each instance.

As for managing them as windows services, at that point I have to leave you to the tender mercies of others. My own IT budget isn't up to the expense of keeping Windows servers secured, so I only work with Tomcat under Windows when clients insist. Which isn't often enough for me to keep in practice.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic