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

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 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
 isSet3

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
, ; }' \
 /etc/sysconfig/${NAME}
 )
fi
TOMCAT_SCRIPT=$options $TOMCAT_SCRIPT
}

# See how we were called.
function start() {
echo -n Starting ${TOMCAT_PROG}: 
if [ -f /var/lock/subsys/${NAME} ] ; then
if [ -f /var/run/${NAME}.pid ]; then
read kpid  /var/run/${NAME}.pid
if checkpid $kpid 21; then
echo $NAME process already running
return -1
else
echo lock file found but no process running for
echo pid $kpid, continuing
fi
fi
fi
export CATALINA_PID=/var/run/${NAME}.pid
touch $CATALINA_PID
chown ${TOMCAT_USER}:${TOMCAT_USER} $CATALINA_PID
if [ $CATALINA_HOME != /usr/share/tomcat5-test ]; then
# Create a tomcat directory if it doesn't exist
makeHomeDir
# If CATALINA_HOME doesn't exist modify port number so that
# multiple instances don't interfere with each other
findFreePorts
sed -i -e s/8005/${randomPort1}/g -e s/8080/${CONNECTOR_PORT}/g
\
-e s/8009/${randomPort2}/g -e s/8443/${randomPort3}/g \
${CATALINA_HOME}/conf/server.xml
fi
$TOMCAT_RELINK_SCRIPT
$SU - $TOMCAT_USER -c $TOMCAT_SCRIPT start  $TOMCAT_LOG 21
RETVAL=$?
if [ $RETVAL -eq 0 ]; then
echo_success
touch /var/lock/subsys/${NAME}
else
echo_failure
fi
echo
return $RETVAL
}

function status() {
RETVAL=1
if [ -f /var/run/${NAME}.pid ]; then
read kpid  /var/run/${NAME}.pid
if checkpid $kpid 21; then
echo $0 is already running (${kpid})
RETVAL=0
else
echo lock file found but no process running for pid $kpid
fi
else
pid=$(pgrep -u tomcat java)
if [ -n $pid ]; then
echo $0 running (${pid}) but no PID file exists
RETVAL=0
else
echo $0 is stopped
fi
fi
return $RETVAL
}

function stop() {
local STOP_VERBOSE=false
echo -n Stopping $TOMCAT_PROG: 
if [ -f /var/lock/subsys/${NAME} ]; then
$SU - $TOMCAT_USER -c $TOMCAT_SCRIPT stop  $TOMCAT_LOG 21
RETVAL=$?
if [ $RETVAL -eq 0 ]; then
count=0
if [ -f /var/run/${NAME}.pid ]; then
read kpid  /var/run/${NAME}.pid
until [ $(ps --pid $kpid | grep -c $kpid) -eq 0 ] || \
  [ $count -gt $SHUTDOWN_WAIT ]; do
if [ $STOP_VERBOSE = true ]; then
echo -n -e \nwaiting for processes $kpid to exit
fi
sleep 1
let count=${count}+1
done
if [ $count -gt $SHUTDOWN_WAIT ]; then
if [ $STOP_VERBOSE = true ]; then
echo -n -e \nkilling processes which didn't stop
echo -n -e after 
echo -n $SHUTDOWN_WAIT seconds
fi
kill -9 $kpid
fi
echo_success
if [ $count -gt 0 ]; then
echo -n -e \n
fi
fi
rm -f /var/lock/subsys/$NAME /var/run/$NAME.pid
else
echo_failure
fi
fi
}


# See how we were called.
case $1 in
start)
parseOptions
start
;;
stop)
parseOptions
stop
;;
restart)
parseOptions
stop
sleep 2
start
;;
condrestart)
if [ -f /var/run/${NAME}.pid ]; then
parseOptions
stop
start
fi
;;
status)
status
;;
version)
parseOptions
${JAVA_HOME}/bin/java \
-classpath ${CATALINA_HOME}/server/lib/catalina.jar \
org.apache.catalina.util.ServerInfo
;;
*)
echo Usage: $TOMCAT_PROG
{start|stop|restart|condrestart|status|version}
exit 1
esac

exit $RETVAL 

Thank you,



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

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

Error starting 2nd instance of tomcat

2008-08-27 Thread edponce

I am getting an error starting my 2nd instance with the script i created...
this is my error on my command line

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

and this is my catalina.out file...

-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 

this is the script i am using!! any ideas...PLEASE HELP!

#!/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= ; 

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 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-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]



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]