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 Problem in  Creating multiple Instances of Tomcat6.0 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Products » Tomcat
Bookmark "Problem in  Creating multiple Instances of Tomcat6.0" Watch "Problem in  Creating multiple Instances of Tomcat6.0" New topic
Author

Problem in Creating multiple Instances of Tomcat6.0

ashirvad jain
Ranch Hand

Joined: Nov 09, 2006
Posts: 50
Hello frens,
I get stuck in very big trouble ,that might me small for you.
Actually i am trying to create multiple instances of tomcat server6.
e.g tomcatuser1,tomcateuser2....
So far i have searched google and read tomcat running.txt document also but no luck in that.
I am describing below what i did so far.

1) I unzipp the tomcat binary distribution on my windows sys.
2) set JAVA_HOME=which points to my JAVA
3) set CATALINA_HOME=tomcat directory.

After that when i am trying to run apahce default server,it runs perfectly...
But now problem arise when i am trying to create multiple instances of tomcate ..as i said tomcatuser1(_prod),tomcateuser2(_lab)
I read tomcat running.txt file which says...

4) (4) Advanced Configuration - Multiple Tomcat 4 Instances

In many circumstances, it is desirable to have a single copy of a Tomcat 4
binary distribution shared among multiple users on the same server. To make
this possible, you must configure a CATALINA_BASE environment variable (in
addition to CATALINA_HOME as described above) that points to a directory
that is unique to your instance.

When you do this, Tomcat 4 will calculate all relative references for files in
the following directories based on the value for CATALINA_BASE instead of
CATALINA_HOME:

* conf - Server configuration files (including server.xml)

* logs - Log and output files

* shared - For classes and resources that must be shared across all web
applications

* webapps - Automatically loaded web applications

* work - Temporary working directories for web applications

* temp - Directory used by the JVM for temporary files (java.io.tmpdir)

If you do not set CATALINA_BASE to an explicit value, it will be initialized
to the same value as is set for CATALINA_HOME (which means that the same
directory is used for all relative path resolutions).

I did the same and added CATALINA_BASE=tomcatinstanceuser1(_prod).

5) Now the actual problem arise,now when i am starting startup.bat file,
My, tomcatinstanceuser1(_prod) runs perfectly but the origional one not.

So, so far i am able to run tomcateuser1(_prod) but not the tomcat server.

6) i already changed the server.xml to avoid port conflict.

But now i am getting this Error:-

Sep 10, 2008 12:06:03 PM org.apache.catalina.core.AprLifecycleListener init
INFO: Loaded APR based Apache Tomcat Native library 1.1.12.
Sep 10, 2008 12:06:04 PM org.apache.catalina.core.AprLifecycleListener init
INFO: APR capabilities: IPv6 [true], sendfile [true], accept filters [false], random [true].
Sep 10, 2008 12:06:04 PM org.apache.coyote.http11.Http11AprProtocol init
INFO: Initializing Coyote HTTP/1.1 on http-9000
Sep 10, 2008 12:06:04 PM org.apache.coyote.ajp.AjpAprProtocol init
INFO: Initializing Coyote AJP/1.3 on ajp-9009
Sep 10, 2008 12:06:04 PM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 2525 ms
Sep 10, 2008 12:06:05 PM org.apache.catalina.core.StandardService start
INFO: Starting service Catalina
Sep 10, 2008 12:06:05 PM org.apache.catalina.core.StandardEngine start
INFO: Starting Servlet Engine: Apache Tomcat/6.0.16
Sep 10, 2008 12:06:06 PM org.apache.catalina.core.StandardContext addApplicationListener
INFO: The listener "listeners.ContextListener" is already configured for this context. The duplicate definition has been ignored.
Sep 10, 2008 12:06:06 PM org.apache.catalina.core.StandardContext addApplicationListener
INFO: The listener "listeners.SessionListener" is already configured for this context. The duplicate definition has been ignored.
Sep 10, 2008 12:06:07 PM org.apache.coyote.http11.Http11AprProtocol start
INFO: Starting Coyote HTTP/1.1 on http-9000
Sep 10, 2008 12:06:07 PM org.apache.coyote.ajp.AjpAprProtocol start
INFO: Starting Coyote AJP/1.3 on ajp-9009
Sep 10, 2008 12:06:07 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in 2539 ms



please guide me how to resolve this proble.

Thanks in Advance.
ashirvad jain
Ranch Hand

