Re: HOW TO install/setup 2 instances of tomcat on same server

2008-09-21 Thread buzzterrier

Here is a walk through on setting tomcat and Apache HTTP with catalina base
instances.

http://buzzterrier.blogspot.com/2008/08/apache-tomcat-apache-webserver.html


edponce wrote:
 
 I know this question has been asked a lot but I've read different
 solutions depending on the needs of the problem. I need to have 2
 instances of tomcat on the same server for the same application. One would
 be for production and the other for development (which can be start and
 stopped whenever without affecting the production one).
 From my understanding i need to have each instance on different ports and
 modifying some other files but what I am missing is the technical things.
 Can any one please guide me on the correct direction so that i don't mess
 up anything! I've never worked with Tomcat that is why i have no idea on
 how to do it.
 Thanks in advance 
 

-- 
View this message in context: 
http://www.nabble.com/HOW-TO-install-setup-2-instances-of-tomcat-on-same-server-tp19079289p19600961.html
Sent from the Tomcat - User mailing list archive at Nabble.com.


-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: HOW TO install/setup 2 instances of tomcat on same server

2008-08-27 Thread edponce

that is on windows... I am working on linux via ssh! I dont have anything
installed on my PC...



David Smith-2 wrote:
 
 If you installed tomcat using the .exe installer, go get the .zip 
 download and grab the service.bat file from it's bin directory.  If you 
 installed .zip version of tomcat, you should have a file in the bin 
 directory named service.bat.  Service.bat can help you create new tomcat 
 services in the Windows environment, each with their own name for 
 start/stop/restart. If you want to get custom with the setup, just take 
 a look at how the bat file creates a new service and then roll your own 
 from the command line.
 
 --David
 
 edponce wrote:
 DAvid
 I am on windows, but i connect to the server via ssh so all the commands
 are
 just like in Linux.
 I've tried tomcat5 start, but i think that just works for the original
 tomcat, also, how can i check that when i start the 2nd instsance of
 tomcat
 it start with no errors.
 Thank you
 Eduardo


 David Smith-2 wrote:
   
 Ok ... forgive me if this was posted already, but what OS do you have 
 and how are you starting the production instance?  Windows systems 
 starting the production tomcat as a service is different than Linux/Unix 
 systems starting tomcat with jsvc or a service script.

 --David

 edponce wrote:
 
 David,
 Thanks for replying. I've duplicated my tomcat folder and renamed it
 and
 ive
 changed the 2 connector and the server shut down port. But i dunno
 how
 to start the duplicate instance. how can i do that!
 Thank you,
 Eduardo


 David Smith-2 wrote:
   
   
 Can any one please guide me on the correct direction so that i don't 
 mess up
 anything! I've never worked with Tomcat that is why i have no idea on 
 how to
 do it. 
   
   
 Yes.  Just open the server.xml file in tomcat's conf directory and
 look 
 for the Connector ... / elements that aren't wrapped in xml comments
 ( 
 !-- -- ).  In those you will see port=8009 or whatever.  Just make 
 sure they are all unique in both server.xmls.  Also change the port 
 number in the Server ...  element so it doesn't conflict with the 
 other.  As an aside, I would recommend putting together a new 
 server.xml, removing all the xml comments to make an easier to read 
 server.xml.  Keep the original around for documentation/reference as 
 server.original.xml or whatever you like.

 
 
 You do not necessarily need two separate instances of Tomcat.
 Under Tomcat, each application can be started and stopped (and even a 
 new version reloaded) without stopping the Tomcat server. 
   
   
 Technically yes, but if you restart the app enough times you will run 
 out of memory and need to restart the service.  The max webapp restart 
 count is dependent on how big the webapp is as well as how much extra 
 memory tomcat has.  It's better to occasionally restart a dev instance 
 of tomcat than bounce a production instance when it stops responding.

 --David

 André Warnier wrote:
 
 
 André Warnier wrote:
   
   
 edponce wrote:
 
 
 I know this question has been asked a lot but I've read different 
 solutions
 depending on the needs of the problem. I need to have 2 instances
 of 
 tomcat
 on the same server for the same application. One would be for 
 production and
 the other for development (which can be start and stopped whenever 
 without
 affecting the production one).
   
   
 From my understanding i need to have each instance on different 
 ports and
 
 
 modifying some other files but what I am missing is the technical 
 things.
 Can any one please guide me on the correct direction so that i
 don't 
 mess up
 anything! I've never worked with Tomcat that is why i have no idea 
 on how to
 do it.
   
   
 Ok, serious now.
 This is at the same time some information for you, the Original
 Poster 
 (OP), and a question for the others on this list more
 Tomcat-qualified 
 than I am.  But we've got to start somewhere...

 To the OP (and the others to contradict me if I'm wrong) :

 You do not necessarily need two separate instances of Tomcat.
 Under Tomcat, each application can be started and stopped (and even a 
 new version reloaded) without stopping the Tomcat server.
 You would just need to name your applications differently.
 (like http://host.mycompany.com/real-app; and 
 http://host.mycompany.com/test-app;).

 There also exists the possibility to run one Tomcat with different 
 Virtual Hosts, on the same port 80.
 Each one of these virtual hosts would have a different DNS name 
 (like  realserver.mycompany.com and testserver.mycompany.com) and 
 could have a different directory where the applications reside, but 
 the application itself would be named the same way.

 I am mentioning the above two possibilities because, you knowing not 
 much about Tomcat to start witj, either one of the above is probably 
 easier to 

Re: HOW TO install/setup 2 instances of tomcat on same server

2008-08-27 Thread edponce


ive created this start script in the /usr/bin/ folder...what i did is
modified the previous path of the original tomcat instance to the new one...
wich was /etc/tomcat5 (where i have the catalina policies and jkproperties,
etc) for /etc/tomcat5-testbut that raised other questions should i be
duplicating that folder or my CATALINA_HOME which is /usr/share/tomcat5 and
when I try running the following start up script i am getting this.. any
ideas why?

[EMAIL PROTECTED] rc5.d]# tomcat5-test start
-bash: /usr/bin/tomcat5-test: Permission denied

THIS IS MY START UP SCRIPT...which is a modified copy of the original script
to startup tomcat

#!/bin/bash
#
# tomcat5  This shell script takes care of starting and stopping Tomcat
#
# chkconfig: - 80 20
#
### BEGIN INIT INFO
# Provides: tomcat5
# Required-Start: $network $syslog
# Required-Stop: $network $syslog
# Default-Start:
# Default-Stop:
# Description: Release implementation for Servlet 2.4 and JSP 2.0
# Short-Description: start and stop tomcat
### END INIT INFO
#
# - originally written by Henri Gomez, Keith Irwin, and Nicolas Mailhot
# - heavily rewritten by Deepak Bhole and Jason Corley
#

# commented out until the RHEL and FC daemon functions converge
# Source the function library
#if [ -r /etc/rc.d/init.d/functions ]; then
#. /etc/rc.d/init.d/functions
#fi

NAME=$(basename $0)
unset ISBOOT
if [ ${NAME:0:1} = S -o ${NAME:0:1} = K ]; then
NAME=${NAME:3}
ISBOOT=1
fi

# For SELinux we need to use 'runuser' not 'su'
if [ -x /sbin/runuser ]; then
SU=/sbin/runuser
else
SU=su
fi

# Get the tomcat config (use this for environment specific settings)
TOMCAT_CFG=/etc/tomcat5/tomcat5.conf
if [ -r $TOMCAT_CFG ]; then
. ${TOMCAT_CFG}
fi

# Get instance specific config file
if [ -r /etc/sysconfig/${NAME} ]; then
. /etc/sysconfig/${NAME}
fi

# Define which connector port to use
CONNECTOR_PORT=${CONNECTOR_PORT:-8080}

# Path to the tomcat launch script
TOMCAT_SCRIPT=/usr/bin/tomcat5-test

# Path to the script that will refresh jar symlinks on startup
TOMCAT_RELINK_SCRIPT=${CATALINA_HOME}/bin/relink

# Tomcat program name
TOMCAT_PROG=$NAME
   
# Define the tomcat username
TOMCAT_USER=${TOMCAT_USER:-tomcat}

# Define the tomcat log file
TOMCAT_LOG=${TOMCAT_LOG:-/etc/tomcat5-test/logs/catalina.out}

RETVAL=0

# remove when the RHEL and FC daemon functions converge
# (pulled from /etc/rc.d/init.d/functions)
function checkpid() {
local i
for i in $* ; do
if [ -d /proc/${i} ]; then
return 0
fi
done
return 1
}

# remove when the RHEL and FC daemon functions converge
# (pulled from /etc/rc.d/init.d/functions)
function echo_failure() {
echo -en \\033[60G
echo -n [  
echo -n $FAILED
echo -n   ]
echo -ne \r
return 1
}

# remove when the RHEL and FC daemon functions converge
# (pulled from /etc/rc.d/init.d/functions)
function echo_success() {
echo -en \\033[60G
echo -n [  
echo -n $OK
echo -n   ]
echo -ne \r
return 0
}

# Look for open ports, as the function name might imply
function findFreePorts() {
local isSet1=false
local isSet2=false
local isSet3=false
local lower=8000
randomPort1=0
randomPort2=0
randomPort3=0
local -a listeners=( $(
netstat -ntl | \
awk '/^tcp/ {gsub((.)*:, , $4); print $4}'
) )
while [ $isSet1 = false ] || \
  [ $isSet2 = false ] || \
  [ $isSet3 = false ]; do
let port=${lower}+${RANDOM:0:4}
if [ -z `expr  ${listeners[*]}  : .*\( $port \).*` ]; then
if [ $isSet1 = false ]; then
export randomPort1=$port
isSet1=true
elif [ $isSet2 = false ]; then
export randomPort2=$port
isSet2=true
elif [ $isSet3 = false ]; then
export randomPort3=$port
isSet3=true
fi
fi
done
}

function makeHomeDir() {
if [ ! -d $CATALINA_HOME ]; then
echo $CATALINA_HOME does not exist, creating
if [ ! -d /var/lib/${NAME} ]; then
mkdir -p /var/lib/${NAME}
cp -pLR /var/lib/tomcat5-test/* /var/lib/${NAME}
fi
mkdir -p $CATALINA_HOME ${CATALINA_HOME}/conf
/var/cache/${NAME}/temp \
/var/cache/${NAME}/work /var/log/${NAME}
for i in temp work; do
ln -fs /var/cache/${NAME}/${i} ${CATALINA_HOME}/${i}
done
for i in common server shared webapps; do
ln -fs /var/lib/${NAME}/${i} ${CATALINA_HOME}/${i}
done
ln -fs /var/log/${NAME} ${CATALINA_HOME}/logs
cp -pLR /etc/tomcat5-test/* ${CATALINA_HOME}/conf/
cp -pLR /usr/share/tomcat5-test/bin $CATALINA_HOME
cp -pLR /etc/tomcat5-test/work/* ${CATALINA_HOME}/work/
chown ${TOMCAT_USER}:${TOMCAT_USER} /var/log/${NAME}
fi
}

function parseOptions() {
options=

Re: HOW TO install/setup 2 instances of tomcat on same server

2008-08-27 Thread David Smith


[EMAIL PROTECTED] rc5.d]# tomcat5-test start
-bash: /usr/bin/tomcat5-test: Permission denied
You need to add the execute privilege to your tomcat5-test script.  Take 
a look at the man page for chmod.



...
wich was /etc/tomcat5 (where i have the catalina policies and jkproperties,
etc) for /etc/tomcat5-testbut that raised other questions should i be
duplicating that folder or my CATALINA_HOME which is /usr/share/tomcat5
I suspect there are soft links in /etc/tomcat5 (or /etc/tomcat5 itself 
is a softlink) to /usr/share/tomcat5.  In that case, duplicate both.  
Disk space is generally cheap and tomcat doesn't take that much room.  
That would also bolster separation of the dev and production 
environments as each should have their own log directories.


--David

edponce wrote:

ive created this start script in the /usr/bin/ folder...what i did is
modified the previous path of the original tomcat instance to the new one...
wich was /etc/tomcat5 (where i have the catalina policies and jkproperties,
etc) for /etc/tomcat5-testbut that raised other questions should i be
duplicating that folder or my CATALINA_HOME which is /usr/share/tomcat5 and
when I try running the following start up script i am getting this.. any
ideas why?

[EMAIL PROTECTED] rc5.d]# tomcat5-test start
-bash: /usr/bin/tomcat5-test: Permission denied

THIS IS MY START UP SCRIPT...which is a modified copy of the original script
to startup tomcat

#!/bin/bash
#
# tomcat5  This shell script takes care of starting and stopping Tomcat
#
# chkconfig: - 80 20
#
### BEGIN INIT INFO
# Provides: tomcat5
# Required-Start: $network $syslog
# Required-Stop: $network $syslog
# Default-Start:
# Default-Stop:
# Description: Release implementation for Servlet 2.4 and JSP 2.0
# Short-Description: start and stop tomcat
### END INIT INFO
#
# - originally written by Henri Gomez, Keith Irwin, and Nicolas Mailhot
# - heavily rewritten by Deepak Bhole and Jason Corley
#

# commented out until the RHEL and FC daemon functions converge
# Source the function library
#if [ -r /etc/rc.d/init.d/functions ]; then
#. /etc/rc.d/init.d/functions
#fi

NAME=$(basename $0)
unset ISBOOT
if [ ${NAME:0:1} = S -o ${NAME:0:1} = K ]; then
NAME=${NAME:3}
ISBOOT=1
fi

# For SELinux we need to use 'runuser' not 'su'
if [ -x /sbin/runuser ]; then
SU=/sbin/runuser
else
SU=su
fi

# Get the tomcat config (use this for environment specific settings)
TOMCAT_CFG=/etc/tomcat5/tomcat5.conf
if [ -r $TOMCAT_CFG ]; then
. ${TOMCAT_CFG}
fi

# Get instance specific config file
if [ -r /etc/sysconfig/${NAME} ]; then
. /etc/sysconfig/${NAME}
fi

# Define which connector port to use
CONNECTOR_PORT=${CONNECTOR_PORT:-8080}

# Path to the tomcat launch script
TOMCAT_SCRIPT=/usr/bin/tomcat5-test

# Path to the script that will refresh jar symlinks on startup
TOMCAT_RELINK_SCRIPT=${CATALINA_HOME}/bin/relink

# Tomcat program name
TOMCAT_PROG=$NAME
   
# Define the tomcat username

TOMCAT_USER=${TOMCAT_USER:-tomcat}

# Define the tomcat log file
TOMCAT_LOG=${TOMCAT_LOG:-/etc/tomcat5-test/logs/catalina.out}

RETVAL=0

# remove when the RHEL and FC daemon functions converge
# (pulled from /etc/rc.d/init.d/functions)
function checkpid() {
local i
for i in $* ; do
if [ -d /proc/${i} ]; then
return 0
fi
done
return 1
}

# remove when the RHEL and FC daemon functions converge
# (pulled from /etc/rc.d/init.d/functions)
function echo_failure() {
echo -en \\033[60G
echo -n [  
echo -n $FAILED
echo -n   ]
echo -ne \r
return 1
}

# remove when the RHEL and FC daemon functions converge
# (pulled from /etc/rc.d/init.d/functions)
function echo_success() {
echo -en \\033[60G
echo -n [  
echo -n $OK
echo -n   ]
echo -ne \r
return 0
}

# Look for open ports, as the function name might imply
function findFreePorts() {
local isSet1=false
local isSet2=false
local isSet3=false
local lower=8000
randomPort1=0
randomPort2=0
randomPort3=0
local -a listeners=( $(
netstat -ntl | \
awk '/^tcp/ {gsub((.)*:, , $4); print $4}'
) )
while [ $isSet1 = false ] || \
  [ $isSet2 = false ] || \
  [ $isSet3 = false ]; do
let port=${lower}+${RANDOM:0:4}
if [ -z `expr  ${listeners[*]}  : .*\( $port \).*` ]; then
if [ $isSet1 = false ]; then
export randomPort1=$port
isSet1=true
elif [ $isSet2 = false ]; then
export randomPort2=$port
isSet2=true
elif [ $isSet3 = false ]; then
export randomPort3=$port
isSet3=true
fi
fi
done
}

function makeHomeDir() {
if [ ! -d $CATALINA_HOME ]; then
echo $CATALINA_HOME does not exist, creating
if [ ! -d /var/lib/${NAME} ]; then
mkdir -p /var/lib/${NAME}
   

Re: HOW TO install/setup 2 instances of tomcat on same server

2008-08-27 Thread edponce

is that something like this...

ln -s /etc/tomcat5-test  S71tomcat5-test?



David Smith-2 wrote:
 

 [EMAIL PROTECTED] rc5.d]# tomcat5-test start
 -bash: /usr/bin/tomcat5-test: Permission denied
 You need to add the execute privilege to your tomcat5-test script.  Take 
 a look at the man page for chmod.
 
 ...
 wich was /etc/tomcat5 (where i have the catalina policies and
 jkproperties,
 etc) for /etc/tomcat5-testbut that raised other questions should i be
 duplicating that folder or my CATALINA_HOME which is /usr/share/tomcat5
 I suspect there are soft links in /etc/tomcat5 (or /etc/tomcat5 itself 
 is a softlink) to /usr/share/tomcat5.  In that case, duplicate both.  
 Disk space is generally cheap and tomcat doesn't take that much room.  
 That would also bolster separation of the dev and production 
 environments as each should have their own log directories.
 
 --David
 
 edponce wrote:
 ive created this start script in the /usr/bin/ folder...what i did is
 modified the previous path of the original tomcat instance to the new
 one...
 wich was /etc/tomcat5 (where i have the catalina policies and
 jkproperties,
 etc) for /etc/tomcat5-testbut that raised other questions should i be
 duplicating that folder or my CATALINA_HOME which is /usr/share/tomcat5
 and
 when I try running the following start up script i am getting this.. any
 ideas why?

 [EMAIL PROTECTED] rc5.d]# tomcat5-test start
 -bash: /usr/bin/tomcat5-test: Permission denied

 THIS IS MY START UP SCRIPT...which is a modified copy of the original
 script
 to startup tomcat

 #!/bin/bash
 #
 # tomcat5  This shell script takes care of starting and stopping
 Tomcat
 #
 # chkconfig: - 80 20
 #
 ### BEGIN INIT INFO
 # Provides: tomcat5
 # Required-Start: $network $syslog
 # Required-Stop: $network $syslog
 # Default-Start:
 # Default-Stop:
 # Description: Release implementation for Servlet 2.4 and JSP 2.0
 # Short-Description: start and stop tomcat
 ### END INIT INFO
 #
 # - originally written by Henri Gomez, Keith Irwin, and Nicolas Mailhot
 # - heavily rewritten by Deepak Bhole and Jason Corley
 #

 # commented out until the RHEL and FC daemon functions converge
 # Source the function library
 #if [ -r /etc/rc.d/init.d/functions ]; then
 #. /etc/rc.d/init.d/functions
 #fi

 NAME=$(basename $0)
 unset ISBOOT
 if [ ${NAME:0:1} = S -o ${NAME:0:1} = K ]; then
 NAME=${NAME:3}
 ISBOOT=1
 fi

 # For SELinux we need to use 'runuser' not 'su'
 if [ -x /sbin/runuser ]; then
 SU=/sbin/runuser
 else
 SU=su
 fi

 # Get the tomcat config (use this for environment specific settings)
 TOMCAT_CFG=/etc/tomcat5/tomcat5.conf
 if [ -r $TOMCAT_CFG ]; then
 . ${TOMCAT_CFG}
 fi

 # Get instance specific config file
 if [ -r /etc/sysconfig/${NAME} ]; then
 . /etc/sysconfig/${NAME}
 fi

 # Define which connector port to use
 CONNECTOR_PORT=${CONNECTOR_PORT:-8080}

 # Path to the tomcat launch script
 TOMCAT_SCRIPT=/usr/bin/tomcat5-test

 # Path to the script that will refresh jar symlinks on startup
 TOMCAT_RELINK_SCRIPT=${CATALINA_HOME}/bin/relink

 # Tomcat program name
 TOMCAT_PROG=$NAME

 # Define the tomcat username
 TOMCAT_USER=${TOMCAT_USER:-tomcat}

 # Define the tomcat log file
 TOMCAT_LOG=${TOMCAT_LOG:-/etc/tomcat5-test/logs/catalina.out}

 RETVAL=0

 # remove when the RHEL and FC daemon functions converge
 # (pulled from /etc/rc.d/init.d/functions)
 function checkpid() {
 local i
 for i in $* ; do
 if [ -d /proc/${i} ]; then
 return 0
 fi
 done
 return 1
 }

 # remove when the RHEL and FC daemon functions converge
 # (pulled from /etc/rc.d/init.d/functions)
 function echo_failure() {
 echo -en \\033[60G
 echo -n [  
 echo -n $FAILED
 echo -n   ]
 echo -ne \r
 return 1
 }

 # remove when the RHEL and FC daemon functions converge
 # (pulled from /etc/rc.d/init.d/functions)
 function echo_success() {
 echo -en \\033[60G
 echo -n [  
 echo -n $OK
 echo -n   ]
 echo -ne \r
 return 0
 }

 # Look for open ports, as the function name might imply
 function findFreePorts() {
 local isSet1=false
 local isSet2=false
 local isSet3=false
 local lower=8000
 randomPort1=0
 randomPort2=0
 randomPort3=0
 local -a listeners=( $(
 netstat -ntl | \
 awk '/^tcp/ {gsub((.)*:, , $4); print $4}'
 ) )
 while [ $isSet1 = false ] || \
   [ $isSet2 = false ] || \
   [ $isSet3 = false ]; do
 let port=${lower}+${RANDOM:0:4}
 if [ -z `expr  ${listeners[*]}  : .*\( $port \).*` ]; then
 if [ $isSet1 = false ]; then
 export randomPort1=$port
 isSet1=true
 elif [ $isSet2 = false ]; then
 export randomPort2=$port
 isSet2=true
 elif [ $isSet3 = false ]; then
 export randomPort3=$port
 

Re: HOW TO install/setup 2 instances of tomcat on same server

2008-08-27 Thread edponce

david...
my only problem now is 

[EMAIL PROTECTED] ~]# tomcat5-test start
In the config file
Starting tomcat5-test: [  FAILED  ]

i cant find what is the problem in the config file? any ideas?



David Smith-2 wrote:
 

 [EMAIL PROTECTED] rc5.d]# tomcat5-test start
 -bash: /usr/bin/tomcat5-test: Permission denied
 You need to add the execute privilege to your tomcat5-test script.  Take 
 a look at the man page for chmod.
 
 ...
 wich was /etc/tomcat5 (where i have the catalina policies and
 jkproperties,
 etc) for /etc/tomcat5-testbut that raised other questions should i be
 duplicating that folder or my CATALINA_HOME which is /usr/share/tomcat5
 I suspect there are soft links in /etc/tomcat5 (or /etc/tomcat5 itself 
 is a softlink) to /usr/share/tomcat5.  In that case, duplicate both.  
 Disk space is generally cheap and tomcat doesn't take that much room.  
 That would also bolster separation of the dev and production 
 environments as each should have their own log directories.
 
 --David
 
 edponce wrote:
 ive created this start script in the /usr/bin/ folder...what i did is
 modified the previous path of the original tomcat instance to the new
 one...
 wich was /etc/tomcat5 (where i have the catalina policies and
 jkproperties,
 etc) for /etc/tomcat5-testbut that raised other questions should i be
 duplicating that folder or my CATALINA_HOME which is /usr/share/tomcat5
 and
 when I try running the following start up script i am getting this.. any
 ideas why?

 [EMAIL PROTECTED] rc5.d]# tomcat5-test start
 -bash: /usr/bin/tomcat5-test: Permission denied

 THIS IS MY START UP SCRIPT...which is a modified copy of the original
 script
 to startup tomcat

 #!/bin/bash
 #
 # tomcat5  This shell script takes care of starting and stopping
 Tomcat
 #
 # chkconfig: - 80 20
 #
 ### BEGIN INIT INFO
 # Provides: tomcat5
 # Required-Start: $network $syslog
 # Required-Stop: $network $syslog
 # Default-Start:
 # Default-Stop:
 # Description: Release implementation for Servlet 2.4 and JSP 2.0
 # Short-Description: start and stop tomcat
 ### END INIT INFO
 #
 # - originally written by Henri Gomez, Keith Irwin, and Nicolas Mailhot
 # - heavily rewritten by Deepak Bhole and Jason Corley
 #

 # commented out until the RHEL and FC daemon functions converge
 # Source the function library
 #if [ -r /etc/rc.d/init.d/functions ]; then
 #. /etc/rc.d/init.d/functions
 #fi

 NAME=$(basename $0)
 unset ISBOOT
 if [ ${NAME:0:1} = S -o ${NAME:0:1} = K ]; then
 NAME=${NAME:3}
 ISBOOT=1
 fi

 # For SELinux we need to use 'runuser' not 'su'
 if [ -x /sbin/runuser ]; then
 SU=/sbin/runuser
 else
 SU=su
 fi

 # Get the tomcat config (use this for environment specific settings)
 TOMCAT_CFG=/etc/tomcat5/tomcat5.conf
 if [ -r $TOMCAT_CFG ]; then
 . ${TOMCAT_CFG}
 fi

 # Get instance specific config file
 if [ -r /etc/sysconfig/${NAME} ]; then
 . /etc/sysconfig/${NAME}
 fi

 # Define which connector port to use
 CONNECTOR_PORT=${CONNECTOR_PORT:-8080}

 # Path to the tomcat launch script
 TOMCAT_SCRIPT=/usr/bin/tomcat5-test

 # Path to the script that will refresh jar symlinks on startup
 TOMCAT_RELINK_SCRIPT=${CATALINA_HOME}/bin/relink

 # Tomcat program name
 TOMCAT_PROG=$NAME

 # Define the tomcat username
 TOMCAT_USER=${TOMCAT_USER:-tomcat}

 # Define the tomcat log file
 TOMCAT_LOG=${TOMCAT_LOG:-/etc/tomcat5-test/logs/catalina.out}

 RETVAL=0

 # remove when the RHEL and FC daemon functions converge
 # (pulled from /etc/rc.d/init.d/functions)
 function checkpid() {
 local i
 for i in $* ; do
 if [ -d /proc/${i} ]; then
 return 0
 fi
 done
 return 1
 }

 # remove when the RHEL and FC daemon functions converge
 # (pulled from /etc/rc.d/init.d/functions)
 function echo_failure() {
 echo -en \\033[60G
 echo -n [  
 echo -n $FAILED
 echo -n   ]
 echo -ne \r
 return 1
 }

 # remove when the RHEL and FC daemon functions converge
 # (pulled from /etc/rc.d/init.d/functions)
 function echo_success() {
 echo -en \\033[60G
 echo -n [  
 echo -n $OK
 echo -n   ]
 echo -ne \r
 return 0
 }

 # Look for open ports, as the function name might imply
 function findFreePorts() {
 local isSet1=false
 local isSet2=false
 local isSet3=false
 local lower=8000
 randomPort1=0
 randomPort2=0
 randomPort3=0
 local -a listeners=( $(
 netstat -ntl | \
 awk '/^tcp/ {gsub((.)*:, , $4); print $4}'
 ) )
 while [ $isSet1 = false ] || \
   [ $isSet2 = false ] || \
   [ $isSet3 = false ]; do
 let port=${lower}+${RANDOM:0:4}
 if [ -z `expr  ${listeners[*]}  : .*\( $port \).*` ]; then
 if [ $isSet1 = false ]; then
 export randomPort1=$port
 isSet1=true
 elif [ $isSet2 = false ]; then
 export 

Re: HOW TO install/setup 2 instances of tomcat on same server

2008-08-27 Thread edponce

ive duplicated my folder...modified the specif files created a script for
starting up the 2nd instance and when i start it i get this error, but cant
debut it... any ideas anybody?


[EMAIL PROTECTED] ~]# tomcat5-test start
In the config file
Starting tomcat5-test: [  FAILED  ]


Thank you,


edponce wrote:
 
 I know this question has been asked a lot but I've read different
 solutions depending on the needs of the problem. I need to have 2
 instances of tomcat on the same server for the same application. One would
 be for production and the other for development (which can be start and
 stopped whenever without affecting the production one).
 From my understanding i need to have each instance on different ports and
 modifying some other files but what I am missing is the technical things.
 Can any one please guide me on the correct direction so that i don't mess
 up anything! I've never worked with Tomcat that is why i have no idea on
 how to do it.
 Thanks in advance 
 

-- 
View this message in context: 
http://www.nabble.com/HOW-TO-install-setup-2-instances-of-tomcat-on-same-server-tp19079289p19187640.html
Sent from the Tomcat - User mailing list archive at Nabble.com.


-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: HOW TO install/setup 2 instances of tomcat on same server

2008-08-27 Thread edponce

Tom, ive done everything as youve indicated and when i run my script i get
this error that cant debug, any ideas?

[EMAIL PROTECTED] ~]# tomcat5-test start
In the config file
Starting tomcat5-test: [  FAILED  ]

this is my script ==

#!/bin/bash
#
# tomcat5  This shell script takes care of starting and stopping Tomcat
#
# chkconfig: - 80 20
#
### BEGIN INIT INFO
# Provides: tomcat5
# Required-Start: $network $syslog
# Required-Stop: $network $syslog
# Default-Start:
# Default-Stop:
# Description: Release implementation for Servlet 2.4 and JSP 2.0
# Short-Description: start and stop tomcat
### END INIT INFO
#
# - originally written by Henri Gomez, Keith Irwin, and Nicolas Mailhot
# - heavily rewritten by Deepak Bhole and Jason Corley
#

# commented out until the RHEL and FC daemon functions converge
# Source the function library
#if [ -r /etc/rc.d/init.d/functions ]; then
#. /etc/rc.d/init.d/functions
#fi

NAME=$(basename $0)
unset ISBOOT
if [ ${NAME:0:1} = S -o ${NAME:0:1} = K ]; then
NAME=${NAME:3}
ISBOOT=1
fi

# For SELinux we need to use 'runuser' not 'su'
if [ -x /sbin/runuser ]; then
SU=/sbin/runuser
else
SU=su
fi

# Get the tomcat config (use this for environment specific settings)
TOMCAT_CFG=/etc/tomcat5/tomcat5.conf
if [ -r $TOMCAT_CFG ]; then
. ${TOMCAT_CFG}
fi

# Get instance specific config file
if [ -r /etc/sysconfig/${NAME} ]; then
. /etc/sysconfig/${NAME}
fi

# Define which connector port to use
CONNECTOR_PORT=${CONNECTOR_PORT:-8080}

# Path to the tomcat launch script
TOMCAT_SCRIPT=/usr/bin/tomcat5-test

# Path to the script that will refresh jar symlinks on startup
TOMCAT_RELINK_SCRIPT=${CATALINA_HOME}/bin/relink

# Tomcat program name
TOMCAT_PROG=$NAME
   
# Define the tomcat username
TOMCAT_USER=${TOMCAT_USER:-tomcat}

# Define the tomcat log file
TOMCAT_LOG=${TOMCAT_LOG:-/usr/share/tomcat5-test/logs/logscatalina.out}

RETVAL=0

# remove when the RHEL and FC daemon functions converge
# (pulled from /etc/rc.d/init.d/functions)
function checkpid() {
local i
for i in $* ; do
if [ -d /proc/${i} ]; then
return 0
fi
done
return 1
}

# remove when the RHEL and FC daemon functions converge
# (pulled from /etc/rc.d/init.d/functions)
function echo_failure() {
echo -en \\033[60G
echo -n [  
echo -n $FAILED
echo -n   ]
echo -ne \r
return 1
}

# remove when the RHEL and FC daemon functions converge
# (pulled from /etc/rc.d/init.d/functions)
function echo_success() {
echo -en \\033[60G
echo -n [  
echo -n $OK
echo -n   ]
echo -ne \r
return 0
}

# Look for open ports, as the function name might imply
function findFreePorts() {
local isSet1=false
local isSet2=false
local isSet3=false
local lower=8000
randomPort1=0
randomPort2=0
randomPort3=0
local -a listeners=( $(
netstat -ntl | \
awk '/^tcp/ {gsub((.)*:, , $4); print $4}'
) )
while [ $isSet1 = false ] || \
  [ $isSet2 = false ] || \
  [ $isSet3 = false ]; do
let port=${lower}+${RANDOM:0:4}
if [ -z `expr  ${listeners[*]}  : .*\( $port \).*` ]; then
if [ $isSet1 = false ]; then
export randomPort1=$port
isSet1=true
elif [ $isSet2 = false ]; then
export randomPort2=$port
isSet2=true
elif [ $isSet3 = false ]; then
export randomPort3=$port
isSet3=true
fi
fi
done
}

function makeHomeDir() {
if [ ! -d $CATALINA_HOME ]; then
echo $CATALINA_HOME does not exist, creating
if [ ! -d /var/lib/${NAME} ]; then
mkdir -p /var/lib/${NAME}
cp -pLR /var/lib/tomcat5-test/* /var/lib/${NAME}
fi
mkdir -p $CATALINA_HOME ${CATALINA_HOME}/conf
/var/cache/${NAME}/temp \
/var/cache/${NAME}/work /var/log/${NAME}
for i in temp work; do
ln -fs /var/cache/${NAME}/${i} ${CATALINA_HOME}/${i}
done
for i in common server shared webapps; do
ln -fs /var/lib/${NAME}/${i} ${CATALINA_HOME}/${i}
done
ln -fs /var/log/${NAME} ${CATALINA_HOME}/logs
cp -pLR /usr/share/tomcat5-test/* ${CATALINA_HOME}/conf/
cp -pLR /usr/share/tomcat5-test/bin $CATALINA_HOME
cp -pLR /usr/share/tomcat5-test/* ${CATALINA_HOME}/work/
chown ${TOMCAT_USER}:${TOMCAT_USER} /var/log/${NAME}
fi
}

function parseOptions() {
options=
options=$options $(
 awk '!/^#/  !/^$/ { ORS= ; print export , $0, ; }'
\
 $TOMCAT_CFG
 )
if [ -r /etc/sysconfig/${NAME} ]; then
options=$options $(
 awk '!/^#/  !/^$/ { ORS= ;
   print export , $0, ; }' \

Re: HOW TO install/setup 2 instances of tomcat on same server

2008-08-27 Thread David Smith

Anything in catalina.out related to the failed startup?

--David

edponce wrote:

david...
my only problem now is 

[EMAIL PROTECTED] ~]# tomcat5-test start
In the config file
Starting tomcat5-test: [  FAILED  ]

i cant find what is the problem in the config file? any ideas?



David Smith-2 wrote:
  

[EMAIL PROTECTED] rc5.d]# tomcat5-test start
-bash: /usr/bin/tomcat5-test: Permission denied
  
You need to add the execute privilege to your tomcat5-test script.  Take 
a look at the man page for chmod.




...
wich was /etc/tomcat5 (where i have the catalina policies and
jkproperties,
etc) for /etc/tomcat5-testbut that raised other questions should i be
duplicating that folder or my CATALINA_HOME which is /usr/share/tomcat5
  
I suspect there are soft links in /etc/tomcat5 (or /etc/tomcat5 itself 
is a softlink) to /usr/share/tomcat5.  In that case, duplicate both.  
Disk space is generally cheap and tomcat doesn't take that much room.  
That would also bolster separation of the dev and production 
environments as each should have their own log directories.


--David

edponce wrote:


ive created this start script in the /usr/bin/ folder...what i did is
modified the previous path of the original tomcat instance to the new
one...
wich was /etc/tomcat5 (where i have the catalina policies and
jkproperties,
etc) for /etc/tomcat5-testbut that raised other questions should i be
duplicating that folder or my CATALINA_HOME which is /usr/share/tomcat5
and
when I try running the following start up script i am getting this.. any
ideas why?

[EMAIL PROTECTED] rc5.d]# tomcat5-test start
-bash: /usr/bin/tomcat5-test: Permission denied

THIS IS MY START UP SCRIPT...which is a modified copy of the original
script
to startup tomcat

#!/bin/bash
#
# tomcat5  This shell script takes care of starting and stopping
Tomcat
#
# chkconfig: - 80 20
#
### BEGIN INIT INFO
# Provides: tomcat5
# Required-Start: $network $syslog
# Required-Stop: $network $syslog
# Default-Start:
# Default-Stop:
# Description: Release implementation for Servlet 2.4 and JSP 2.0
# Short-Description: start and stop tomcat
### END INIT INFO
#
# - originally written by Henri Gomez, Keith Irwin, and Nicolas Mailhot
# - heavily rewritten by Deepak Bhole and Jason Corley
#

# commented out until the RHEL and FC daemon functions converge
# Source the function library
#if [ -r /etc/rc.d/init.d/functions ]; then
#. /etc/rc.d/init.d/functions
#fi

NAME=$(basename $0)
unset ISBOOT
if [ ${NAME:0:1} = S -o ${NAME:0:1} = K ]; then
NAME=${NAME:3}
ISBOOT=1
fi

# For SELinux we need to use 'runuser' not 'su'
if [ -x /sbin/runuser ]; then
SU=/sbin/runuser
else
SU=su
fi

# Get the tomcat config (use this for environment specific settings)
TOMCAT_CFG=/etc/tomcat5/tomcat5.conf
if [ -r $TOMCAT_CFG ]; then
. ${TOMCAT_CFG}
fi

# Get instance specific config file
if [ -r /etc/sysconfig/${NAME} ]; then
. /etc/sysconfig/${NAME}
fi

# Define which connector port to use
CONNECTOR_PORT=${CONNECTOR_PORT:-8080}

# Path to the tomcat launch script
TOMCAT_SCRIPT=/usr/bin/tomcat5-test

# Path to the script that will refresh jar symlinks on startup
TOMCAT_RELINK_SCRIPT=${CATALINA_HOME}/bin/relink

# Tomcat program name
TOMCAT_PROG=$NAME
   
# Define the tomcat username

TOMCAT_USER=${TOMCAT_USER:-tomcat}

# Define the tomcat log file
TOMCAT_LOG=${TOMCAT_LOG:-/etc/tomcat5-test/logs/catalina.out}

RETVAL=0

# remove when the RHEL and FC daemon functions converge
# (pulled from /etc/rc.d/init.d/functions)
function checkpid() {
local i
for i in $* ; do
if [ -d /proc/${i} ]; then
return 0
fi
done
return 1
}

# remove when the RHEL and FC daemon functions converge
# (pulled from /etc/rc.d/init.d/functions)
function echo_failure() {
echo -en \\033[60G
echo -n [  
echo -n $FAILED
echo -n   ]
echo -ne \r
return 1
}

# remove when the RHEL and FC daemon functions converge
# (pulled from /etc/rc.d/init.d/functions)
function echo_success() {
echo -en \\033[60G
echo -n [  
echo -n $OK
echo -n   ]
echo -ne \r
return 0
}

# Look for open ports, as the function name might imply
function findFreePorts() {
local isSet1=false
local isSet2=false
local isSet3=false
local lower=8000
randomPort1=0
randomPort2=0
randomPort3=0
local -a listeners=( $(
netstat -ntl | \
awk '/^tcp/ {gsub((.)*:, , $4); print $4}'
) )
while [ $isSet1 = false ] || \
  [ $isSet2 = false ] || \
  [ $isSet3 = false ]; do
let port=${lower}+${RANDOM:0:4}
if [ -z `expr  ${listeners[*]}  : .*\( $port \).*` ]; then
if [ $isSet1 = false ]; then
export randomPort1=$port
isSet1=true
elif [ $isSet2 = false ]; then
export randomPort2=$port

Re: HOW TO install/setup 2 instances of tomcat on same server

2008-08-27 Thread edponce

just that

-sh: line 0: export: `In the config file': not a valid identifier
/bin/bash: /usr/bin/tomcat5-test: Permission denied
-sh: line 0: export: `In the config file': not a valid identifier
/bin/bash: /usr/bin/tomcat5-test: Permission denied



David Smith-2 wrote:
 
 Anything in catalina.out related to the failed startup?
 
 --David
 
 edponce wrote:
 david...
 my only problem now is 

 [EMAIL PROTECTED] ~]# tomcat5-test start
 In the config file
 Starting tomcat5-test: [  FAILED  ]

 i cant find what is the problem in the config file? any ideas?



 David Smith-2 wrote:
   
 [EMAIL PROTECTED] rc5.d]# tomcat5-test start
 -bash: /usr/bin/tomcat5-test: Permission denied
   
 You need to add the execute privilege to your tomcat5-test script.  Take 
 a look at the man page for chmod.

 
 ...
 wich was /etc/tomcat5 (where i have the catalina policies and
 jkproperties,
 etc) for /etc/tomcat5-testbut that raised other questions should i
 be
 duplicating that folder or my CATALINA_HOME which is /usr/share/tomcat5
   
 I suspect there are soft links in /etc/tomcat5 (or /etc/tomcat5 itself 
 is a softlink) to /usr/share/tomcat5.  In that case, duplicate both.  
 Disk space is generally cheap and tomcat doesn't take that much room.  
 That would also bolster separation of the dev and production 
 environments as each should have their own log directories.

 --David

 edponce wrote:
 
 ive created this start script in the /usr/bin/ folder...what i did is
 modified the previous path of the original tomcat instance to the new
 one...
 wich was /etc/tomcat5 (where i have the catalina policies and
 jkproperties,
 etc) for /etc/tomcat5-testbut that raised other questions should i
 be
 duplicating that folder or my CATALINA_HOME which is /usr/share/tomcat5
 and
 when I try running the following start up script i am getting this..
 any
 ideas why?

 [EMAIL PROTECTED] rc5.d]# tomcat5-test start
 -bash: /usr/bin/tomcat5-test: Permission denied

 THIS IS MY START UP SCRIPT...which is a modified copy of the original
 script
 to startup tomcat

 #!/bin/bash
 #
 # tomcat5  This shell script takes care of starting and stopping
 Tomcat
 #
 # chkconfig: - 80 20
 #
 ### BEGIN INIT INFO
 # Provides: tomcat5
 # Required-Start: $network $syslog
 # Required-Stop: $network $syslog
 # Default-Start:
 # Default-Stop:
 # Description: Release implementation for Servlet 2.4 and JSP 2.0
 # Short-Description: start and stop tomcat
 ### END INIT INFO
 #
 # - originally written by Henri Gomez, Keith Irwin, and Nicolas Mailhot
 # - heavily rewritten by Deepak Bhole and Jason Corley
 #

 # commented out until the RHEL and FC daemon functions converge
 # Source the function library
 #if [ -r /etc/rc.d/init.d/functions ]; then
 #. /etc/rc.d/init.d/functions
 #fi

 NAME=$(basename $0)
 unset ISBOOT
 if [ ${NAME:0:1} = S -o ${NAME:0:1} = K ]; then
 NAME=${NAME:3}
 ISBOOT=1
 fi

 # For SELinux we need to use 'runuser' not 'su'
 if [ -x /sbin/runuser ]; then
 SU=/sbin/runuser
 else
 SU=su
 fi

 # Get the tomcat config (use this for environment specific settings)
 TOMCAT_CFG=/etc/tomcat5/tomcat5.conf
 if [ -r $TOMCAT_CFG ]; then
 . ${TOMCAT_CFG}
 fi

 # Get instance specific config file
 if [ -r /etc/sysconfig/${NAME} ]; then
 . /etc/sysconfig/${NAME}
 fi

 # Define which connector port to use
 CONNECTOR_PORT=${CONNECTOR_PORT:-8080}

 # Path to the tomcat launch script
 TOMCAT_SCRIPT=/usr/bin/tomcat5-test

 # Path to the script that will refresh jar symlinks on startup
 TOMCAT_RELINK_SCRIPT=${CATALINA_HOME}/bin/relink

 # Tomcat program name
 TOMCAT_PROG=$NAME

 # Define the tomcat username
 TOMCAT_USER=${TOMCAT_USER:-tomcat}

 # Define the tomcat log file
 TOMCAT_LOG=${TOMCAT_LOG:-/etc/tomcat5-test/logs/catalina.out}

 RETVAL=0

 # remove when the RHEL and FC daemon functions converge
 # (pulled from /etc/rc.d/init.d/functions)
 function checkpid() {
 local i
 for i in $* ; do
 if [ -d /proc/${i} ]; then
 return 0
 fi
 done
 return 1
 }

 # remove when the RHEL and FC daemon functions converge
 # (pulled from /etc/rc.d/init.d/functions)
 function echo_failure() {
 echo -en \\033[60G
 echo -n [  
 echo -n $FAILED
 echo -n   ]
 echo -ne \r
 return 1
 }

 # remove when the RHEL and FC daemon functions converge
 # (pulled from /etc/rc.d/init.d/functions)
 function echo_success() {
 echo -en \\033[60G
 echo -n [  
 echo -n $OK
 echo -n   ]
 echo -ne \r
 return 0
 }

 # Look for open ports, as the function name might imply
 function findFreePorts() {
 local isSet1=false
 local isSet2=false
 local isSet3=false
 local lower=8000
 randomPort1=0
 randomPort2=0
 randomPort3=0
 local -a listeners=( $(
 netstat -ntl | \
 awk '/^tcp/ {gsub((.)*:, , $4); print $4}'
 ) 

Re: HOW TO install/setup 2 instances of tomcat on same server

2008-08-27 Thread David Smith
This error looks like an error in your shell script.  Maybe someone else 
can offer up some help with this.  I use jsvc in my environment.


--David

edponce wrote:

just that

-sh: line 0: export: `In the config file': not a valid identifier
/bin/bash: /usr/bin/tomcat5-test: Permission denied
-sh: line 0: export: `In the config file': not a valid identifier
/bin/bash: /usr/bin/tomcat5-test: Permission denied



David Smith-2 wrote:
  

Anything in catalina.out related to the failed startup?

--David

edponce wrote:


david...
my only problem now is 

[EMAIL PROTECTED] ~]# tomcat5-test start
In the config file
Starting tomcat5-test: [  FAILED  ]

i cant find what is the problem in the config file? any ideas?



David Smith-2 wrote:
  
  

[EMAIL PROTECTED] rc5.d]# tomcat5-test start
-bash: /usr/bin/tomcat5-test: Permission denied
  
  
You need to add the execute privilege to your tomcat5-test script.  Take 
a look at the man page for chmod.





...
wich was /etc/tomcat5 (where i have the catalina policies and
jkproperties,
etc) for /etc/tomcat5-testbut that raised other questions should i
be
duplicating that folder or my CATALINA_HOME which is /usr/share/tomcat5
  
  
I suspect there are soft links in /etc/tomcat5 (or /etc/tomcat5 itself 
is a softlink) to /usr/share/tomcat5.  In that case, duplicate both.  
Disk space is generally cheap and tomcat doesn't take that much room.  
That would also bolster separation of the dev and production 
environments as each should have their own log directories.


--David

edponce wrote:



ive created this start script in the /usr/bin/ folder...what i did is
modified the previous path of the original tomcat instance to the new
one...
wich was /etc/tomcat5 (where i have the catalina policies and
jkproperties,
etc) for /etc/tomcat5-testbut that raised other questions should i
be
duplicating that folder or my CATALINA_HOME which is /usr/share/tomcat5
and
when I try running the following start up script i am getting this..
any
ideas why?

[EMAIL PROTECTED] rc5.d]# tomcat5-test start
-bash: /usr/bin/tomcat5-test: Permission denied

THIS IS MY START UP SCRIPT...which is a modified copy of the original
script
to startup tomcat

#!/bin/bash
#
# tomcat5  This shell script takes care of starting and stopping
Tomcat
#
# chkconfig: - 80 20
#
### BEGIN INIT INFO
# Provides: tomcat5
# Required-Start: $network $syslog
# Required-Stop: $network $syslog
# Default-Start:
# Default-Stop:
# Description: Release implementation for Servlet 2.4 and JSP 2.0
# Short-Description: start and stop tomcat
### END INIT INFO
#
# - originally written by Henri Gomez, Keith Irwin, and Nicolas Mailhot
# - heavily rewritten by Deepak Bhole and Jason Corley
#

# commented out until the RHEL and FC daemon functions converge
# Source the function library
#if [ -r /etc/rc.d/init.d/functions ]; then
#. /etc/rc.d/init.d/functions
#fi

NAME=$(basename $0)
unset ISBOOT
if [ ${NAME:0:1} = S -o ${NAME:0:1} = K ]; then
NAME=${NAME:3}
ISBOOT=1
fi

# For SELinux we need to use 'runuser' not 'su'
if [ -x /sbin/runuser ]; then
SU=/sbin/runuser
else
SU=su
fi

# Get the tomcat config (use this for environment specific settings)
TOMCAT_CFG=/etc/tomcat5/tomcat5.conf
if [ -r $TOMCAT_CFG ]; then
. ${TOMCAT_CFG}
fi

# Get instance specific config file
if [ -r /etc/sysconfig/${NAME} ]; then
. /etc/sysconfig/${NAME}
fi

# Define which connector port to use
CONNECTOR_PORT=${CONNECTOR_PORT:-8080}

# Path to the tomcat launch script
TOMCAT_SCRIPT=/usr/bin/tomcat5-test

# Path to the script that will refresh jar symlinks on startup
TOMCAT_RELINK_SCRIPT=${CATALINA_HOME}/bin/relink

# Tomcat program name
TOMCAT_PROG=$NAME
   
# Define the tomcat username

TOMCAT_USER=${TOMCAT_USER:-tomcat}

# Define the tomcat log file
TOMCAT_LOG=${TOMCAT_LOG:-/etc/tomcat5-test/logs/catalina.out}

RETVAL=0

# remove when the RHEL and FC daemon functions converge
# (pulled from /etc/rc.d/init.d/functions)
function checkpid() {
local i
for i in $* ; do
if [ -d /proc/${i} ]; then
return 0
fi
done
return 1
}

# remove when the RHEL and FC daemon functions converge
# (pulled from /etc/rc.d/init.d/functions)
function echo_failure() {
echo -en \\033[60G
echo -n [  
echo -n $FAILED
echo -n   ]
echo -ne \r
return 1
}

# remove when the RHEL and FC daemon functions converge
# (pulled from /etc/rc.d/init.d/functions)
function echo_success() {
echo -en \\033[60G
echo -n [  
echo -n $OK
echo -n   ]
echo -ne \r
return 0
}

# Look for open ports, as the function name might imply
function findFreePorts() {
local isSet1=false
local isSet2=false
local isSet3=false
local lower=8000
randomPort1=0
randomPort2=0
randomPort3=0
local -a listeners=( $(
netstat -ntl | \
  

RE: HOW TO install/setup 2 instances of tomcat on same server

2008-08-27 Thread Martin Gainty

make sure you have the full path for bash on the first line
you have
#!/bin/bash

i have 
#!/usr/bin/bash

also..
set -vset -o verbosePrints shell input lines as they are read.set -xset -o 
xtracePrint command traces before executing command.
take every opportunity to debug your bash script with echo statements.
http://tldp.org/LDP/Bash-Beginners-Guide/html/sect_02_03.html

Martin 
__ 
Disclaimer and confidentiality note 
Everything in this e-mail and any attachments relates to the official business 
of Sender. This transmission is of a confidential nature and Sender does not 
endorse distribution to any party other than intended recipient. Sender does 
not necessarily endorse content contained within this transmission. 


 Date: Wed, 27 Aug 2008 21:00:12 -0400
 From: [EMAIL PROTECTED]
 To: users@tomcat.apache.org
 Subject: Re: HOW TO install/setup 2 instances of tomcat on same server
 
 This error looks like an error in your shell script.  Maybe someone else 
 can offer up some help with this.  I use jsvc in my environment.
 
 --David
 
 edponce wrote:
  just that
 
  -sh: line 0: export: `In the config file': not a valid identifier
  /bin/bash: /usr/bin/tomcat5-test: Permission denied
  -sh: line 0: export: `In the config file': not a valid identifier
  /bin/bash: /usr/bin/tomcat5-test: Permission denied
 
 
 
  David Smith-2 wrote:

  Anything in catalina.out related to the failed startup?
 
  --David
 
  edponce wrote:
  
  david...
  my only problem now is 
 
  [EMAIL PROTECTED] ~]# tomcat5-test start
  In the config file
  Starting tomcat5-test: [  FAILED  ]
 
  i cant find what is the problem in the config file? any ideas?
 
 
 
  David Smith-2 wrote:


  [EMAIL PROTECTED] rc5.d]# tomcat5-test start
  -bash: /usr/bin/tomcat5-test: Permission denied


  You need to add the execute privilege to your tomcat5-test script.  Take 
  a look at the man page for chmod.
 
  
  
  ...
  wich was /etc/tomcat5 (where i have the catalina policies and
  jkproperties,
  etc) for /etc/tomcat5-testbut that raised other questions should i
  be
  duplicating that folder or my CATALINA_HOME which is /usr/share/tomcat5


  I suspect there are soft links in /etc/tomcat5 (or /etc/tomcat5 itself 
  is a softlink) to /usr/share/tomcat5.  In that case, duplicate both.  
  Disk space is generally cheap and tomcat doesn't take that much room.  
  That would also bolster separation of the dev and production 
  environments as each should have their own log directories.
 
  --David
 
  edponce wrote:
  
  
  ive created this start script in the /usr/bin/ folder...what i did is
  modified the previous path of the original tomcat instance to the new
  one...
  wich was /etc/tomcat5 (where i have the catalina policies and
  jkproperties,
  etc) for /etc/tomcat5-testbut that raised other questions should i
  be
  duplicating that folder or my CATALINA_HOME which is /usr/share/tomcat5
  and
  when I try running the following start up script i am getting this..
  any
  ideas why?
 
  [EMAIL PROTECTED] rc5.d]# tomcat5-test start
  -bash: /usr/bin/tomcat5-test: Permission denied
 
  THIS IS MY START UP SCRIPT...which is a modified copy of the original
  script
  to startup tomcat
 
  #!/bin/bash
  #
  # tomcat5  This shell script takes care of starting and stopping
  Tomcat
  #
  # chkconfig: - 80 20
  #
  ### BEGIN INIT INFO
  # Provides: tomcat5
  # Required-Start: $network $syslog
  # Required-Stop: $network $syslog
  # Default-Start:
  # Default-Stop:
  # Description: Release implementation for Servlet 2.4 and JSP 2.0
  # Short-Description: start and stop tomcat
  ### END INIT INFO
  #
  # - originally written by Henri Gomez, Keith Irwin, and Nicolas Mailhot
  # - heavily rewritten by Deepak Bhole and Jason Corley
  #
 
  # commented out until the RHEL and FC daemon functions converge
  # Source the function library
  #if [ -r /etc/rc.d/init.d/functions ]; then
  #. /etc/rc.d/init.d/functions
  #fi
 
  NAME=$(basename $0)
  unset ISBOOT
  if [ ${NAME:0:1} = S -o ${NAME:0:1} = K ]; then
  NAME=${NAME:3}
  ISBOOT=1
  fi
 
  # For SELinux we need to use 'runuser' not 'su'
  if [ -x /sbin/runuser ]; then
  SU=/sbin/runuser
  else
  SU=su
  fi
 
  # Get the tomcat config (use this for environment specific settings)
  TOMCAT_CFG=/etc/tomcat5/tomcat5.conf
  if [ -r $TOMCAT_CFG ]; then
  . ${TOMCAT_CFG}
  fi
 
  # Get instance specific config file
  if [ -r /etc/sysconfig/${NAME} ]; then
  . /etc/sysconfig/${NAME}
  fi
 
  # Define which connector port to use
  CONNECTOR_PORT=${CONNECTOR_PORT:-8080}
 
  # Path to the tomcat launch script
  TOMCAT_SCRIPT=/usr/bin/tomcat5-test
 
  # Path to the script that will refresh jar symlinks on startup
  TOMCAT_RELINK_SCRIPT=${CATALINA_HOME}/bin/relink
 
  # Tomcat program name
  

Re: HOW TO install/setup 2 instances of tomcat on same server

2008-08-26 Thread edponce

DAvid
I am on windows, but i connect to the server via ssh so all the commands are
just like in Linux.
I've tried tomcat5 start, but i think that just works for the original
tomcat, also, how can i check that when i start the 2nd instsance of tomcat
it start with no errors.
Thank you
Eduardo


David Smith-2 wrote:
 
 Ok ... forgive me if this was posted already, but what OS do you have 
 and how are you starting the production instance?  Windows systems 
 starting the production tomcat as a service is different than Linux/Unix 
 systems starting tomcat with jsvc or a service script.
 
 --David
 
 edponce wrote:
 David,
 Thanks for replying. I've duplicated my tomcat folder and renamed it and
 ive
 changed the 2 connector and the server shut down port. But i dunno
 how
 to start the duplicate instance. how can i do that!
 Thank you,
 Eduardo


 David Smith-2 wrote:
   
 Can any one please guide me on the correct direction so that i don't 
 mess up
 anything! I've never worked with Tomcat that is why i have no idea on 
 how to
 do it. 
   
 Yes.  Just open the server.xml file in tomcat's conf directory and look 
 for the Connector ... / elements that aren't wrapped in xml comments ( 
 !-- -- ).  In those you will see port=8009 or whatever.  Just make 
 sure they are all unique in both server.xmls.  Also change the port 
 number in the Server ...  element so it doesn't conflict with the 
 other.  As an aside, I would recommend putting together a new 
 server.xml, removing all the xml comments to make an easier to read 
 server.xml.  Keep the original around for documentation/reference as 
 server.original.xml or whatever you like.

 
 You do not necessarily need two separate instances of Tomcat.
 Under Tomcat, each application can be started and stopped (and even a 
 new version reloaded) without stopping the Tomcat server. 
   
 Technically yes, but if you restart the app enough times you will run 
 out of memory and need to restart the service.  The max webapp restart 
 count is dependent on how big the webapp is as well as how much extra 
 memory tomcat has.  It's better to occasionally restart a dev instance 
 of tomcat than bounce a production instance when it stops responding.

 --David

 André Warnier wrote:
 
 André Warnier wrote:
   
 edponce wrote:
 
 I know this question has been asked a lot but I've read different 
 solutions
 depending on the needs of the problem. I need to have 2 instances of 
 tomcat
 on the same server for the same application. One would be for 
 production and
 the other for development (which can be start and stopped whenever 
 without
 affecting the production one).
   
 From my understanding i need to have each instance on different 
 ports and
 
 modifying some other files but what I am missing is the technical 
 things.
 Can any one please guide me on the correct direction so that i don't 
 mess up
 anything! I've never worked with Tomcat that is why i have no idea 
 on how to
 do it.
   
 Ok, serious now.
 This is at the same time some information for you, the Original Poster 
 (OP), and a question for the others on this list more Tomcat-qualified 
 than I am.  But we've got to start somewhere...

 To the OP (and the others to contradict me if I'm wrong) :

 You do not necessarily need two separate instances of Tomcat.
 Under Tomcat, each application can be started and stopped (and even a 
 new version reloaded) without stopping the Tomcat server.
 You would just need to name your applications differently.
 (like http://host.mycompany.com/real-app; and 
 http://host.mycompany.com/test-app;).

 There also exists the possibility to run one Tomcat with different 
 Virtual Hosts, on the same port 80.
 Each one of these virtual hosts would have a different DNS name 
 (like  realserver.mycompany.com and testserver.mycompany.com) and 
 could have a different directory where the applications reside, but 
 the application itself would be named the same way.

 I am mentioning the above two possibilities because, you knowing not 
 much about Tomcat to start witj, either one of the above is probably 
 easier to set up than two separate Tomcat instances.

 The difference between the above solutions and two really separate 
 Tomcat instances would be if the test application could really crash 
 the whole server, in which case you may not like one of the above 
 solutions.

 Comments anyone ?


 -
 To start a new topic, e-mail: users@tomcat.apache.org
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]

   
 -
 To start a new topic, e-mail: users@tomcat.apache.org
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]



 

   
 
 
 -- 
 David Smith
 Programmer/Analyst
 College of Agriculture and Life 

Re: HOW TO install/setup 2 instances of tomcat on same server

2008-08-26 Thread David Smith
If you installed tomcat using the .exe installer, go get the .zip 
download and grab the service.bat file from it's bin directory.  If you 
installed .zip version of tomcat, you should have a file in the bin 
directory named service.bat.  Service.bat can help you create new tomcat 
services in the Windows environment, each with their own name for 
start/stop/restart. If you want to get custom with the setup, just take 
a look at how the bat file creates a new service and then roll your own 
from the command line.


--David

edponce wrote:

DAvid
I am on windows, but i connect to the server via ssh so all the commands are
just like in Linux.
I've tried tomcat5 start, but i think that just works for the original
tomcat, also, how can i check that when i start the 2nd instsance of tomcat
it start with no errors.
Thank you
Eduardo


David Smith-2 wrote:
  
Ok ... forgive me if this was posted already, but what OS do you have 
and how are you starting the production instance?  Windows systems 
starting the production tomcat as a service is different than Linux/Unix 
systems starting tomcat with jsvc or a service script.


--David

edponce wrote:


David,
Thanks for replying. I've duplicated my tomcat folder and renamed it and
ive
changed the 2 connector and the server shut down port. But i dunno
how
to start the duplicate instance. how can i do that!
Thank you,
Eduardo


David Smith-2 wrote:
  
  
Can any one please guide me on the correct direction so that i don't 
mess up
anything! I've never worked with Tomcat that is why i have no idea on 
how to
do it. 
  
  
Yes.  Just open the server.xml file in tomcat's conf directory and look 
for the Connector ... / elements that aren't wrapped in xml comments ( 
!-- -- ).  In those you will see port=8009 or whatever.  Just make 
sure they are all unique in both server.xmls.  Also change the port 
number in the Server ...  element so it doesn't conflict with the 
other.  As an aside, I would recommend putting together a new 
server.xml, removing all the xml comments to make an easier to read 
server.xml.  Keep the original around for documentation/reference as 
server.original.xml or whatever you like.





You do not necessarily need two separate instances of Tomcat.
Under Tomcat, each application can be started and stopped (and even a 
new version reloaded) without stopping the Tomcat server. 
  
  
Technically yes, but if you restart the app enough times you will run 
out of memory and need to restart the service.  The max webapp restart 
count is dependent on how big the webapp is as well as how much extra 
memory tomcat has.  It's better to occasionally restart a dev instance 
of tomcat than bounce a production instance when it stops responding.


--David

André Warnier wrote:



André Warnier wrote:
  
  

edponce wrote:


I know this question has been asked a lot but I've read different 
solutions
depending on the needs of the problem. I need to have 2 instances of 
tomcat
on the same server for the same application. One would be for 
production and
the other for development (which can be start and stopped whenever 
without

affecting the production one).
  
  
From my understanding i need to have each instance on different 
ports and


modifying some other files but what I am missing is the technical 
things.
Can any one please guide me on the correct direction so that i don't 
mess up
anything! I've never worked with Tomcat that is why i have no idea 
on how to

do it.
  
  

Ok, serious now.
This is at the same time some information for you, the Original Poster 
(OP), and a question for the others on this list more Tomcat-qualified 
than I am.  But we've got to start somewhere...


To the OP (and the others to contradict me if I'm wrong) :

You do not necessarily need two separate instances of Tomcat.
Under Tomcat, each application can be started and stopped (and even a 
new version reloaded) without stopping the Tomcat server.

You would just need to name your applications differently.
(like http://host.mycompany.com/real-app; and 
http://host.mycompany.com/test-app;).


There also exists the possibility to run one Tomcat with different 
Virtual Hosts, on the same port 80.
Each one of these virtual hosts would have a different DNS name 
(like  realserver.mycompany.com and testserver.mycompany.com) and 
could have a different directory where the applications reside, but 
the application itself would be named the same way.


I am mentioning the above two possibilities because, you knowing not 
much about Tomcat to start witj, either one of the above is probably 
easier to set up than two separate Tomcat instances.


The difference between the above solutions and two really separate 
Tomcat instances would be if the test application could really crash 
the whole server, in which case you may not like one 

Re: HOW TO install/setup 2 instances of tomcat on same server

2008-08-26 Thread edponce

Tom,
ive created this start script...what i did is modified the previous path of
the original tomcat instance to the new one... wich was /etc/tomcat5 (where
i have the catalina policies and jkproperties, etc) for /etc/tomcat5but
that raised other questions should i be duplicating that folder or my
CATALINA_HOME which is /usr/share/tomcat5 and when I try running the
following start up script i am getting this.. any ideas why?

[EMAIL PROTECTED] rc5.d]# tomcat5-test start
-bash: /usr/bin/tomcat5-test: Permission denied

THIS IS MY START UP SCRIPT...which is a modified copy of the original script
to startup tomcat

#!/bin/bash
#
# tomcat5  This shell script takes care of starting and stopping Tomcat
#
# chkconfig: - 80 20
#
### BEGIN INIT INFO
# Provides: tomcat5
# Required-Start: $network $syslog
# Required-Stop: $network $syslog
# Default-Start:
# Default-Stop:
# Description: Release implementation for Servlet 2.4 and JSP 2.0
# Short-Description: start and stop tomcat
### END INIT INFO
#
# - originally written by Henri Gomez, Keith Irwin, and Nicolas Mailhot
# - heavily rewritten by Deepak Bhole and Jason Corley
#

# commented out until the RHEL and FC daemon functions converge
# Source the function library
#if [ -r /etc/rc.d/init.d/functions ]; then
#. /etc/rc.d/init.d/functions
#fi

NAME=$(basename $0)
unset ISBOOT
if [ ${NAME:0:1} = S -o ${NAME:0:1} = K ]; then
NAME=${NAME:3}
ISBOOT=1
fi

# For SELinux we need to use 'runuser' not 'su'
if [ -x /sbin/runuser ]; then
SU=/sbin/runuser
else
SU=su
fi

# Get the tomcat config (use this for environment specific settings)
TOMCAT_CFG=/etc/tomcat5/tomcat5.conf
if [ -r $TOMCAT_CFG ]; then
. ${TOMCAT_CFG}
fi

# Get instance specific config file
if [ -r /etc/sysconfig/${NAME} ]; then
. /etc/sysconfig/${NAME}
fi

# Define which connector port to use
CONNECTOR_PORT=${CONNECTOR_PORT:-8080}

# Path to the tomcat launch script
TOMCAT_SCRIPT=/usr/bin/tomcat5-test

# Path to the script that will refresh jar symlinks on startup
TOMCAT_RELINK_SCRIPT=${CATALINA_HOME}/bin/relink

# Tomcat program name
TOMCAT_PROG=$NAME

# Define the tomcat username
TOMCAT_USER=${TOMCAT_USER:-tomcat}

# Define the tomcat log file
TOMCAT_LOG=${TOMCAT_LOG:-/etc/tomcat5-test/logs/catalina.out}

RETVAL=0

# remove when the RHEL and FC daemon functions converge
# (pulled from /etc/rc.d/init.d/functions)
function checkpid() {
local i
for i in $* ; do
if [ -d /proc/${i} ]; then
return 0
fi
done
return 1
}

# remove when the RHEL and FC daemon functions converge
# (pulled from /etc/rc.d/init.d/functions)
function echo_failure() {
echo -en \\033[60G
echo -n [  
echo -n $FAILED
echo -n   ]
echo -ne \r
return 1
}

# remove when the RHEL and FC daemon functions converge
# (pulled from /etc/rc.d/init.d/functions)
function echo_success() {
echo -en \\033[60G
echo -n [  
echo -n $OK
echo -n   ]
echo -ne \r
return 0
}

# Look for open ports, as the function name might imply
function findFreePorts() {
local isSet1=false
local isSet2=false
local isSet3=false
local lower=8000
randomPort1=0
randomPort2=0
randomPort3=0
local -a listeners=( $(
netstat -ntl | \
awk '/^tcp/ {gsub((.)*:, , $4); print $4}'
) )
while [ $isSet1 = false ] || \
  [ $isSet2 = false ] || \
  [ $isSet3 = false ]; do
let port=${lower}+${RANDOM:0:4}
if [ -z `expr  ${listeners[*]}  : .*\( $port \).*` ]; then
if [ $isSet1 = false ]; then
export randomPort1=$port
isSet1=true
elif [ $isSet2 = false ]; then
export randomPort2=$port
isSet2=true
elif [ $isSet3 = false ]; then
export randomPort3=$port
isSet3=true
fi
fi
done
}

function makeHomeDir() {
if [ ! -d $CATALINA_HOME ]; then
echo $CATALINA_HOME does not exist, creating
if [ ! -d /var/lib/${NAME} ]; then
mkdir -p /var/lib/${NAME}
cp -pLR /var/lib/tomcat5-test/* /var/lib/${NAME}
fi
mkdir -p $CATALINA_HOME ${CATALINA_HOME}/conf
/var/cache/${NAME}/temp \
/var/cache/${NAME}/work /var/log/${NAME}
for i in temp work; do
ln -fs /var/cache/${NAME}/${i} ${CATALINA_HOME}/${i}
done
for i in common server shared webapps; do
ln -fs /var/lib/${NAME}/${i} ${CATALINA_HOME}/${i}
done
ln -fs /var/log/${NAME} ${CATALINA_HOME}/logs
cp -pLR /etc/tomcat5-test/* ${CATALINA_HOME}/conf/
cp -pLR /usr/share/tomcat5-test/bin $CATALINA_HOME
cp -pLR /etc/tomcat5-test/work/* ${CATALINA_HOME}/work/
chown ${TOMCAT_USER}:${TOMCAT_USER} /var/log/${NAME}
fi
}

function parseOptions() {
options=
options=$options $(
 

Re: HOW TO install/setup 2 instances of tomcat on same server

2008-08-25 Thread edponce

Tom,
Thanks for the aclarations and I just have one last question. How do I start
the second instance withough affecting the 1st one? becuase if i do tomcat5
start/stop that will kill both instances right?
Thank you,
Eduardo


Thomas Haines-2 wrote:
 
 Hi edponce
 
 so if i understood everything i just need to duplicate the tomcat  
 folder, do i need to rename it or something?
 
 Yes, you just need to duplicate it.  You can call the duplicate folder  
 whatever you like.
 
 Then On the duplicated tomcat
 directory, you need to edit the server.xml file so that the second
 server.xml as unique ports for the shutdown port, the interface port
 (eg 8080 could become 8081 etc) and how can i check if i've done this
 correctly? that both instances are running?
 
 Yes.  Check your logs during startup and shutdown also for any  
 warnings or port binding issues.
 

 Thanks for your help...
 
 You're welcome.
 
 Cheers
 Tom
 
 
 -
 To start a new topic, e-mail: users@tomcat.apache.org
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 

-- 
View this message in context: 
http://www.nabble.com/HOW-TO-install-setup-2-instances-of-tomcat-on-same-server-tp19079289p19145878.html
Sent from the Tomcat - User mailing list archive at Nabble.com.


-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: HOW TO install/setup 2 instances of tomcat on same server

2008-08-25 Thread edponce

one last question tom, do i need to rename the other tomcat5 archives to
whatever name I choose for my 2nd instance.
Eduardo



edponce wrote:
 
 Tom,
 Thanks for the aclarations and I just have one last question. How do I
 start the second instance withough affecting the 1st one? becuase if i do
 tomcat5 start/stop that will kill both instances right?
 Thank you,
 Eduardo
 
 
 Thomas Haines-2 wrote:
 
 Hi edponce
 
 so if i understood everything i just need to duplicate the tomcat  
 folder, do i need to rename it or something?
 
 Yes, you just need to duplicate it.  You can call the duplicate folder  
 whatever you like.
 
 Then On the duplicated tomcat
 directory, you need to edit the server.xml file so that the second
 server.xml as unique ports for the shutdown port, the interface port
 (eg 8080 could become 8081 etc) and how can i check if i've done this
 correctly? that both instances are running?
 
 Yes.  Check your logs during startup and shutdown also for any  
 warnings or port binding issues.
 

 Thanks for your help...
 
 You're welcome.
 
 Cheers
 Tom
 
 
 -
 To start a new topic, e-mail: users@tomcat.apache.org
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 
 
 

-- 
View this message in context: 
http://www.nabble.com/HOW-TO-install-setup-2-instances-of-tomcat-on-same-server-tp19079289p19146848.html
Sent from the Tomcat - User mailing list archive at Nabble.com.


-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: HOW TO install/setup 2 instances of tomcat on same server

2008-08-25 Thread edponce

David,
Thanks for replying. I've duplicated my tomcat folder and renamed it and ive
changed the 2 connector and the server shut down port. But i dunno how
to start the duplicate instance. how can i do that!
Thank you,
Eduardo


David Smith-2 wrote:
 
 Can any one please guide me on the correct direction so that i don't 
 mess up
 anything! I've never worked with Tomcat that is why i have no idea on 
 how to
 do it. 
 Yes.  Just open the server.xml file in tomcat's conf directory and look 
 for the Connector ... / elements that aren't wrapped in xml comments ( 
 !-- -- ).  In those you will see port=8009 or whatever.  Just make 
 sure they are all unique in both server.xmls.  Also change the port 
 number in the Server ...  element so it doesn't conflict with the 
 other.  As an aside, I would recommend putting together a new 
 server.xml, removing all the xml comments to make an easier to read 
 server.xml.  Keep the original around for documentation/reference as 
 server.original.xml or whatever you like.
 
 You do not necessarily need two separate instances of Tomcat.
 Under Tomcat, each application can be started and stopped (and even a 
 new version reloaded) without stopping the Tomcat server. 
 Technically yes, but if you restart the app enough times you will run 
 out of memory and need to restart the service.  The max webapp restart 
 count is dependent on how big the webapp is as well as how much extra 
 memory tomcat has.  It's better to occasionally restart a dev instance 
 of tomcat than bounce a production instance when it stops responding.
 
 --David
 
 André Warnier wrote:
 André Warnier wrote:
 edponce wrote:
 I know this question has been asked a lot but I've read different 
 solutions
 depending on the needs of the problem. I need to have 2 instances of 
 tomcat
 on the same server for the same application. One would be for 
 production and
 the other for development (which can be start and stopped whenever 
 without
 affecting the production one).
 From my understanding i need to have each instance on different 
 ports and
 modifying some other files but what I am missing is the technical 
 things.
 Can any one please guide me on the correct direction so that i don't 
 mess up
 anything! I've never worked with Tomcat that is why i have no idea 
 on how to
 do it.


 Ok, serious now.
 This is at the same time some information for you, the Original Poster 
 (OP), and a question for the others on this list more Tomcat-qualified 
 than I am.  But we've got to start somewhere...

 To the OP (and the others to contradict me if I'm wrong) :

 You do not necessarily need two separate instances of Tomcat.
 Under Tomcat, each application can be started and stopped (and even a 
 new version reloaded) without stopping the Tomcat server.
 You would just need to name your applications differently.
 (like http://host.mycompany.com/real-app; and 
 http://host.mycompany.com/test-app;).

 There also exists the possibility to run one Tomcat with different 
 Virtual Hosts, on the same port 80.
 Each one of these virtual hosts would have a different DNS name 
 (like  realserver.mycompany.com and testserver.mycompany.com) and 
 could have a different directory where the applications reside, but 
 the application itself would be named the same way.

 I am mentioning the above two possibilities because, you knowing not 
 much about Tomcat to start witj, either one of the above is probably 
 easier to set up than two separate Tomcat instances.

 The difference between the above solutions and two really separate 
 Tomcat instances would be if the test application could really crash 
 the whole server, in which case you may not like one of the above 
 solutions.

 Comments anyone ?


 -
 To start a new topic, e-mail: users@tomcat.apache.org
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]

 
 
 -
 To start a new topic, e-mail: users@tomcat.apache.org
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 

-- 
View this message in context: 
http://www.nabble.com/HOW-TO-install-setup-2-instances-of-tomcat-on-same-server-tp19079289p19152853.html
Sent from the Tomcat - User mailing list archive at Nabble.com.


-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: HOW TO install/setup 2 instances of tomcat on same server

2008-08-25 Thread David Smith
Ok ... forgive me if this was posted already, but what OS do you have 
and how are you starting the production instance?  Windows systems 
starting the production tomcat as a service is different than Linux/Unix 
systems starting tomcat with jsvc or a service script.


--David

edponce wrote:

David,
Thanks for replying. I've duplicated my tomcat folder and renamed it and ive
changed the 2 connector and the server shut down port. But i dunno how
to start the duplicate instance. how can i do that!
Thank you,
Eduardo


David Smith-2 wrote:
  
Can any one please guide me on the correct direction so that i don't 
mess up
anything! I've never worked with Tomcat that is why i have no idea on 
how to
do it. 
  
Yes.  Just open the server.xml file in tomcat's conf directory and look 
for the Connector ... / elements that aren't wrapped in xml comments ( 
!-- -- ).  In those you will see port=8009 or whatever.  Just make 
sure they are all unique in both server.xmls.  Also change the port 
number in the Server ...  element so it doesn't conflict with the 
other.  As an aside, I would recommend putting together a new 
server.xml, removing all the xml comments to make an easier to read 
server.xml.  Keep the original around for documentation/reference as 
server.original.xml or whatever you like.




You do not necessarily need two separate instances of Tomcat.
Under Tomcat, each application can be started and stopped (and even a 
new version reloaded) without stopping the Tomcat server. 
  
Technically yes, but if you restart the app enough times you will run 
out of memory and need to restart the service.  The max webapp restart 
count is dependent on how big the webapp is as well as how much extra 
memory tomcat has.  It's better to occasionally restart a dev instance 
of tomcat than bounce a production instance when it stops responding.


--David

André Warnier wrote:


André Warnier wrote:
  

edponce wrote:

I know this question has been asked a lot but I've read different 
solutions
depending on the needs of the problem. I need to have 2 instances of 
tomcat
on the same server for the same application. One would be for 
production and
the other for development (which can be start and stopped whenever 
without

affecting the production one).
  
From my understanding i need to have each instance on different 
ports and

modifying some other files but what I am missing is the technical 
things.
Can any one please guide me on the correct direction so that i don't 
mess up
anything! I've never worked with Tomcat that is why i have no idea 
on how to

do it.
  

Ok, serious now.
This is at the same time some information for you, the Original Poster 
(OP), and a question for the others on this list more Tomcat-qualified 
than I am.  But we've got to start somewhere...


To the OP (and the others to contradict me if I'm wrong) :

You do not necessarily need two separate instances of Tomcat.
Under Tomcat, each application can be started and stopped (and even a 
new version reloaded) without stopping the Tomcat server.

You would just need to name your applications differently.
(like http://host.mycompany.com/real-app; and 
http://host.mycompany.com/test-app;).


There also exists the possibility to run one Tomcat with different 
Virtual Hosts, on the same port 80.
Each one of these virtual hosts would have a different DNS name 
(like  realserver.mycompany.com and testserver.mycompany.com) and 
could have a different directory where the applications reside, but 
the application itself would be named the same way.


I am mentioning the above two possibilities because, you knowing not 
much about Tomcat to start witj, either one of the above is probably 
easier to set up than two separate Tomcat instances.


The difference between the above solutions and two really separate 
Tomcat instances would be if the test application could really crash 
the whole server, in which case you may not like one of the above 
solutions.


Comments anyone ?


-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

  

-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]






  



--
David Smith
Programmer/Analyst
College of Agriculture and Life Sciences
Cornell University
B32 Morrison Hall
Ithaca, NY 14853
Phone: (607) 255-4521


-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: HOW TO install/setup 2 instances of tomcat on same server

2008-08-24 Thread Thomas Haines

Hi edponce

so if i understood everything i just need to duplicate the tomcat  
folder, do i need to rename it or something?


Yes, you just need to duplicate it.  You can call the duplicate folder  
whatever you like.



Then On the duplicated tomcat
directory, you need to edit the server.xml file so that the second
server.xml as unique ports for the shutdown port, the interface port
(eg 8080 could become 8081 etc) and how can i check if i've done this
correctly? that both instances are running?


Yes.  Check your logs during startup and shutdown also for any  
warnings or port binding issues.




Thanks for your help...


You're welcome.

Cheers
Tom


-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: HOW TO install/setup 2 instances of tomcat on same server

2008-08-22 Thread edponce

Thank you Tom, I think the other repliers were going to far on what they
wanted to do.  this exactly why i want 2 different sessions, It can also be
useful for evaluating a new  
version before you unleash it to production. so if i understood everything
i just need to duplicate the tomcat folder, do i need to rename it or
something? Then On the duplicated tomcat  
directory, you need to edit the server.xml file so that the second  
server.xml as unique ports for the shutdown port, the interface port  
(eg 8080 could become 8081 etc) and how can i check if i've done this
correctly? that both instances are running?
Thanks for your help... a little more info on what I am running


Server version: Apache Tomcat/5.5.20
Server built:   May 15 2007 09:00:46
Server number:  5.5.20.0
OS Name:Linux
OS Version: 2.6.22.14-72.fc6
Architecture:   i386
JVM Version:1.4.2
JVM Vendor: Free Software Foundation, Inc.



Thomas Haines-2 wrote:
 

 edponce wrote:
 I know this question has been asked a lot but I've read different  
 solutions
 depending on the needs of the problem. I need to have 2 instances  
 of tomcat
 on the same server for the same application. One would be for  
 production and
 the other for development (which can be start and stopped whenever  
 without
 affecting the production one).
 From my understanding i need to have each instance on different  
 ports and
 modifying some other files but what I am missing is the technical  
 things.
 Can any one please guide me on the correct direction so that i  
 don't mess up
 anything! I've never worked with Tomcat that is why i have no idea  
 on how to
 do it.
 André Warnier wrote:

 You do not necessarily need two separate instances of Tomcat.  [...]  
 There also exists the possibility to run one Tomcat with different  
 Virtual Hosts, on the same port 80.
 Each one of these virtual hosts would have a different DNS  
 name (like  realserver.mycompany.com and  
 testserver.mycompany.com) and could have a different directory  
 where the applications reside, but the application itself would be  
 named the same way.

 The difference between the above solutions and two really separate  
 Tomcat instances would be if the test application could really crash  
 the whole server, in which case you may not like one of the above  
 solutions.

 Comments anyone ?
 
 When I was new to tomcat (arguably when compared with some members of  
 this list, I could still be considered new), I found it conceptually  
 easier to work with two instances, as you don't need to switch context  
 names etc when you want to deploy live.  Whilst a little cumbersome,  
 and inefficient from a resource usage standpoint, when you're  
 learning, being able to restart tomcat as you shop and change the  
 server.xml file etc can be useful, without fear of breaking the  
 production service.  It can also be useful for evaluating a new  
 version before you unleash it to production.
 
 edponce: If you want to run two instances, the easiest way, to my  
 mind, is to duplicate the tomcat directory.  On the duplicated tomcat  
 directory, you need to edit the server.xml file so that the second  
 server.xml as unique ports for the shutdown port, the interface port  
 (eg 8080 could become 8081 etc).  Once you have made these changes,  
 you should be able to start each of them up by running their  
 respective startup scripts.
 
 You could achieve the same using links and a few other sharing  
 techniques, but for simplicity's sake, I think this approach to two  
 instances using duplicated directories is the most robust.
 
 Tom
 
 
 

-- 
View this message in context: 
http://www.nabble.com/HOW-TO-install-setup-2-instances-of-tomcat-on-same-server-tp19079289p19112602.html
Sent from the Tomcat - User mailing list archive at Nabble.com.


-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: HOW TO install/setup 2 instances of tomcat on same server

2008-08-21 Thread David Smith
Can any one please guide me on the correct direction so that i don't 
mess up
anything! I've never worked with Tomcat that is why i have no idea on 
how to
do it. 
Yes.  Just open the server.xml file in tomcat's conf directory and look 
for the Connector ... / elements that aren't wrapped in xml comments ( 
!-- -- ).  In those you will see port=8009 or whatever.  Just make 
sure they are all unique in both server.xmls.  Also change the port 
number in the Server ...  element so it doesn't conflict with the 
other.  As an aside, I would recommend putting together a new 
server.xml, removing all the xml comments to make an easier to read 
server.xml.  Keep the original around for documentation/reference as 
server.original.xml or whatever you like.



You do not necessarily need two separate instances of Tomcat.
Under Tomcat, each application can be started and stopped (and even a 
new version reloaded) without stopping the Tomcat server. 
Technically yes, but if you restart the app enough times you will run 
out of memory and need to restart the service.  The max webapp restart 
count is dependent on how big the webapp is as well as how much extra 
memory tomcat has.  It's better to occasionally restart a dev instance 
of tomcat than bounce a production instance when it stops responding.


--David

André Warnier wrote:

André Warnier wrote:

edponce wrote:
I know this question has been asked a lot but I've read different 
solutions
depending on the needs of the problem. I need to have 2 instances of 
tomcat
on the same server for the same application. One would be for 
production and
the other for development (which can be start and stopped whenever 
without

affecting the production one).
From my understanding i need to have each instance on different 
ports and
modifying some other files but what I am missing is the technical 
things.
Can any one please guide me on the correct direction so that i don't 
mess up
anything! I've never worked with Tomcat that is why i have no idea 
on how to

do it.




Ok, serious now.
This is at the same time some information for you, the Original Poster 
(OP), and a question for the others on this list more Tomcat-qualified 
than I am.  But we've got to start somewhere...


To the OP (and the others to contradict me if I'm wrong) :

You do not necessarily need two separate instances of Tomcat.
Under Tomcat, each application can be started and stopped (and even a 
new version reloaded) without stopping the Tomcat server.

You would just need to name your applications differently.
(like http://host.mycompany.com/real-app; and 
http://host.mycompany.com/test-app;).


There also exists the possibility to run one Tomcat with different 
Virtual Hosts, on the same port 80.
Each one of these virtual hosts would have a different DNS name 
(like  realserver.mycompany.com and testserver.mycompany.com) and 
could have a different directory where the applications reside, but 
the application itself would be named the same way.


I am mentioning the above two possibilities because, you knowing not 
much about Tomcat to start witj, either one of the above is probably 
easier to set up than two separate Tomcat instances.


The difference between the above solutions and two really separate 
Tomcat instances would be if the test application could really crash 
the whole server, in which case you may not like one of the above 
solutions.


Comments anyone ?


-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: HOW TO install/setup 2 instances of tomcat on same server

2008-08-21 Thread Mark H. Wood
On Thu, Aug 21, 2008 at 02:31:41AM +0200, André Warnier wrote:
 Markus Schönhaber wrote:
[snip]
 Furthermore, if I understand the OP's statement above correctly, he wants 
 to be able to restart the development Tomcat without affecting the 
 production Tomcat. That's not possible with either of those two solutions.

 True. But I was wondering why he said that he needed to restart Tomcat.  
 Considering that he mentioned he knows not much about it, the OP may be 
 unaware that it is not necessary to restart Tomcat, if the reason is just to 
 re-install/re-start a new version of the test application.

Why?  Because, however good Tomcat is, webapp.s are notorious for
leaking (and occasionally gushing) Tomcat's resources as they stop and
start.  Particularly with software under active development, there is
the real possibility that app A will run Tomcat out of some vital
memory pool and precipitate the crash of app B, though B be coded ever
so carefully.

Here our production Tomcats run pretty well.  The development Tomcat
can lock up several times a day, spinning at 100% CPU and unable to
execute a controlled shutdown, as we update a developing app. a mere
dozen times.  I am ever so happy to have not just separate production
and development containers, but separate hosts, to contain the
problems of unfinished software until they can be fixed.

-- 
Mark H. Wood, Lead System Programmer   [EMAIL PROTECTED]
Typically when a software vendor says that a product is intuitive he
means the exact opposite.



pgpW41MVUiO2i.pgp
Description: PGP signature


Re: HOW TO install/setup 2 instances of tomcat on same server

2008-08-21 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Ed,

edponce wrote:
 I know this question has been asked a lot but I've read different solutions
 depending on the needs of the problem. I need to have 2 instances of tomcat
 on the same server for the same application. One would be for production and
 the other for development (which can be start and stopped whenever without
 affecting the production one).

No problem.

 From my understanding i need to have each instance on different ports and
 modifying some other files but what I am missing is the technical things.

If you want separate JVMs running Tomcat, then yes, you will need
separate ports for them. You might not need multiple instances, though.

 Can any one please guide me on the correct direction so that i don't mess up
 anything! I've never worked with Tomcat that is why i have no idea on how to
 do it.

For Java webapp newbies, it's important to understand terminology and
topography. Let's start with topography and move forward from there.

You can deploy Tomcat either standalone (where Tomcat directly receives
HTTP requests) or fronted with another web server like Apache httpd
(which is a very popular setup). Your strategy depends a lot on which
setup you'd like.

You can also deploy your applications into, say, /myApp and /myApp-dev.
If you have a preference, please let us know that before we do on.
Explaining everything start to finish is lengthy and my fingers will get
tired.

So, let us know is you will be running Tomcat standalone or behind a web
server, and then how you intend (or want) to deploy your webapps. Then
we can move on from there.

- -chris

-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.9 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkitnC8ACgkQ9CaO5/Lv0PBAewCeIUof11yQbNF65/Krc6jzdUH0
rfYAnRmB/J47Hx1alk0XCoMG//B5pXv1
=cwqe
-END PGP SIGNATURE-

-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



HOW TO install/setup 2 instances of tomcat on same server

2008-08-20 Thread edponce

I know this question has been asked a lot but I've read different solutions
depending on the needs of the problem. I need to have 2 instances of tomcat
on the same server for the same application. One would be for production and
the other for development (which can be start and stopped whenever without
affecting the production one).
From my understanding i need to have each instance on different ports and
modifying some other files but what I am missing is the technical things.
Can any one please guide me on the correct direction so that i don't mess up
anything! I've never worked with Tomcat that is why i have no idea on how to
do it.
Thanks in advance 
-- 
View this message in context: 
http://www.nabble.com/HOW-TO-install-setup-2-instances-of-tomcat-on-same-server-tp19079289p19079289.html
Sent from the Tomcat - User mailing list archive at Nabble.com.


-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: HOW TO install/setup 2 instances of tomcat on same server

2008-08-20 Thread André Warnier

edponce wrote:

I know this question has been asked a lot but I've read different solutions
depending on the needs of the problem. I need to have 2 instances of tomcat
on the same server for the same application. One would be for production and
the other for development (which can be start and stopped whenever without
affecting the production one).

From my understanding i need to have each instance on different ports and

modifying some other files but what I am missing is the technical things.
Can any one please guide me on the correct direction so that i don't mess up
anything! I've never worked with Tomcat that is why i have no idea on how to
do it.


No, we won't tell you.  This is a list for Tomcat Users only (hence the 
name), and obviously you are not one of them, so go away !


Just kidding.

Can you maybe give a bit more details, such as what system you are 
running this on, and the version of Tomcat if you know ?  That would 
help, a bit.
But it is probably not going to be easy, if you really have no idea of 
Tomcat to start with.  Did you ever work with another Java servlet 
engine, or another HTTP server ?




-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: HOW TO install/setup 2 instances of tomcat on same server

2008-08-20 Thread André Warnier

André Warnier wrote:

edponce wrote:
I know this question has been asked a lot but I've read different 
solutions
depending on the needs of the problem. I need to have 2 instances of 
tomcat
on the same server for the same application. One would be for 
production and
the other for development (which can be start and stopped whenever 
without

affecting the production one).
From my understanding i need to have each instance on different ports 
and

modifying some other files but what I am missing is the technical things.
Can any one please guide me on the correct direction so that i don't 
mess up
anything! I've never worked with Tomcat that is why i have no idea on 
how to

do it.




Ok, serious now.
This is at the same time some information for you, the Original Poster 
(OP), and a question for the others on this list more Tomcat-qualified 
than I am.  But we've got to start somewhere...


To the OP (and the others to contradict me if I'm wrong) :

You do not necessarily need two separate instances of Tomcat.
Under Tomcat, each application can be started and stopped (and even a 
new version reloaded) without stopping the Tomcat server.

You would just need to name your applications differently.
(like http://host.mycompany.com/real-app; and 
http://host.mycompany.com/test-app;).


There also exists the possibility to run one Tomcat with different 
Virtual Hosts, on the same port 80.
Each one of these virtual hosts would have a different DNS name (like 
 realserver.mycompany.com and testserver.mycompany.com) and could 
have a different directory where the applications reside, but the 
application itself would be named the same way.


I am mentioning the above two possibilities because, you knowing not 
much about Tomcat to start witj, either one of the above is probably 
easier to set up than two separate Tomcat instances.


The difference between the above solutions and two really separate 
Tomcat instances would be if the test application could really crash the 
whole server, in which case you may not like one of the above solutions.


Comments anyone ?


-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: HOW TO install/setup 2 instances of tomcat on same server

2008-08-20 Thread Markus Schönhaber

André Warnier wrote:


edponce wrote:


depending on the needs of the problem. I need to have 2 instances of 
tomcat
on the same server for the same application. One would be for 
production and
the other for development (which can be start and stopped whenever 
without

affecting the production one).



You do not necessarily need two separate instances of Tomcat.
Under Tomcat, each application can be started and stopped (and even a 
new version reloaded) without stopping the Tomcat server.

You would just need to name your applications differently.
(like http://host.mycompany.com/real-app; and 
http://host.mycompany.com/test-app;).


Yes, that's possible.

There also exists the possibility to run one Tomcat with different 
Virtual Hosts, on the same port 80.
Each one of these virtual hosts would have a different DNS name (like 
  realserver.mycompany.com and testserver.mycompany.com) and could 
have a different directory where the applications reside, but the 
application itself would be named the same way.


Yes, that's also possible.

I am mentioning the above two possibilities because, you knowing not 
much about Tomcat to start witj, either one of the above is probably 
easier to set up than two separate Tomcat instances.


I don't see what's difficult with creating two separate Tomcats. Just 
unpack the Tomcat archive two times to different directories[1] and 
change the ports used in one of them so that they are unique. Looking at 
the default server.xml, there are three numbers to be changed (YMMV if 
you add/remove Connectors).


The difference between the above solutions and two really separate 
Tomcat instances would be if the test application could really crash the 
whole server, in which case you may not like one of the above solutions.


Exactly.
Furthermore, if I understand the OP's statement above correctly, he 
wants to be able to restart the development Tomcat without affecting the 
production Tomcat. That's not possible with either of those two solutions.



Comments anyone ?


No matter which possibilities exist to set up multiple Tomcat instances 
on a single machine, I would *never* use a production server for 
development. If I was in the OP's shoes, I'd rethink this requirement 
(if it indeed is one).


Regards
  mks

[1] Of course, one can create multiple Tomcat instances from a single 
binary by using multiple different CATALINA_BASEs. But that might be 
unnecessary complex in this case.


-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: HOW TO install/setup 2 instances of tomcat on same server

2008-08-20 Thread André Warnier

Markus Schönhaber wrote:

André Warnier wrote:


edponce wrote:


depending on the needs of the problem. I need to have 2 instances of 
tomcat
on the same server for the same application. One would be for 
production and
the other for development (which can be start and stopped whenever 
without

affecting the production one).



You do not necessarily need two separate instances of Tomcat.
Under Tomcat, each application can be started and stopped (and even a 
new version reloaded) without stopping the Tomcat server.

You would just need to name your applications differently.
(like http://host.mycompany.com/real-app; and 
http://host.mycompany.com/test-app;).


Yes, that's possible.

There also exists the possibility to run one Tomcat with different 
Virtual Hosts, on the same port 80.
Each one of these virtual hosts would have a different DNS name 
(like   realserver.mycompany.com and testserver.mycompany.com) and 
could have a different directory where the applications reside, but 
the application itself would be named the same way.


Yes, that's also possible.

I am mentioning the above two possibilities because, you knowing not 
much about Tomcat to start witj, either one of the above is probably 
easier to set up than two separate Tomcat instances.


I don't see what's difficult with creating two separate Tomcats. Just 
unpack the Tomcat archive two times to different directories[1] and 
change the ports used in one of them so that they are unique. Looking at 
the default server.xml, there are three numbers to be changed (YMMV if 
you add/remove Connectors).


The difference between the above solutions and two really separate 
Tomcat instances would be if the test application could really crash 
the whole server, in which case you may not like one of the above 
solutions.


Exactly.
Furthermore, if I understand the OP's statement above correctly, he 
wants to be able to restart the development Tomcat without affecting the 
production Tomcat. That's not possible with either of those two solutions.


True. But I was wondering why he said that he needed to restart Tomcat. 
 Considering that he mentioned he knows not much about it, the OP may 
be unaware that it is not necessary to restart Tomcat, if the reason is 
just to re-install/re-start a new version of the test application.


To the OP : at least until Tomcat version 5.5, there is an integrated 
web-accessible Manager application, through which you can start and 
stop any application, and upload a new version and restart it.  All this 
through a web form, and without restarting Tomcat.





Comments anyone ?


No matter which possibilities exist to set up multiple Tomcat instances 
on a single machine, I would *never* use a production server for 
development. If I was in the OP's shoes, I'd rethink this requirement 
(if it indeed is one).


Me too.
To the OP : it would really be more secure and stable to use two 
different servers, on which you could install two exactly identical 
Tomcat's.  A test Tomcat does not necessarily need a big server, and 
your average clunky PC running Linux would probably do fine.

(It does need some RAM though).
That would be a lot easier to install, because you could have on each 
just a Tomcat out-of-the-box.
(Also, whether you run Tomcat under Linux or Windows, from a pure-Java 
application point of view it is much the same.)





Regards
  mks

[1] Of course, one can create multiple Tomcat instances from a single 
binary by using multiple different CATALINA_BASEs. But that might be 
unnecessary complex in this case.


Now, edponce, after reading the above and thinking about it, where do 
you incline ?

And please, tell us some more about your exact environment if you can.
Like, what is the server, what is the Tomcat version, where do you get 
it from, how do you install it, etc..

That would help us a lot to narrow down the possibilities.



-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: HOW TO install/setup 2 instances of tomcat on same server

2008-08-20 Thread Thomas Haines



edponce wrote:
I know this question has been asked a lot but I've read different  
solutions
depending on the needs of the problem. I need to have 2 instances  
of tomcat
on the same server for the same application. One would be for  
production and
the other for development (which can be start and stopped whenever  
without

affecting the production one).
From my understanding i need to have each instance on different  
ports and
modifying some other files but what I am missing is the technical  
things.
Can any one please guide me on the correct direction so that i  
don't mess up
anything! I've never worked with Tomcat that is why i have no idea  
on how to

do it.

André Warnier wrote:


You do not necessarily need two separate instances of Tomcat.  [...]  
There also exists the possibility to run one Tomcat with different  
Virtual Hosts, on the same port 80.
Each one of these virtual hosts would have a different DNS  
name (like  realserver.mycompany.com and  
testserver.mycompany.com) and could have a different directory  
where the applications reside, but the application itself would be  
named the same way.


The difference between the above solutions and two really separate  
Tomcat instances would be if the test application could really crash  
the whole server, in which case you may not like one of the above  
solutions.


Comments anyone ?


When I was new to tomcat (arguably when compared with some members of  
this list, I could still be considered new), I found it conceptually  
easier to work with two instances, as you don't need to switch context  
names etc when you want to deploy live.  Whilst a little cumbersome,  
and inefficient from a resource usage standpoint, when you're  
learning, being able to restart tomcat as you shop and change the  
server.xml file etc can be useful, without fear of breaking the  
production service.  It can also be useful for evaluating a new  
version before you unleash it to production.


edponce: If you want to run two instances, the easiest way, to my  
mind, is to duplicate the tomcat directory.  On the duplicated tomcat  
directory, you need to edit the server.xml file so that the second  
server.xml as unique ports for the shutdown port, the interface port  
(eg 8080 could become 8081 etc).  Once you have made these changes,  
you should be able to start each of them up by running their  
respective startup scripts.


You could achieve the same using links and a few other sharing  
techniques, but for simplicity's sake, I think this approach to two  
instances using duplicated directories is the most robust.


Tom