It's not a secret anymore!*
The moose likes Tomcat and the fly likes Is it possible, More than one tomcat running in the one system? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Tomcat
Bookmark "Is it possible, More than one tomcat running in the one system?" Watch "Is it possible, More than one tomcat running in the one system?" New topic
Author

Is it possible, More than one tomcat running in the one system?

Edward Durai
Ranch Hand

Joined: Oct 09, 2004
Posts: 223
Hi to all,

I have one separate server system. I have 5 jsp, java mail web-application.

1. Is it possible to install 5 independent web-application in the single tomcat server? if yes how amount of space required?

2. Or can I install and run 5 tomcat web-server for each 5 application in the one system at the same time? One should not get affected because of the other one.

Please send your suggestions. It will helpful to me.


Thank You<br />Edward
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12761
    
    5
1. Is it possible to install 5 independent web-application in the single tomcat server?


Sure, people do it all the time. Exactly how depends on how the URLs for the different web apps are constructed - do they all have the same host, etc.? Give us a set of URLs that show how you want to make these apps available.

if yes how amount of space required?


Obviously this depends on the application, but note that all web apps in a single Tomcat instance share all of the basic server code.

Bill
Edward Durai
Ranch Hand

Joined: Oct 09, 2004
Posts: 223
my url like

http://localhost:8080/application1/index.jsp
http://localhost:8080/application2/index.jsp
http://localhost:8080/application3/index.jsp
http://localhost:8080/application4/index.jsp
http://localhost:8080/application5/index.jsp

all the application are javamail applications. if anyone application crashes during the running, how the other application behaves?

And Please answer my 2nd question also. Please check my first post above.(multiple tomcat server in the same sysetm is possible?)
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41104
    
  45
Sure, you can run multiple instances of Tomcat (they'd need to use different ports, though - you can only have a single instance listen on port 8080). But the URL structure you posted seems to indicate that running 5 web apps on the same server would do just as well.

There are other options, too. You can have a single Tomcat instance that runs 5 servlet containers on different ports. Check the Tomcat docs for details.

But what do you mean by "crash"? Why would a Tomcat instance crash - for internal or external reasons? If the 5 web apps all do the same thing, I'd rather run a single instance and set up monitoring tools that restart the server if it goes down.


Ping & DNS - my free Android networking tools app
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12761
    
    5
I am not at all clear what your problem is. People run multiple applications addressed as per your example ALL THE TIME. It is just a matter of setting up the directory structure properly.

If you have installed Tomcat you have a working example in front of you. Look at the webapps directory - each one of those subdirectories is a separate web application addressed by a separate URL and manageable separately by the Management application.

See the Servlet API specification for the details but you can probably learn all you need from the docs supplied with Tomcat.

If you design your application correctly, you should be able to recover from practically any error. It really sounds to me as if you are anticipating trouble where there won't be any.

Bill
Edward Durai
Ranch Hand

Joined: Oct 09, 2004
Posts: 223
thanks.

Is it possible to install more than 1 tomcat in a single system with different ports?
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41104
    
  45
Yes. See my earlier post.
Edward Durai
Ranch Hand

Joined: Oct 09, 2004
Posts: 223
i have installed two tomcats

1. 1st tomcat have installed in c:\program files\Tomcat5.0 with port 8080
2. 2nd tomcat have installed in f:\program files\Tomcat5.0 with port 8081

how can i start and work both tomcat at the same time.
[ July 14, 2008: Message edited by: Edward Durai ]
David O'Meara
Rancher

Joined: Mar 06, 2001
Posts: 13459

c:/blah blah blah/bin/start.bat
f:/blah blah blah/bin/start.bat
[ July 14, 2008: Message edited by: David O'Meara ]
Edward Durai
Ranch Hand

Joined: Oct 09, 2004
Posts: 223
I have installed JDK1.5 in my local system,

And 1 tomcat5.0 installed in c drive. during the installation, i have given port 8080
And 1 tomcat5.0 installed in e drive. during the installation, i have given port 8081

during both tomcat installation, i have specified c:\program files\java\jdk1.5 path.

First i have started c: tomcat startup.bat, it is started.

after i tried d: tomcat start.bat, it is not started.

But I got exception like

StandardServer.await: create[8005]: java.net.BindException: Address already in use: JVM_Bind

For Both tomcat's installation, i have given the same JDK1.5 path only. Is there any need to install one more JDK1.5 (each tomcat needs, separate jdk1.5 or not ?)

Please advise
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41104
    
  45
Tomcat uses other ports besides 8080/8443 for internal purposes. E.g., 8005 and 8009. Look through server.xml to find these, and make sure the different instances use different ports, or that those port usages are commented out.

If you change 8005 in particular, then that will affect the shutdown process.
Seetharaman Venkatasamy
Ranch Hand

Joined: Jan 28, 2008
Posts: 5575

so, please can you tell that " what is the best range of port number we can give?"

[example from 8080 to 9000 is preferable]//this just an example
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Is it possible, More than one tomcat running in the one system?
 
Similar Threads
EJB setup
When tomcat starts...
Problem with continuation of tomcat service on WEB SERVER
Two systems on one tomcat 6 server.
compiling first JSP program