Joined: Nov 09, 2006
Posts: 50
Hello friends,
So far I am observing is if i delete environment variable "CATALINA_BASE"=Tomcateinstanceuser1, then tomcat server start working normally with its defualt http port and rest.
But immediatly when i readd the same environment variale"CATALINA_BASE"=Tomcateinstanceuser1,then tomcat server running fine with Tomcateinstanceuser1's setting and http ports.But then Defualt tomcat stop working on it.
So by my guess i removed both variable "CATALINA_HOME"&"CATALINA_BASE",So that it can run on its defualt.
And for Tomcateinstanceuser1 ,i start running command startup.bat -Dcatalina.base=Tomcateinstanceuser1,so in that case its not running with Tomcateinstanceuser1'setting rather defualt tomcat server's setting and port configuration.

Now please someone guide me,what should i do to make my Tomcateinstanceuser1,Tomcateinstanceuser2,Tomcateinstanceuser3 to make independent services of tomcat.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 39541
    
  27
Do you really need to run two Tomcat instances? Maybe a single instance with two Connectors configured on different ports would suffice?

Either way, I'd suggest to follow the Tomcat 6 documentation; things might have changed substantially since Tomcat 4.


Ping & DNS - updated with new look and Ping home screen widget
ashirvad jain
Ranch Hand

Joined: Nov 09, 2006
Posts: 50
Thanks for your reply,
Actually my purpose is to setup independant envirorment for diff team,with same binary disttribution.
e.g tocat_lab,tomcat_prod,tom_QA like....

Now i am successful in making independent instance of tomcat and making them run independantly,but with one issue i cant make all the instance to
stop at independantly.
Means I can start multiple instance for tomcat_lab,tomcat_prod ....
by setting catalina_base=tomcat_lab & then
catalina_base= tomcat_prod ..
But when i wanna stop tomcat_prod it stops fine with shutdown.bat ,but same wil not for tomcat_lab and other and then i have to stop it by making ctrl ^c which is not good.

So please suggest me how should resolve it.

Thanks in advance
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 39541
    
  27
Are all those servers using different ports for the shutdown command (in addition to using different ports for HTTP and HTTPS)? Search the server.xml file for "8005".
ashirvad jain
Ranch Hand

Joined: Nov 09, 2006
Posts: 50
Hi Ulf,
Yes,All shutdown port are different as well AJP/connector ports are different.
Below list containing the port no that i changed of 3 instances,

Tomcat Dev TomcatLab TomcatUser

server shutdown 8006 9005 9006


http Listener 8001 8083 8085


AJP coyote Conn 8082 8011 8012

Redirecting Port 8443 8444 8445


So in this way all the port numbers are different and unique.
Naga Kurmala
Greenhorn

Joined: Nov 03, 2008
Posts: 1
hey.... how do we define more than one catalina_base if i have to run 4 tomcat instances.... shouli define catalina_base four times in /etc/profile or..... should i write a script for every instance such that it will set catalina_base to required tomcat folder before issuing startup.sh command.... FYI i am using linux environment....
Amit Ghorpade
Bartender

Joined: Jun 06, 2007
Posts: 2709
    
    5

Welcome to Javaranch Naga Kurmala ,
Please UseOneThreadPerQuestion . Hijacking someone's thread is not a good practice.


SCJP, SCWCD.
|Asking Good Questions|
azhar buttar
Greenhorn

Joined: Jul 14, 2009
Posts: 2
Hi everybody,

Please visit the blog given below to find Multiple installation and configuration of Apache Tomcat 6;

http://www.itoperationz.com/2009/07/multiple-instances-of-apache-tomcat-6-on-debain5-lenny/

Please also share your comments about the post.

Regards,

Azhar Ali
azhar buttar
Greenhorn

Joined: Jul 14, 2009
Posts: 2
Hi,

please visit the post given below on IT operationz. I am sure it will help you to create multiple instances of apache tomcat 6 on linux.

http://www.itoperationz.com/2009/07/multiple-instances-of-apache-tomcat-6-on-debain5-lenny/

Please also share your comments about this post.
Regards,

Azhar Ali
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Problem in Creating multiple Instances of Tomcat6.0
 
Similar Threads
Tomcat init ValidatorPlugin and TilesPlugin twice -- why?
shutdown failed Tomcat in netbeans6.1
Solved: Tomcat wont start from Eclipse - java.net.SocketException: select failed
TomCat and SSL cert
Regarding preconfigured tomcat 6.0.16.