• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How to setup the same application (multiple instances) running on different ports under Tomcat 6.0.x

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

Below is the requirement:

I have installed Tomcat 6.0.x and have running application i.e. http://localhost:8080/myapp with it.
Have created a context file <Tomcat>\conf\catalina\localhost\myapp.xml for the same.

Now wanted to run the same application (separate instance) having same context root as 'myapp' under the same Tomcat instance but on a different port #.
i.e. http://localhost:8088/myapp

Which is similar to what Weblogic has as domains for such requirements. Can you please help me on this?

Thanks,
Achal.
 
Saloon Keeper
Posts: 27807
196
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
It's probably actually more efficient to run multiple instances of the app in a single Tomcat with different context names, then use a proxy to route to them. However, there are cases where what you want are valid as well. I helped set up a 16-node cluster where each machine had 4 CPU cores and they wanted a separate Tomcat for each core.

The key here is to understand the difference between CATALINA_HOME and CATALINA_BASE. One of them refers to the sharable parts of a Tomcat server, and the other refers to the per-instance parts, including the server.xml file that defines which ports a given Tomcat instance will be serving.

Note that you can't just reassign port "8080". Tomcat typically runs 4 or 5 ports for things like control, https, tunneling, and so forth. Since only one program can own a port, you have to provide alternate ports for these services as well.
 
achal patel
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Tim.

#1 currently we are using different context name with a single Tomcat to achieve the same but wanted to evaluate the possibilities to simulate what is working in Weblogic instance.

Can you point me to the docs having details on Shared and per-instance resources under Tomcat to see if I can make use to achieve mentioned scenario.

Thanks,
Achal.
 
Tim Holloway
Saloon Keeper
Posts: 27807
196
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
Well, I'm not totally clear on that. Even in WebLogic, I haven't found it beneficial to have a WebLogic server to be responding on multiple HTTP ports.

As a general rule, sharable resources are going to be defined in the TOMCAT_HOME/conf/server.xml file and per-instance resource are defined in the individual webapp's context definitions. Beyond that, I'd have to have a better idea of that the ultimate goal is in high-level terms.
 
achal patel
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The idea here is to bring up multiple instances of the application on different ports during the development or training activity in order not to man-handle application context.

With WebLogic, this can be achieved by creating multiple domains using Configuration wizard and providing different ports for each domain.
Now using multiple domain (running on different port), the same application instances can be deployed without sharing any resources, having same context roots.

This also helps in showing differences in the features between older version of application with newer version for business guys who might not be well-versed with application server skills.

All they would do is to create another domain in WebLogic providing different port and showcase features etc and I wanted to achieve the same using Tomcat Server considering the lightweight memory requirement of Tomcat Server.

Hope this helps.

Thanks,
Achal
 
Ranch Hand
Posts: 470
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

achal patel wrote:This also helps in showing differences in the features between older version of application with newer version for business guys who might not be well-versed with application server skills.



For any person, it would be more human readable to have something like www.coderanch.com/forums_old and www.coderanch.com/forums_new, instead of www.coderanch.com:8080/forums and www.coderanch.com:8081/forums
 
achal patel
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

For any person, it would be more human readable to have something like www.coderanch.com/forums_old and www.coderanch.com/forums_new, instead of www.coderanch.com:8080/forums and www.coderanch.com:8081/forums



Is it even possible to achieve www.coderanch.com:8080/forums and www.coderanch.com:8081/forums using Tomcat?

Thanks,
Achal.
 
Tim Holloway
Saloon Keeper
Posts: 27807
196
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

achal patel wrote:

For any person, it would be more human readable to have something like www.coderanch.com/forums_old and www.coderanch.com/forums_new, instead of www.coderanch.com:8080/forums and www.coderanch.com:8081/forums



Is it even possible to achieve www.coderanch.com:8080/forums and www.coderanch.com:8081/forums using Tomcat?

Thanks,
Achal.



Yes it is. It's just generally not considered to be worth the effort. A new context is trivially easy to set up and as a side benefit it is visually more obvious than a new port number to people looking at URLs (or worse, reporting them over the phone).

If your context name is hard-coded in the webapp, you've got bigger problems than just the port numbers.
 
achal patel
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I agree with you Tim but we have few flex based components which uses context root and right now there is no easy way to dynamically change the context root, as it's configured in the flex configuration file.

What you have mentioned having different context roots, was the first approach I took to validate and it worked for me.

Thanks,
Achal.
 
Tim Holloway
Saloon Keeper
Posts: 27807
196
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

achal patel wrote:I agree with you Tim but we have few flex based components which uses context root and right now there is no easy way to dynamically change the context root, as it's configured in the flex configuration file.

What you have mentioned having different context roots, was the first approach I took to validate and it worked for me.

Thanks,
Achal.



Hmmm. Applets have had this problem as well. The usual solution is to have the server insert a parameter into the applet declaration as it displays the page with the applet object reference in it. Can Flex handle that?

As a quick fix, I'd recommend just running a separate Tomcat with alternate ports defined in server.xml. Unlike WebLogic, you don't have to pay for a second license, the extra overhead is pretty low, and it would probably take less than an hour to get going.
 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Was this achieved... ???
 
So it takes a day for light to pass through this glass? So this was yesterday's tiny ad?
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic