File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Tomcat and the fly likes Can we have two tomcat's running on the same machine with 2 different port numbers Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Tomcat
Bookmark "Can we have two tomcat Watch "Can we have two tomcat New topic
Author

Can we have two tomcat's running on the same machine with 2 different port numbers

Pavan Kashyap
Greenhorn

Joined: Jul 18, 2006
Posts: 8
Hi All,
Well i know that we can change the port number of the tomcat.
But my doubt is that can we have two tomcat's running on the same machine with 2 different port numbers.
If yes can u explain me how to do.
[ July 21, 2006: Message edited by: Pavan Kashyap ]
Martin Simons
Ranch Hand

Joined: Mar 02, 2006
Posts: 196
Of course you can, but you need either two complete installations, or at least two completely different conf and webapps directories and two different startup scripts (or modify the original to accept an argument).
Harish Tiruvile
Ranch Hand

Joined: Dec 01, 2005
Posts: 99
HI Martin Simons ,
(or modify the original to accept an argument).


you mean we have to change the tag which takes one port number as an attribut to TWO attribute by making changes in XML file(in DTD or Schema),to take one more argument?

I hope we dont have that previlage....Do we?

.....correct me if i am wrong
[ July 21, 2006: Message edited by: harish thrivile ]

Giving up is the easiest thing in the world to do..but holding it together when everything seems like falling apart is true strength!!
with regards, Harish.T
Martin Simons
Ranch Hand

Joined: Mar 02, 2006
Posts: 196
I mean to modify catalina.sh to take an argument as to which of the conf/webapps directories to use. (Better would be to duplicate the setenv.sh and place these as variables in there and then the argument can specify which of the environment scripts to use.)
Murad Iqbal
Ranch Hand

Joined: Dec 09, 2003
Posts: 90
Better to have two complete different tomcat installations mate. You can change the default port by editing catalina.bat/sh
Harish Tiruvile
Ranch Hand

Joined: Dec 01, 2005
Posts: 99
Martin Simons

I mean to modify catalina.sh to take an argument as to which of the conf/webapps directories to use.


Hey i read somewhere in tomcat document that if i want to change port(reassign different port ) then i have to change Tomcat 5.0\conf\server.xml file......

i am hearing for the first time that we can change the port number by modify catalina.sh\bat(i am using WINDOWS 2000).....please explain it more.......i mean where & what i have to modify if i want to assign different port number(I saw only environment variable ...and some commands,did not got where to modify)

Otherwise...if u have link which explain that ,please post that link here Martin Simons..it will be very helpful for me to
Martin Simons
Ranch Hand

Joined: Mar 02, 2006
Posts: 196
And you do have to. That is why I say you need an additional conf and webapps directory. But, the catalina.sh will start the process using the info in the normal conf directory. If you want to use the same distribution to start a second tomcat process on a different port, then you need to tell catalina.sh to use a different conf directory. In which, the modified server.xml (and other files) will exist.

The simplest solution is simply to install a second tomcat server to a new directory and start your second process (using a different port) from there. Then you do not need to do anything special. All the other things mentioned, only need to be done if you want to use the same tomcat installation to run two Tomcat processes.
Martin Simons
Ranch Hand

Joined: Mar 02, 2006
Posts: 196
I am not telling you to change the port number by changing catalina.sh. I am telling you, make a copy of your entire conf directory and then start catalina.sh using the original conf directory, than start it again using the new conf directory. If you do not understand this, then do the simplest solution of installing a second server.
Harish Tiruvile
Ranch Hand

Joined: Dec 01, 2005
Posts: 99
Thank u Martin Simons ...now i got it
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Can we have two tomcat's running on the same machine with 2 different port numbers