This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
The moose likes Tomcat and the fly likes Multiple webapps in the same container ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

JavaRanch » Java Forums » Products » Tomcat
Bookmark "Multiple webapps in the same container ?" Watch "Multiple webapps in the same container ?" New topic

Multiple webapps in the same container ?

Mikael Howell

Joined: Dec 29, 2012
Posts: 2
Hi all,

Is it necessary to deploy each webapp in a different tomcat instance.
If NO, how do I deploy all the webapps to the same instance. I face errors related to Perm, memory, scoket,etc.

If Yes, Then how do have multiple instances of Tomcat. I've been struggling to get through this.

Thanks in advance.
Kathleen Angeles
Ranch Hand

Joined: Aug 06, 2012
Posts: 123

Yes, you can install multiple web applications (e.g. multiple war files) in 1 tomcat instance.

They must have different context root.

E.g. you can have localhost:8080/myapp1/index.jsp, and localhost:8080/myapp2/index.jsp

where myapp1 and myapp2 are the context roots.
Mikael Howell

Joined: Dec 29, 2012
Posts: 2
Well I have deployed webapps in the similar fashion.
However, restarting tomcat leaves me with this

Here is the process output
[root@centos logs]# ps aux | grep java
user1 9458 3.2 17.7 630864 186056 ? Sl 22:44 0:24 /usr/java/latest/bin/java -Djava.util.logging.config.file=/usr/share/apache-tomcat/conf/ -Xms128m -Xmx256m -XX:MaxPermSize=256m -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Djava.endorsed.dirs=/usr/share/apache-tomcat/endorsed -classpath /usr/share/apache-tomcat/bin/bootstrap.jar:/usr/share/apache-tomcat/bin/tomcat-juli.jar -Dcatalina.base=/usr/share/apache-tomcat -Dcatalina.home=/usr/share/apache-tomcat org.apache.catalina.startup.Bootstrap start
root 11147 0.0 0.0 3112 740 pts/3 S+ 22:56 0:00 grep java

What am I missing ?
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 17026

Your memory parameters are on the small side. About half of what you allow is going to be used up by Tomcat itself before any webapps even get deployed. Try bumping up mx to 512M or at least 384M.

Customer surveys are for companies who didn't pay proper attention to begin with.
I agree. Here's the link:
subject: Multiple webapps in the same container ?
It's not a secret anymore!